#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2018-12-05 09:39:49
# Project: imdb_tutorial
from pyspider.libs.base_handler import *
import re
class Handler(BaseHandler):
crawl_config = {
}
@every(minutes=24 * 60)
def on_start(self):
@config(age=10 * 24 * 60 * 60)
def index_page(self, response):
for each in response.doc('a[href^="http"]').items():
self.crawl(each.attr.href, callback=self.detail_page)
self.crawl(response.doc('.next-page').attr.href, callback=self.index_page)
self.crawl(response.doc('.prev-page').attr.href, callback=self.index_page)
@config(priority=2)
def detail_page(self, response):
return {
"url": response.url,
"title": response.doc('.lister-item-header a').text(),
"date" : response.doc('.text-muted').text(),
}
So right now I am able to see the next-page and pre-page and index page but not able to extract that information