这是我的代码,我的蜘蛛没有关注我有 InitSpider 的子类的链接
class TestSpider(InitSpider):
name = 'login'
allowed_domains = ['example.com']
start_urls = ['http://www.example.com']
rules = (Rule(SgmlLinkExtractor(allow=('example\.com', 'PostSearch'),restrict_xpaths = "//dd[@class='nextPage']"), callback='parse_items', follow=True),)
def parse_items(self, response):
hxs = HtmlXPathSelector(response)
- 我正在使用这个例子https://stackoverflow.com/a/5857202/1894766 *