写个爬虫,需要翻页处理,每一分页有多条,因为页数比较多,希望能够先爬完一页的所有数据,再进入下一页。
现在的代码如下,加了priority 也不是严格的先后执行的。
@config(age=10 * 60 * 60)
def index_page(self, response):
for each in response.doc('#J-wonderNotesWrap .notes-content h4 a').items():
self.crawl(each.attr.href,fetch_type="js", callback=self.detail_page,priority=1)
next=response.doc('.tangram-pager-next').attr.href
self.crawl(next,fetch_type="js", callback=self.index_page)
而且这个爬虫如果前没有先后顺序,再加顺序,是否能够直接改过来。
已经在队列中的任务, 不能修改优先级.