Scrape Dữ Liệu Tiki Với Python: Hướng Dẫn Chi Tiết
Tiki là sàn TMĐT thuần Việt, nổi tiếng với TikiNOW giao nhanh 2h. Đây là hướng dẫn scrape dữ liệu Tiki cho nghiên cứu thị trường.
Tại Sao Scrape Tiki?
- Phân tích giá cạnh tranh
- Theo dõi flash sales
- Nghiên cứu bestsellers
- Thu thập reviews sản phẩm
Ưu Điểm Của Tiki Cho Scraping
- API-friendly: Có internal API dễ access
- Ít anti-bot: Nhẹ hơn Shopee/Lazada
- Clean data: Structure rõ ràng
Phương Pháp 1: Tiki API
import requests
# Tiki search API
url = "https://tiki.vn/api/v2/products"
params = {
"q": "laptop",
"limit": 40,
"page": 1
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
}
response = requests.get(url, params=params, headers=headers)
data = response.json()
for product in data.get('data', []):
name = product.get('name')
price = product.get('price')
rating = product.get('rating_average')
print(f"{name}: {price:,}đ - Rating: {rating}")
Phương Pháp 2: BeautifulSoup
import requests
from bs4 import BeautifulSoup
url = "https://tiki.vn/search?q=laptop"
headers = {"User-Agent": "Mozilla/5.0..."}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
products = soup.select('.product-item')
for p in products:
title = p.select_one('.name').text.strip()
price = p.select_one('.price-discount__price').text
print(f"{title}: {price}")
Dữ Liệu Có Thể Thu Thập
- Tên sản phẩm, SKU
- Giá gốc, giá sale
- Rating trung bình
- Số lượng reviews
- Seller/Brand info
- TikiNOW availability
Tips Tối Ưu
- Delay 1-2s giữa requests
- Rotate User-Agent
- Handle pagination properly
- Cache results để tránh duplicate requests
VinaProxy + Tiki Scraping
- IP Việt Nam – access nhanh hơn
- Tránh IP ban khi scrape lớn
- Giá chỉ $0.5/GB
