3 回答

TA貢獻1900條經驗 獲得超5個贊
嘗試添加有效的 User-Agent 和其他標頭,使其看起來像是通過瀏覽器訪問。
像這樣的東西:
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3835.0 Safari/537.36',
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Host':'www.dndbeyond.com',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Upgrade-Insecure-Requests': '1',
'Connection': 'close'
}
response = requests.get(url, headers=headers)

TA貢獻2051條經驗 獲得超10個贊
要訪問 json,您需要刪除路徑組件“字符”上的復數。
至于數據格式,我幾乎完成了對整個結構的充實。
Objective-C 源代碼包括所有類定義。
https://github.com/mouser/BeyondDnD

TA貢獻1772條經驗 獲得超6個贊
添加回答
舉報