Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 刮痧罐头';如果页码>;6._Python_Asp.net_Datagrid_Web Scraping_Scrapy - Fatal编程技术网

Python 刮痧罐头';如果页码>;6.

Python 刮痧罐头';如果页码>;6.,python,asp.net,datagrid,web-scraping,scrapy,Python,Asp.net,Datagrid,Web Scraping,Scrapy,从开始的url,你会发现有13页 但是使用下面的代码,我只能得到1-6页 起始URL=[“”] def解析(self,response): i=1; 虽然我做了一些调试:通过meta字典传递页面索引(i)-您的parse\u post方法被调用了13次-它可以工作。那有什么问题?是的,它总是叫13次。但问题是6次之后,页面都和第1页一样。 def parse(self, response): i = 1; while i <= 13: hxs = HtmlX

从开始的url,你会发现有13页 但是使用下面的代码,我只能得到1-6页

起始URL=[“”]

def解析(self,response):
i=1;

虽然我做了一些调试:通过
meta
字典传递页面索引(
i
)-您的
parse\u post
方法被调用了13次-它可以工作。那有什么问题?是的,它总是叫13次。但问题是6次之后,页面都和第1页一样。
def parse(self, response):
    i = 1;
    while i <= 13:
        hxs = HtmlXPathSelector(response)
        yield FormRequest.from_response(response,
                    formdata={'__EVENTTARGET':'_ctl0$Corps$DataGridPager1$Page_' + str(i),'__EVENTARGUMENT':''},
                    callback=self.parse_post,
                    dont_click=False)
        i = i + 1


def parse_post(self, response):
    hxs = HtmlXPathSelector(response)
    titles = hxs.select("//td[@width='400px']")
    for title in titles:
        link = title.select("a/@href").extract()[0]
        yield Request(urljoin('http://www.avocatsparis.org/Eannuaire/',link), callback=self.parse_details)