|
| 1 | +from itemadapter import ItemAdapter |
| 2 | +from zyte_common_items import ZyteItemAdapter |
| 3 | + |
| 4 | +ItemAdapter.ADAPTER_CLASSES.appendleft(ZyteItemAdapter) |
| 5 | + |
1 | 6 | # Scrapy settings for tutorial project |
2 | 7 | # |
3 | 8 | # For simplicity, this file contains only settings considered important or |
|
96 | 101 | FEED_EXPORT_ENCODING = "utf-8" |
97 | 102 |
|
98 | 103 | # Custom settings |
99 | | -DOWNLOAD_HANDLERS = { |
100 | | - "http": "scrapy_zyte_api.ScrapyZyteAPIDownloadHandler", |
101 | | - "https": "scrapy_zyte_api.ScrapyZyteAPIDownloadHandler", |
| 104 | +ADDONS = { |
| 105 | + "scrapy_zyte_api.Addon": 500, |
| 106 | + "zyte_spider_templates.Addon": 700, |
102 | 107 | } |
| 108 | +ZYTE_API_KEY = "YOUR_API_KEY" |
103 | 109 | DOWNLOADER_MIDDLEWARES = { |
104 | | - "scrapy_poet.InjectionMiddleware": 543, |
105 | | - "scrapy_zyte_api.ScrapyZyteAPIDownloaderMiddleware": 1000, |
| 110 | + "scrapy.downloadermiddlewares.stats.DownloaderStats": None, |
| 111 | + "scrapy_poet.DownloaderStatsMiddleware": 850, |
106 | 112 | } |
107 | | -REQUEST_FINGERPRINTER_CLASS = "scrapy_zyte_api.ScrapyZyteAPIRequestFingerprinter" |
108 | | -ZYTE_API_TRANSPARENT_MODE = True |
109 | 113 | SPIDER_MIDDLEWARES = { |
110 | | - "scrapy_zyte_api.ScrapyZyteAPISpiderMiddleware": 100, |
111 | 114 | "scrapy_poet.RetryMiddleware": 275, |
112 | | - "zyte_spider_templates.middlewares.CrawlingLogsMiddleware": 1000, |
113 | | -} |
114 | | -SCRAPY_POET_DISCOVER = [ |
115 | | - "zyte_spider_templates.page_objects", |
116 | | -] |
117 | | -SCRAPY_POET_PROVIDERS = { |
118 | | - "scrapy_zyte_api.providers.ZyteApiProvider": 1100, |
119 | 115 | } |
120 | | -CLOSESPIDER_TIMEOUT_NO_ITEM = 600 |
121 | | -SCHEDULER_DISK_QUEUE = "scrapy.squeues.PickleFifoDiskQueue" |
122 | | -SCHEDULER_MEMORY_QUEUE = "scrapy.squeues.FifoMemoryQueue" |
0 commit comments