Created
September 2, 2017 16:05
-
-
Save rsarai/d51fa5d9193fa63fcbf971e9d1a94781 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from scrapymercado.items import ProductsItem | |
from scrapymercado.constants import URL | |
class ProductImgSpider(scrapy.Spider): | |
name = "productsimg" | |
def start_requests(self): | |
max_page_number = 67 | |
base_url = 'http://supersecretsite.com' | |
yield scrapy.Request(url=base_url, callback=self.parse) | |
for idx in range(2, max_page_number + 1): | |
url = base_url + '?page=' + str(idx) | |
yield scrapy.Request(url=url, callback=self.parse) | |
def parse(self, response): | |
urls = URL | |
item = ProductsItem() | |
item['image_urls'] = urls | |
return item |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment