我想下載幻想足球數(shù)據(jù)以在Go中進行分析,但是當我嘗試從此api頁面下載時,即使代碼適用于其他網(wǎng)站(例如此api頁面),我仍返回一個空響應最小復制,輸出一個空數(shù)組。package mainimport ( "fmt" "io/ioutil" "net/http" "time")const AllPlayerData = "https://fantasy.premierleague.com/drf/bootstrap-static"func main() { downloadAllData()}func downloadAllData() { client := &http.Client{ Timeout: 20 * time.Second, } response, err := client.Get(AllPlayerData) if err != nil { fmt.Println("Unable to download player data.") return } body, err := ioutil.ReadAll(response.Body) if err != nil { fmt.Println("Failed to read response") return } defer response.Body.Close() fmt.Println(body)}相同的網(wǎng)頁在Python中可以正常下載:import requestsurl = "https://fantasy.premierleague.com/drf/bootstrap-static"r = requests.get(url)print(r.content)我認為這與例如Ajax調(diào)用無關(guān),因為在Chrome瀏覽器中查看網(wǎng)絡請求不會超出頁面加載本身
- 1 回答
- 0 關(guān)注
- 282 瀏覽
添加回答
舉報
0/150
提交
取消