Created
September 4, 2019 06:53
-
-
Save jancurn/40d04eeff567db2f637bd6b74bd1bed4 to your computer and use it in GitHub Desktop.
Scrapy Executor code example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scrapy | |
import apify | |
class MySpider(scrapy.Spider): | |
name = 'apifySpider' | |
def start_requests(self): | |
urls = [ | |
'https://apify.com', | |
'https://apify.com/store', | |
] | |
for url in urls: | |
yield scrapy.Request(url=url, callback=self.parse) | |
def parse(self, response): | |
url = response.url | |
title = response.css('title::text').get() | |
output = { | |
'url': url, | |
'title': title | |
} | |
apify.pushData(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment