最近他們升級了風控,感覺還是蠻難的。
url = f"https://shopee.tw/api/v4/pdp/get_pc?shop_id={shop_id}&item_id={item_id}&detail_level=0"
web = {
'sz-token': '',
'site': "shopee.tw",
'top': "tw",
}
token = {
'VLj': (hashlib.md5(str(time.time()).encode()).hexdigest() + hashlib.md5( str( random.randint(1,99999999999999999)).encode()).hexdigest())[:40],
'VLi':(hashlib.md5(str(time.time()).encode()).hexdigest() + hashlib.md5( str( random.randint(1,99999999999999999)).encode()).hexdigest())[:40]
}
sign = code.call('get_all_params', f"/api/v4/pdp/get_pc?shop_id={shop_id}&item_id={item_id}&detail_level=0", json.dumps(web), token)
cookies = {
"_sapid": sign["_sapid"],
}
這是嘗試的逆向他們的js的代碼。 但是沒有好的ip代理商,大家這塊有可以分享的好的台灣的ip代理供應商嗎?
GitHub 社群中有開源的 Shopee 爬蟲專案,可以參考這些專案的實現方式,或在其基礎上進行修改。
8-1. 「蝦皮爬蟲」最詳細手把手教學|商品資料+留言評論一次滿足-【行銷搬進大程式】