我正在尝试从http://lsgelection.kerala.gov.in/lbtrend2015/views/lnkResultsGrama.php抓取一些Ajax内容
在chrome网络标签中选择并提交了两个下拉列表
Request URL: http://lsgelection.kerala.gov.in/lbtrend2015/includes/detailed_results_grama_ajax.php
Request Method: POST
FormData
token: 9fd54c089d36035c3ce2b5cf08f38982
process: getGramaWonCandData
cno: 46
districtCode: D02001
Panchayat: G02069
由于cno
来自JS,我试图从刮擦的外壳中抓取数据以及飞溅信息
scrapy shell 'http://localhost:8050/render.html?url=http://lsgelection.kerala.gov.in/lbtrend2015/views/lnkResultsGrama.php'
token = response.xpath('//input[@id="token"]/@value').extract_first()
cno = response.xpath('//input[@id="cno"]/@value').extract_first()
然后我尝试使用
获取表单响应fetch(scrapy.FormRequest.from_response(response,url='http://lsgelection.kerala.gov.in/lbtrend2015/includes/detailed_results_grama_ajax.php',method='POST',formdata={'token':token,'process': 'getGramaWonCandData','cno':cno,'districtCode': 'D02001','Panchayat': 'G02069'},headers={'Content-Type': 'json/...'}))
当我尝试获取response.text
或response.body
时,它会返回b'\n\n\n\n\n\n\n'
我哪里出错了?