Skip to content

Instantly share code, notes, and snippets.

@rsarai
Created September 2, 2017 16:05
Show Gist options
  • Save rsarai/d51fa5d9193fa63fcbf971e9d1a94781 to your computer and use it in GitHub Desktop.
Save rsarai/d51fa5d9193fa63fcbf971e9d1a94781 to your computer and use it in GitHub Desktop.
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