DEV Community

Cover image for Hanya Sekali Klik! Cara Scraping Data Produk Toko di Tokopedia yang Paling Simpel
Rahmat Al Hakam
Rahmat Al Hakam

Posted on

3

Hanya Sekali Klik! Cara Scraping Data Produk Toko di Tokopedia yang Paling Simpel

Fitur

  1. Pencarian berdasarkan input keyword.
  2. Multiple url sekali klik.
  3. Import otomatis ke csv.
  4. Fitur retry jika terjadi error connection.
  5. Ambil data nama toko, produk, harga, rating, penjualan, url product, dan gambar produk.

Screenshot

Kodingan Tokopedia Scraper dengan Python

Gambar 1: Kodingan Tokopedia Scraper dengan Python

 

Hasil Running Script

Gambar 2: Hasil Running Script

 

Data Hasil Scraping

Gambar 3: Data Hasil Scraping

 

Cara Penggunaan

  1. Download dan install python3 di OS kamu jika belum menginstall. Cek: Download pyhton

  2. Clone atau download repository tokped scraper via.
    git clone https://github.com/rahmatalhakam/tokopedia-scraper.git

  3. Install library python yang dibutuhkan.
    pip install requests beautifulsoup4 pandas

  4. Setting keyword pencarian di file config.json

    {
        "keyword": "mouse b100"
    }
    
  5. Tambahkan url toko yang ingin di file tokopedia_shops.csv. Contoh:

    url
    https://www.tokopedia.com/elscomputer
    https://www.tokopedia.com/starcomporigin
    https://www.tokopedia.com/youngscom/
    https://www.tokopedia.com/anandamcomputer
    https://www.tokopedia.com/computajogja
    https://www.tokopedia.com/harrismajogja
    https://www.tokopedia.com/jabenjogja
    
  6. run script pyhon di dengan cara
    python tokpedscraper.py

Note

Jika script ini bermanfaat dan memang digunakan, request fitur baru dapat saya pertimbangkan. Jangan lupa like, follow, dan komen di bawah. Kira-kira fitur apa yang perlu didevelop. Terimakasih. 😃

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay