Can someone help me with using scrapy to login to StockX.com? I am trying to build a web scraper to scrape price information off of stockx but I am unfamiliar with the type of authentication that Stockx requires to login. I have watched tutorials on using csrf tokens but do not see any tokens submitted in the form data when I login, so I am at a loss at how to authenticate logins using scrapy on StockX. Any help would be much appreciated.
Current code:
class StockXSpider(scrapy.Spider):
name = 'sx'
# page_number = 2
start_urls = [
'https://www.stockx.com/login?
iss=https%3A%2F%2Faccounts.stockx.com%2F'
]
def parse(self, response):
return scrapy.FormRequest.from_response(response,
formdata={"username": "Gabiospi321@gmail.com", "password": "LitMari757"},
callback=self.scrape)
def scrape(self, response):
items = SxscrapyItem()
all_div_blanks = response.css('div.product-header-media')
for blanks in all_div_blanks:
product_name = response.css('div.col-md-12').xpath('//h1/text()').extract()
lowest_ask = response.css('div.en-us.stat-value.stat-small::text')[0].extract()
highest_bid = response.css('div.en-us.stat-value.stat-small::text')[1].extract()
items['product_name'] = product_name
items['lowest_ask'] = lowest_ask
items['highest_bid'] = highest_bid
yield items