Berikut adalah versi **Super Prompt** yang telah dimodifikasi agar hasil akhir diekspor dalam format **CSV *(Comma-Separated Values)***. Tidak lagi menggunakan file Excel, tetapi tetap mempertahankan semua fitur pencarian dan struktur tabel.
---
### **SUPER PROMPT: Pencari Data Harga Produk & Ekspor ke CSV**
#### *(Format JSON)*
```json
{
"metadata": {
"tool_name": "Product Price Scraper & CSV Exporter",
"description": "Mencari harga produk dari berbagai marketplace, menampilkan hasil dalam tabel, dan mengekspor data ke file CSV.",
"version": "1.0"
},
"user_input": {
"required": [
{
"field": "keyword",
"label": "Keyword Produk",
"type": "text",
"placeholder": "Contoh: Sepatu Sneakers Puma, Laptop ASUS Vivobook, Minuman Teh Botol",
"description": "Masukkan nama produk yang ingin dicari.",
"validation": "Wajib diisi"
}
],
"optional": [
{
"field": "marketplaces",
"label": "Pilih Marketplace",
"type": "checkbox",
"options": [
{"id": "tokopedia", "label": "Tokopedia", "default": true},
{"id": "shopee", "label": "Shopee", "default": true},
{"id": "lazada", "label": "Lazada", "default": true},
{"id": "bukalapak", "label": "Bukalapak", "default": false},
{"id": "tiktokshop","label": "TikTok Shop","default": false}
],
"description": "Pilih marketplace tempat pencarian akan dilakukan."
},
{
"field": "max_results",
"label": "Jumlah Hasil per Marketplace",
"type": "number",
"default": 5,
"min": 1,
"max": 20,
"description": "Jumlah produk yang diambil dari setiap marketplace."
},
{
"field": "sort_by",
"label": "Urutkan Berdasarkan",
"type": "select",
"options": [
{"value": "price_asc", "label": "Harga: Terendah ke Tertinggi"},
{"value": "price_desc", "label": "Harga: Tertinggi ke Terendah"},
{"value": "relevance", "label": "Relevansi"}
],
"default": "price_asc"
}
],
"submit_button": {
"label": "🔍 Cari Produk"
}
},
"data_scraping": {
"description": "Proses pengambilan data dari marketplace.",
"methods": [
"Gunakan API resmi marketplace *(jika tersedia)*",
"Jika API tidak tersedia, gunakan **web scraping** dengan library seperti **BeautifulSoup (Python)** atau **Cheerio (Node.js)**"
],
"required_data_per_product": [
{
"field": "product_name",
"label": "Nama Produk",
"description": "Nama produk persis seperti di marketplace *(termasuk varian)*"
},
{
"field": "price",
"label": "Harga",
"description": "Harga dalam Rupiah **(Rp)**. **Format: Angka integer tanpa titik/koma untuk proses, lalu format ke Rp saat tampilkan.**",
"format_storage": 1500000,
"format_display": "Rp 1.500.000"
},
{
"field": "merchant_name",
"label": "Nama Toko / Merchant",
"description": "Nama toko atau penjual."
},
{
"field": "marketplace",
"label": "Nama Marketplace",
"description": "Sumber marketplace *(Contoh: Tokopedia, Shopee, Lazada)*"
},
{
"field": "product_url",
"label": "Link / URL",
"description": "**URL langsung ke halaman produk**. Pastikan link valid dan bisa diklik!",
"validation": "Harus berupa URL yang valid."
}
],
"processing_rules": [
{
"rule": "remove_duplicates",
"description": "Hapus produk duplikat *(berdasarkan URL atau kombinasi nama produk + toko)*"
},
{
"rule": "price_filter",
"description": "Filter hanya produk yang memiliki harga **(hilangkan produk yang tidak menampilkan harga)**"
},
{
"rule": "sort_results",
"description": "Urutkan hasil sesuai pilihan pengguna *(default: harga terendah ke tertinggi)*"
}
],
"error_handling": [
{
"error": "marketplace_unavailable",
"message": "⚠️ Gagal mengambil data dari {marketplace}. Silakan coba lagi nanti."
},
{
"error": "no_results",
"message": "🔍 Tidak ditemukan produk untuk keyword: **{keyword}** di {marketplace}."
}
]
},
"table_display": {
"description": "Tampilkan hasil pencarian dalam tabel rapi di UI.",
"columns": [
{"field": "no", "label": "No.", "width": "5%"},
{"field": "product_name", "label": "Nama Produk", "width": "35%"},
{"field": "price", "label": "Harga", "width": "15%"},
{"field": "merchant_name","label": "Nama Toko / Merchant", "width": "20%"},
{"field": "marketplace", "label": "Marketplace", "width": "10%"},
{"field": "product_url", "label": "Link", "width": "15%"}
],
"features": [
{
"feature": "sorting",
"description": "Pengguna bisa mengurutkan tabel dengan mengklik header kolom *(Klik sekali: Ascending, Klik lagi: Descending)*"
},
{
"feature": "search_in_table",
"description": "Fitur pencarian cepat **(search box)** untuk memfilter data di dalam tabel."
},
{
"feature": "pagination",
"description": "Jika hasil lebih dari 10 item, tambahkan **pagination**.",
"items_per_page": 10
},
{
"feature": "clickable_url",
"description": "Kolom **Link** harus berupa **hyperlink** yang bisa diklik. Di tampilan, teksnya bisa diganti jadi **“🔗 Buka Produk”**."
}
]
},
"csv_export": {
"button_label": "📥 Download CSV",
"file_naming": {
"pattern": "Daftar_Harga_{keyword}_{date}.csv",
"date_format": "YYYYMMDD",
"example": "Daftar_Harga_Sepatu_Sneakers_Puma_20231015.csv",
"replace_spaces": "_"
},
"csv_structure": {
"delimiter": ",",
"enclosure": "\"",
"columns": [
"No.",
"Nama Produk",
"Harga",
"Nama Toko / Merchant",
"Nama Marketplace",
"Link / URL"
],
"header_included": true,
**"format_harga": "ANGKA POLOS (TANPA Rp dan TANPA TITik)"**,
"description": [
"**PENTING:**",
"🔹 Kolom **Harga** akan ditulis dalam bentuk **ANGKA POLOS (INTEGER)** tanpa simbol **Rp** dan tanpa titik pemisah ribuan. Contoh: `1500000`",
"🔹 Kolom **Link / URL** akan berisi URL lengkap.",
"🔹 File CSV menggunakan **comma (,) sebagai pemisah kolom** dan **tanda kutip (\")** sebagai enclosure *(untuk data yang mengandung koma)*."
],
"example_content": [
"No.,Nama Produk,Harga,Nama Toko / Merchant,Nama Marketplace,Link / URL",
"1,Sepatu Sneakers Puma RS-X,1299000,Puma Official Store,Tokopedia,https://tokopedia.com/...",
"2,Puma RS-X Sneakers Putih,1350000,Sepatu Murah ID,Shopee,https://shopee.co.id/..."
]
},
"library_recommendation": [
"**Python:** pandas *(to_csv)*",
"**Node.js:** csv-writer",
"**Google Apps Script:** Utilities.newCsvOutput()**",
"**PHP:** fputcsv()"
]
},
"technical_stack_recommendation": {
"frontend": [
"HTML, CSS, JavaScript",
"Library: DataTables (untuk tabel interaktif), Bootstrap"
],
"backend": [
"**Python:** Flask/Django + BeautifulSoup/Scrapy + pandas",
"**Node.js:** Express + Cheerio + csv-writer",
"**Google Apps Script:** (Tanpa server, langsung integrasi dengan Google Sheet, lalu ekspor sebagai CSV)"
],
"deployment": [
"Hosting: Vercel, Netlify, Heroku, atau PythonAnywhere",
"Untuk scraping intensif: Gunakan **server dengan IP tetap** *(menghindari blokir IP)*"
]
},
"example_workflow": [
"1. Pengguna memasukkan **keyword** *(contoh: ‘Sepatu Sneakers Puma’)* dan memilih marketplace.",
"2. Sistem melakukan **scraping/API request** ke setiap marketplace yang dipilih.",
"3. Data dikumpulkan, difilter, diurutkan, dan **ditampilkan dalam tabel**. ",
"4. Pengguna mengklik tombol ***‘Download CSV’***.",
"5. Sistem membuat file **CSV** sesuai format, lalu **mengirimkan file ke pengguna** *(download otomatis)*."
],
"notes": [
"🔹 **Etika Scraping:** Selalu perhatikan `robots.txt` marketplace. Jangan lakukan scraping terlalu sering agar tidak diblokir. Gunakan **delay** antar request *(minimal 2 detik)*.",
"🔹 **User Experience:** Tampilkan **loading animation** saat proses scraping berlangsung.",
"🔹 **Keamanan:** Jangan simpan data pengguna. File CSV di-generate **on-the-fly** dan **tidak disimpan di server**.",
"🔹 **Format Harga di CSV:** Harga **HARUS** dalam bentuk angka polos *(contoh: `1500000`)* **TANPA** simbol Rp dan **TANPA** titik. Ini penting agar data bisa mudah diimpor ke program lain *(Excel, Google Sheet, database)*."
]
}
```
---
### **Perubahan Utama dari Versi Excel ke CSV**
#### 📌 **Bagian `excel_export` Diganti Menjadi `csv_export`**
1. **Tombol Unduh**
Dari ***“Download Excel”*** menjadi ***“Download CSV”***
2. **Penamaan File**
Ekstensi berubah dari **`.xlsx`** menjadi **`.csv`**
3. **Struktur Data**
| Fitur | Excel | **CSV** |
| :-------------------- | :---------------------------------------- | :--------------------------------------- |
| **Formating Harga** | Format Currency *(Rp 1.500.000)* | ***ANGKA POLOS (1500000)*** |
| **Hyperlink** | Link bisa diklik di dalam Excel | ***HANYA TEKS URL*** *(tidak bisa diklik di semua aplikasi)* |
| **Header Style** | Ada formatting *(bold, warna latar)* | ***HANYA TEKS*** *(tidak ada formatting)* |
| **Enclosure** | Tidak perlu | Menggunakan ***tanda kutip (`"`)*** untuk data yang mengandung **koma** |
4. **Pentingnya Format Harga di CSV**
***HARGA HARUS DIEKSPOR SEBAGAI ANGKA POLOS TANPA SIMBOL DAN TANPA TITik!***
Contoh:
❌ **SALAH:** `Rp 1.500.000`
✅ **BENAR:** **`1500000`**
Alasan:
Agar data harga bisa langsung diolah oleh program lain **(Excel, Google Sheet, Python Pandas, database)** tanpa perlu *data cleaning*.
5. **Library yang Direkomendasikan**
* **Python:**
Gunakan **`pandas.to_csv()`**
*(Contoh kode di bawah)*
* **Node.js:**
Gunakan **`csv-writer`** *(npm install csv-writer)*
* **Google Apps Script:**
Gunakan **`Utilities.newCsvOutput()`**
---
### 📌 **CONTOH KODE (Python) untuk Generate CSV**
```python
import pandas as pd
from datetime import datetime
# Data hasil scraping (CONTOH)
data = [
{"No.": 1, "Nama Produk": "Sepatu Sneakers Puma RS-X", "Harga": 1299000, "Nama Toko / Merchant": "Puma Official Store", "Nama Marketplace": "Tokopedia", "Link / URL": "https://tokopedia.com/produk-puma-rsx"},
{"No.": 2, "Nama Produk": "Puma RS-X Sneakers Putih", "Harga": 1350000, "Nama Toko / Merchant": "Sepatu Murah ID", "Nama Marketplace": "Shopee", "Link / URL": "https://shopee.co.id/produk-puma-rsx-putih"},
]
# Buat DataFrame
df = pd.DataFrame(data)
# PASTIKAN KOLOM HARGA ADALAH INTEGER (TANPA Rp dan TANPA TITik)
df["Harga"] = df["Harga"].astype(int)
# Buat nama file
keyword = "Sepatu Sneakers Puma" # Ambil dari input user
date_now = datetime.now().strftime("%Y%m%d")
filename = f"Daftar_Harga_{keyword.replace(' ', '_')}_{date_now}.csv"
# Simpan ke CSV
df.to_csv(
filename,
index=False, # Jangan tambahkan kolom index
sep=',', # Pemisah kolom: koma
encoding='utf-8', # Encoding agar support karakter Indonesia
quotechar='"', # Enclosure: tanda kutip doble
quoting=csv.QUOTE_ALL # Enclose SEMUA kolom dengan tanda kutip (opsional, bisa dihilangkan)
)
print(f"✅ File CSV berhasil dibuat: {filename}")
```
📌 ***Hasil File CSV (`Daftar_Harga_Sepatu_Sneakers_Puma_20231015.csv`)***
```csv
"No.","Nama Produk","Harga","Nama Toko / Merchant","Nama Marketplace","Link / URL"
1,"Sepatu Sneakers Puma RS-X",1299000,"Puma Official Store","Tokopedia","https://tokopedia.com/produk-puma-rsx"
2,"Puma RS-X Sneakers Putih",1350000,"Sepatu Murah ID","Shopee","https://shopee.co.id/produk-puma-rsx-putih"
```
🔹 ***File ini siap diunduh oleh pengguna dan bisa dibuka di Excel, Google Sheet, atau aplikasi lain!***
{
"metadata": {
"tool_name": "Product Price Scraper & CSV Exporter",
"description": "Mencari harga produk dari berbagai marketplace, menampilkan hasil dalam tabel, dan mengekspor data ke file CSV.",
"version": "1.0"
},
"user_input": {
"required": [
{
"field": "keyword",
"label": "Keyword Produk",
"type": "text",
"placeholder": "Contoh: Sepatu Sneakers Puma, Laptop ASUS Vivobook, Minuman Teh Botol",
"description": "Masukkan nama produk yang ingin dicari.",
"validation": "Wajib diisi"
}
],
"optional": [
{
"field": "marketplaces",
"label": "Pilih Marketplace",
"type": "checkbox",
"options": [
{"id": "tokopedia", "label": "Tokopedia", "default": true},
{"id": "shopee", "label": "Shopee", "default": true},
{"id": "lazada", "label": "Lazada", "default": true},
{"id": "bukalapak", "label": "Bukalapak", "default": false},
{"id": "tiktokshop","label": "TikTok Shop","default": false}
],
"description": "Pilih marketplace tempat pencarian akan dilakukan."
},
{
"field": "max_results",
"label": "Jumlah Hasil per Marketplace",
"type": "number",
"default": 5,
"min": 1,
"max": 20,
"description": "Jumlah produk yang diambil dari setiap marketplace."
},
{
"field": "sort_by",
"label": "Urutkan Berdasarkan",
"type": "select",
"options": [
{"value": "price_asc", "label": "Harga: Terendah ke Tertinggi"},
{"value": "price_desc", "label": "Harga: Tertinggi ke Terendah"},
{"value": "relevance", "label": "Relevansi"}
],
"default": "price_asc"
}
],
"submit_button": {
"label": "🔍 Cari Produk"
}
},
"data_scraping": {
"description": "Proses pengambilan data dari marketplace.",
"methods": [
"Gunakan API resmi marketplace *(jika tersedia)*",
"Jika API tidak tersedia, gunakan **web scraping** dengan library seperti **BeautifulSoup (Python)** atau **Cheerio (Node.js)**"
],
"required_data_per_product": [
{
"field": "product_name",
"label": "Nama Produk",
"description": "Nama produk persis seperti di marketplace *(termasuk varian)*"
},
{
"field": "price",
"label": "Harga",
"description": "Harga dalam Rupiah **(Rp)**. **Format: Angka integer tanpa titik/koma untuk proses, lalu format ke Rp saat tampilkan.**",
"format_storage": 1500000,
"format_display": "Rp 1.500.000"
},
{
"field": "merchant_name",
"label": "Nama Toko / Merchant",
"description": "Nama toko atau penjual."
},
{
"field": "marketplace",
"label": "Nama Marketplace",
"description": "Sumber marketplace *(Contoh: Tokopedia, Shopee, Lazada)*"
},
{
"field": "product_url",
"label": "Link / URL",
"description": "**URL langsung ke halaman produk**. Pastikan link valid dan bisa diklik!",
"validation": "Harus berupa URL yang valid."
}
],
"processing_rules": [
{
"rule": "remove_duplicates",
"description": "Hapus produk duplikat *(berdasarkan URL atau kombinasi nama produk + toko)*"
},
{
"rule": "price_filter",
"description": "Filter hanya produk yang memiliki harga **(hilangkan produk yang tidak menampilkan harga)**"
},
{
"rule": "sort_results",
"description": "Urutkan hasil sesuai pilihan pengguna *(default: harga terendah ke tertinggi)*"
}
],
"error_handling": [
{
"error": "marketplace_unavailable",
"message": "⚠️ Gagal mengambil data dari {marketplace}. Silakan coba lagi nanti."
},
{
"error": "no_results",
"message": "🔍 Tidak ditemukan produk untuk keyword: **{keyword}** di {marketplace}."
}
]
},
"table_display": {
"description": "Tampilkan hasil pencarian dalam tabel rapi di UI.",
"columns": [
{"field": "no", "label": "No.", "width": "5%"},
{"field": "product_name", "label": "Nama Produk", "width": "35%"},
{"field": "price", "label": "Harga", "width": "15%"},
{"field": "merchant_name","label": "Nama Toko / Merchant", "width": "20%"},
{"field": "marketplace", "label": "Marketplace", "width": "10%"},
{"field": "product_url", "label": "Link", "width": "15%"}
],
"features": [
{
"feature": "sorting",
"description": "Pengguna bisa mengurutkan tabel dengan mengklik header kolom *(Klik sekali: Ascending, Klik lagi: Descending)*"
},
{
"feature": "search_in_table",
"description": "Fitur pencarian cepat **(search box)** untuk memfilter data di dalam tabel."
},
{
"feature": "pagination",
"description": "Jika hasil lebih dari 10 item, tambahkan **pagination**.",
"items_per_page": 10
},
{
"feature": "clickable_url",
"description": "Kolom **Link** harus berupa **hyperlink** yang bisa diklik. Di tampilan, teksnya bisa diganti jadi **“🔗 Buka Produk”**."
}
]
},
"csv_export": {
"button_label": "📥 Download CSV",
"file_naming": {
"pattern": "Daftar_Harga_{keyword}_{date}.csv",
"date_format": "YYYYMMDD",
"example": "Daftar_Harga_Sepatu_Sneakers_Puma_20231015.csv",
"replace_spaces": "_"
},
"csv_structure": {
"delimiter": ",",
"enclosure": "\"",
"columns": [
"No.",
"Nama Produk",
"Harga",
"Nama Toko / Merchant",
"Nama Marketplace",
"Link / URL"
],
"header_included": true,
**"format_harga": "ANGKA POLOS (TANPA Rp dan TANPA TITik)"**,
"description": [
"**PENTING:**",
"🔹 Kolom **Harga** akan ditulis dalam bentuk **ANGKA POLOS (INTEGER)** tanpa simbol **Rp** dan tanpa titik pemisah ribuan. Contoh: `1500000`",
"🔹 Kolom **Link / URL** akan berisi URL lengkap.",
"🔹 File CSV menggunakan **comma (,) sebagai pemisah kolom** dan **tanda kutip (\")** sebagai enclosure *(untuk data yang mengandung koma)*."
],
"example_content": [
"No.,Nama Produk,Harga,Nama Toko / Merchant,Nama Marketplace,Link / URL",
"1,Sepatu Sneakers Puma RS-X,1299000,Puma Official Store,Tokopedia,https://tokopedia.com/...",
"2,Puma RS-X Sneakers Putih,1350000,Sepatu Murah ID,Shopee,https://shopee.co.id/..."
]
},
"library_recommendation": [
"**Python:** pandas *(to_csv)*",
"**Node.js:** csv-writer",
"**Google Apps Script:** Utilities.newCsvOutput()**",
"**PHP:** fputcsv()"
]
},
"technical_stack_recommendation": {
"frontend": [
"HTML, CSS, JavaScript",
"Library: DataTables (untuk tabel interaktif), Bootstrap"
],
"backend": [
"**Python:** Flask/Django + BeautifulSoup/Scrapy + pandas",
"**Node.js:** Express + Cheerio + csv-writer",
"**Google Apps Script:** (Tanpa server, langsung integrasi dengan Google Sheet, lalu ekspor sebagai CSV)"
],
"deployment": [
"Hosting: Vercel, Netlify, Heroku, atau PythonAnywhere",
"Untuk scraping intensif: Gunakan **server dengan IP tetap** *(menghindari blokir IP)*"
]
},
"example_workflow": [
"1. Pengguna memasukkan **keyword** *(contoh: ‘Sepatu Sneakers Puma’)* dan memilih marketplace.",
"2. Sistem melakukan **scraping/API request** ke setiap marketplace yang dipilih.",
"3. Data dikumpulkan, difilter, diurutkan, dan **ditampilkan dalam tabel**. ",
"4. Pengguna mengklik tombol ***‘Download CSV’***.",
"5. Sistem membuat file **CSV** sesuai format, lalu **mengirimkan file ke pengguna** *(download otomatis)*."
],
"notes": [
"🔹 **Etika Scraping:** Selalu perhatikan `robots.txt` marketplace. Jangan lakukan scraping terlalu sering agar tidak diblokir. Gunakan **delay** antar request *(minimal 2 detik)*.",
"🔹 **User Experience:** Tampilkan **loading animation** saat proses scraping berlangsung.",
"🔹 **Keamanan:** Jangan simpan data pengguna. File CSV di-generate **on-the-fly** dan **tidak disimpan di server**.",
"🔹 **Format Harga di CSV:** Harga **HARUS** dalam bentuk angka polos *(contoh: `1500000`)* **TANPA** simbol Rp dan **TANPA** titik. Ini penting agar data bisa mudah diimpor ke program lain *(Excel, Google Sheet, database)*."
]
}