久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我缺少哪些標題來抓取 NBA 統計數據?

What headers am I missing to scrape the NBA Stats data?(我缺少哪些標題來抓取 NBA 統計數據?)
本文介紹了我缺少哪些標題來抓取 NBA 統計數據?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

幾天前,我在 Power BI 中創建了一個 Web 查詢,允許我從 NBA 球員統計數據 不使用任何標題.截至今天,我注意到該查詢不再有效;我收到以下錯誤消息:

A couple of days ago in Power BI, I was able to create a web query that allowed me to extract the JSON data from NBA Player Stats without using any headers. As of today, I have noticed that the query no longer works; I am getting the following error message:

DataSource.Error: The underlying connection was closed. An unexpected error occurred on a receive.
Details: https://stats.nba.com/stats/leaguedashplayerstats?College=&Conference=&Country=&DateFrom=&DateTo=&Division=&DraftPick=&DraftYear=&GameScope=&GameSegment=&Height=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2019-20&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&TwoWay=0&VsConference=&VsDivision=&Weight=

在相關說明中,我曾經能夠從 NBA Team Stats 使用 https://stats.nba.com/ 作為 Referer 標題,但現在它給了我同樣的錯誤消息如上圖.為了嘗試解決這些錯誤,我嘗試輸入以下標題:

On a related note, I used to be able to pull the JSON data from NBA Team Stats using https://stats.nba.com/ as a Referer header, but now it's giving me the same error message as shown above. To try and get around these errors, I have tried entering the following headers:

Host: stats.nba.com
Connection: keep-alive
Accept: application/json
x-nba-stats-token: true
User-Agent: Chrome/79.0.3945.130
x-nba-stats-origin: stats
Referer: https://stats.nba.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

當我使用上述標題提交查詢時,它會返回以下錯誤消息:

When I do submit the query with the above headers, it comes back with the following error message:

Unable to connect

We encountered an error while trying to connect.

Details: "The 'Host' header must be modified using the appropriate property or method.
Parameter name: name"

對于如何正確運行查詢,我已經沒有想法了.我對網絡抓取和 HTML 真的很陌生——我一直在努力自學.非常感謝任何幫助.

I have run out of ideas as to how I'm able to properly run the query. I'm really new to web-scraping and HTML -- I've been trying to teach myself. Any help is greatly appreciated.

推薦答案

GET 請求的所有標頭:

All headers for GET request:

Host: stats.nba.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, */*
x-nba-stats-token: true
X-NewRelic-ID: VQECWF5UChAHUlNTBwgBVw==
DNT: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
x-nba-stats-origin: stats
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://stats.nba.com/teams/traditional/?sort=TEAM_NAME&dir=-1
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US;q=0.9,en;q=0.7

網址:

https://stats.nba.com/stats/leaguedashteamstats?Conference=&DateFrom=&DateTo=&Division=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2019-20&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&TwoWay=0&VsConference=&VsDivision=

必填標題:

Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
x-nba-stats-origin: stats
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://stats.nba.com/teams/traditional/?sort=TEAM_NAME&dir=-1

不確定是否需要:

x-nba-stats-token: true
X-NewRelic-ID: VQECWF5UChAHUlNTBwgBVw==

可能的問題:

  1. 您檢測為機器人并被阻止

  1. You detected as a bot and blocked

Header X-NewRelic-ID 是一個令牌(可能有超時).可能它是使用不同的參數分配的,例如 IP、User-Agent 等等.
您可以通過對 https://stats.nba.com/ 的 GET 請求在 HTML 響應中獲取新的 X-NewRelic-ID.這是帶有 xpid 標記的 HTML 的一部分:<script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VQECWF5UChAHUlNTBwgBVw==",licenseKey:"09f0cb5c68",applicationID:"76210961"};

Header X-NewRelic-ID is a token (maybe with timeout). Probably it's assign using different params like IP, User-Agent and among others.
You can get fresh X-NewRelic-ID in HTML response with GET request to https://stats.nba.com/. Here is a part from HTML with xpid token: <script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VQECWF5UChAHUlNTBwgBVw==",licenseKey:"09f0cb5c68",applicationID:"76210961"};

這篇關于我缺少哪些標題來抓取 NBA 統計數據?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Save JSON file to grab other data from it later(保存 JSON 文件以便稍后從中獲取其他數據)
How can I duplicate a div onclick event?(如何復制 div onclick 事件?)
How to add a role with an ID that is saved in an JSON file discord.js v12?(如何添加 ID 保存在 JSON 文件 discord.js v12 中的角色?)
Adding a role (autorole) on join from a json file(在從 json 文件加入時添加角色(自動角色))
opening html from google drive(從谷歌驅動器打開 html)
How to embed videos from Google drive to webpage?(如何將視頻從 Google 驅動器嵌入到網頁?)
主站蜘蛛池模板: 国产精品久久久久久久久久久久 | 97精品国产 | 欧美日韩亚洲视频 | 日本黄色高清视频 | 日韩高清av | 极情综合网 | 久久久久久久一区 | 91在线导航| 激情自拍偷拍 | 福利电影在线 | 97超碰在线播放 | 久久成人精品 | 91黄色片免费看 | 国产欧美精品区一区二区三区 | 日韩高清中文字幕 | 久草在线在线精品观看 | 欧美日韩久久久 | 韩日免费视频 | 精品电影| 欧美久久不卡 | 日韩一区二区三区视频在线播放 | 天天夜碰日日摸日日澡 | 一区二区在线不卡 | 91视视频在线观看入口直接观看 | av中文在线 | 天天草天天射 | 欧美vide| 欧洲精品一区 | 高清av一区| 日本精品在线一区 | 中文字幕av中文字幕 | 成人三级av | 成人性视频免费网站 | 国产特级毛片aaaaaa喷潮 | 亚洲一区二区三区四区五区中文 | 五月婷婷色 | 久久久不卡网国产精品一区 | 国产一区二区三区日韩 | 国产亚洲黄色片 | 天堂一区二区三区 | 国产日韩欧美精品一区二区三区 |