我正在尝试使用wget下载此网址:https://stats.nba.com/stats/scoreboard/?GameDate=02/14/2015&LeagueID=00&DayOffset=0
去年,它曾经使用简单的--user-agent标志进行工作:
wget --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9" http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2017-18&IsOnlyCurrentSeason=1
但是,它不再起作用了。我尝试从chrome复制请求标头:
wget http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2017-18&IsOnlyCurrentSeason=1 --header="Host: stats.nba.com" --header="Connection: keep-alive" --header="Cache-Control: max-age=0" --header="Upgrade-Insecure-Requests: 1" --header="User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103Safari/537.36" --header="DNT: 1" --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3" --header="Accept-Encoding: gzip, deflate, br" --header="Accept-Language: en-US,en;q=0.9,ko;q=0.8"
但是,这也不起作用。
我从服务器得到的是:
--2019-04-09 07:54:00-- http://stats.nba.com/stats/commonallplayers?LeagueID=00&Season=2017-18&IsOnlyCurrentSeason=1
Resolving stats.nba.com (stats.nba.com)... 184.24.168.119, 2600:1409:12:3b4::1f51, 2600:1409:12:3a9::1f51
Connecting to stats.nba.com (stats.nba.com)|184.24.168.119|:80... connected.
HTTP request sent, awaiting response...
请帮助!