作者stanleychao ()
看板Python
标题[问题] AJAX网路爬虫
时间Fri May 31 22:57:30 2019
之前都是用scrapy搭配selenium爬虫,不过遇到动态网页就会慢很多
最近爬文得知可以用AJAX方式去把所需要资料读出来,不过无法跟网路教学一样读出json格式
以下是我要资料流程
EX:
import requests
import json
url = '
https://fb.oddsportal.com/feed/match/1-6-E5R55yD8-3-1-yj4d1.dat'
response = requests.get(url)
response.text
问题就如下打response.text时会出现以下,而不是像chrome工具显示後面还有一大串json
"globals.jsonpCallback('/feed/match/1-6-E5R55yD8-3-1-yj4d1.dat', {'e':'404'});"
请问这是为什麽呢?
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 101.13.83.176
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1559314658.A.6F5.html
1F:推 q79236: 试试看把header设定的跟google chrome一样看看 06/01 01:19
2F:推 a11780922: header 要给参数 06/01 20:03
3F:推 utdsml: scrapy可以用splash处理AJAX 06/11 11:58