Python 爬虫 怎样获取javascript返回的响应内容

import urllib.requestimport urllib.parsedef getdata(page, type1, type2): header={}#设置头 url = r\u0026#39;http://www.licai.com/simu/paihang/paihang1.aspx/Binddata\u0026#39; params = urllib.parse.urlencode({\u0026#39;page\u0026#39;: page , \u0026#39;type1\u0026#39;: type1, \u0026#39;type2\u0026#39;:type2}) request = urllib.request.Request(url=url, data=https://www.zhihu.com/api/v4/questions/27915506/params.encode("utf-8"), headers=header,unverifiable=True,origin_req_host=r"http://www.licai.com",method="POST") response = urllib.request.urlopen(request) return(response.read())getdata(2, \u0026#39;1\u0026#39;, \u0026#39;2\u0026#39;)如果返回是json,再import json解析一下就ok 。原理是找到他的js文件里这个函数,python写一下。会返回500错误,估计是访问限制。需要设置一下头。
■网友
这个要自己写解析引擎目前只有google自己能 做到识别js
■网友
抓个包看一下请求撒,js最终也还是去请求某个服务获取数据的
■网友
看样子需要模拟一下浏览器做的事。用这个:Seleniumhttp://www.seleniumhq.org


    推荐阅读