Commit 3a02f7e1 authored by Renán Sosa Guillen's avatar Renán Sosa Guillen
Browse files

Nuevos sitios.

parent b8b49900
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+164 B

File added.

No diff preview for this file type.

+14 −0
Changes for laJornadaBC/laJornadaBC/items.py: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class LajornadabcItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    pass
+56 −0
Changes for laJornadaBC/laJornadaBC/middlewares.py: 56 added lines, 0 removed lines.
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-

# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html

from scrapy import signals


class LajornadabcSpiderMiddleware(object):
    # Not all methods need to be defined. If a method is not defined,
    # scrapy acts as if the spider middleware does not modify the
    # passed objects.

    @classmethod
    def from_crawler(cls, crawler):
        # This method is used by Scrapy to create your spiders.
        s = cls()
        crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
        return s

    def process_spider_input(response, spider):
        # Called for each response that goes through the spider
        # middleware and into the spider.

        # Should return None or raise an exception.
        return None

    def process_spider_output(response, result, spider):
        # Called with the results returned from the Spider, after
        # it has processed the response.

        # Must return an iterable of Request, dict or Item objects.
        for i in result:
            yield i

    def process_spider_exception(response, exception, spider):
        # Called when a spider or process_spider_input() method
        # (from other spider middleware) raises an exception.

        # Should return either None or an iterable of Response, dict
        # or Item objects.
        pass

    def process_start_requests(start_requests, spider):
        # Called with the start requests of the spider, and works
        # similarly to the process_spider_output() method, except
        # that it doesn’t have a response associated.

        # Must return only requests (not items).
        for r in start_requests:
            yield r

    def spider_opened(self, spider):
        spider.logger.info('Spider opened: %s' % spider.name)
+11 −0
Changes for laJornadaBC/laJornadaBC/pipelines.py: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html


class LajornadabcPipeline(object):
    def process_item(self, item, spider):
        return item
Loading