Python 转到下一页时,请求不起作用

Python 转到下一页时,请求不起作用,python,web-crawler,scrapy,Python,Web Crawler,Scrapy,我想抓取连续的页面,所以如果当前页面有下一个页面,我使用scrapy生成新请求,但我发现它没有调用请求函数。以下是我的代码和结果: 下一页url: 2015-05-06 10:00:47+0800[蜘蛛侠22]信息:关闭蜘蛛侠完成 除了将字符串http很好地连接到http,并正确设置spider(不仅仅是方法)之外,它看起来还可以工作。也许你应该把你的蜘蛛代码都写下来。 def parse(self, response): ... #2.get the next page url

我想抓取连续的页面,所以如果当前页面有下一个页面,我使用scrapy生成新请求,但我发现它没有调用请求函数。以下是我的代码和结果:

下一页url:

2015-05-06 10:00:47+0800[蜘蛛侠22]信息:关闭蜘蛛侠完成


除了将字符串http很好地连接到http,并正确设置spider(不仅仅是方法)之外,它看起来还可以工作。也许你应该把你的蜘蛛代码都写下来。
def parse(self, response):
    ...
    #2.get the next page url and trigger another request and par
    if "page" not in response.url:
        nextpage_url = 'ht tp://www.wowsai.com/'+sel.xpath('//div[@id="pageBox"]/a[1]/@href').extract()[0]
    else:
        nextpage_url = 'htt p://www.wowsai.com/'+sel.xpath('//div[@id="pageBox"]/a[2]/@href').extract()[0]
    print "next page url:", nextpage_url
    yield Request(nextpage_url, callback=self.parsePage)


def parsePage(self, response):
    print response.url
    print "here is parsePage"