Oct-12-2018, 09:25 AM
Hello guyes....i was messing with my script to login in this website but seems doesnt work....i'll like to login first to loggin_url and then request the rest urls to get data
# -*- coding: utf-8 -*-
import scrapy
class StrongbotSpider(scrapy.Spider):
name = 'StrongBot'
login_url = 'https://www.strongflex.eu/en/login?back=my-account'
start_urls = ['https://www.strongflex.eu/en/a3-96-03-8l-fwd/298-221077b-front-wishbone-rear-bush-5902553512151.html?search_query=221077&results=5']
def parse(self, response):
data = {
'email': '[email protected]',
'passwd': 'example',
}
yield scrapy.FormRequest(url=self.login_url, formdata=data, callback=self.after_login)
def after_login(self, response):
for item in response.css('div.pb-right-column.col-xs-12.col-sm-4.col-md-3'):
yield {
'Price' : item.css('#our_price_display::text').extract()
}
