-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JWT爬蟲問題 #11
Comments
同學您好, 因為我無法找到你的畫面,我猜測有幾個重點
以上是我大概的了解,這邊,有之前我在明新科大上的 |
F12畫面很多東西,我比較無法猜出你要抓的是什麼。提供完整程式碼,謝謝。 |
import requests
headers = {
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0 (Edition GX-CN)",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7",
"Cache-Control": "no-cache",
"Pragma": "no-cache",
"Sec-Ch-Ua": "\"Opera GX\";v=\"105\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"",
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": "\"macOS\"",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1"
}
coin = {}
for i in range(15):
url = f"https://live.shopee.tw/api/v1/lptab/item?tab_id=592037738960896&tab_type=1&device_id=6d910b16-b590-40bb-9157-5517f2923aa3&ctx_id=6d910b16-b590-40bb-9157-5517f2923aa3-1706454481206-697317&page_no={i+1}&offset=0&limit=50"
response = requests.get(url, headers=headers).json()
for x in range(6):
try:
coin[response["data"]["list"][x]["item_id"]] = response["data"]["list"][x]["item"]["coins_per_claim"]
except:
pass
sorted_items = sorted(coin.items(), key=lambda item: (-item[1], -item[0]))
sorted_dict = dict(sorted_items)
first_key = next(iter(sorted_dict.keys()))
print(first_key) |
麻煩格式化程式碼謝謝,用markdown語法。 |
送出前按一下「Preview」檢查是否有格式化,markdown語法用三個`符號如下 |
修了 |
同學您好, 蝦皮爬蟲我沒試過,一般網站會擋爬蟲,限制可能較多,但有幾個方向可以試試
同學請參考這個教學試試,要一個一個找。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://live.shopee.tw/share
這個網站改版後無法透過get直接取得我要的資料
直接get會顯示以下的圖(圖二)
想知道如何能透過python或是爬蟲取得這個json
The text was updated successfully, but these errors were encountered: