爬虫 post 请求 data 为 list 的情况求助
資深大佬 : d0v0b 3
目前情况,通过源 URL 得到 ajax,这个 ajax 在英文关键词情况下能请求到数据,但中文关键词情况无法返回值 初步判断是 encode 编码问题,但常用的几个都试了均不行,求助,感谢
源 URL: http://ggzyjy.abazhou.gov.cn/Jyweb/searchList.aspx?searchName=%E9%87%87%E8%B4%AD&Type=%E7%AB%99%E5%86%85%E6%90%9C%E7%B4%A2
Ajax: http://ggzyjy.abazhou.gov.cn/TrueLoreAjax/TrueLore.Web.WebUI.AjaxHelper,TrueLore.Web.WebUI.ashx
payload:[“TrueLore.Web.WebUI.WebAjaxService”,”SearchByCondition”,[0,15,”查询关键词”,””,200,670,190,410,3,””,””,”Fbqssj DESC”],None,None]’)
”’ #python
import requests import json url = "http://ggzyjy.abazhou.gov.cn/TrueLoreAjax/TrueLore.Web.WebUI.AjaxHelper,TrueLore.Web.WebUI.ashx" data = ["TrueLore.Web.WebUI.WebAjaxService","SearchByCondition",[0,15,"xe5x85xb3xe9x94xaexe8xafx8d","",200,670,190,410,3,"","","Fbqssj DESC"],None,None] headers = { 'Ajax-method': 'AjaxMethodFactory', # 这个很重要 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3738.0 Safari/537.36 Edg/75.0.107.0' } html = requests.post(url, headers=headers, data=json.dumps(data))
”’
大佬有話說 (3)