-
-
Save admariner/caf3268e4a6bf78e69b11e4425c1bca7 to your computer and use it in GitHub Desktop.
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
# Scrape Shopify themes using scrapy.org | |
#!pip install scrapy | |
#%%writefile shopify_theme_spider.py | |
import scrapy | |
class ShopifyThemeSpider(scrapy.Spider): | |
name = 'bshopifyspider' | |
start_urls = ['https://themes.shopify.com/themes?page=1'] | |
def parse(self, response): | |
for theme in response.css('.theme-info'): # Div | |
yield {"link": theme.css("a::attr(href)").get(), # A href | |
'theme': theme.css('a span ::text').get()} #Span text | |
for next_page in response.css('a.next_page'): | |
yield response.follow(next_page, self.parse) | |
# Run using: !scrapy runspider shopify_theme_spider.py -o themes.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment