Posts

Showing posts with the label scrapy

Scrapy can't find form on page

Scrapy can't find form on page I'm trying to write a spider that will automatically log in to this website. However, when I try using scrapy.FormRequest.from_response in the shell I get the error: scrapy.FormRequest.from_response No <form> element found in <200 https://www.athletic.net/account/login/?ReturnUrl=%2Fdefault.aspx> No <form> element found in <200 https://www.athletic.net/account/login/?ReturnUrl=%2Fdefault.aspx> I can definitely see the form when I inspect element on the site, but it just did not show up in Scrapy when I tried finding it using response.xpath() either. Is it possible for the form content to be hidden from my spider somehow? If so, how do I fix it? response.xpath() 1 Answer 1 The form is created using Javascript, it's not part of the static HTML source code. Scrapy does not parse Javascript, thus it cannot be found. The relevant part o...

remove characters in xpath / scrapy

remove characters in xpath / scrapy I use scrapy to extract data and it generates the field (typeFacture) with (''), I want to extract the text and delete ('') to insert it into a database, I want to do that to help from XPATH HTML code: <td class="tNorm tSmall-xs"> <b>FACTURE</b> <br> '' Commission '' </td> my code: item['typeFacture'] = [item.strip() for item in sel.xpath('//tbody/tr/td[5]/text()').extract()] result: 'typeFacture': ['', '', 'Commission', '', '', 'Commission', '', '', 'Commission', '', '', 'Commission', '', '', 'Abonnement']} Don...

Why the Python Scrapy library class isn't executed

Why the Python Scrapy library class isn't executed I'm trying to use Scrapy on IBM cloud as a function. My __main__.py is as follows: __main__.py import scrapy from scrapy.crawler import CrawlerProcess class AutoscoutListSpider(scrapy.Spider): name = "vehicles list" def __init__(self, params, *args, **kwargs): super(AutoscoutListSpider, self).__init__(*args, **kwargs) make = params.get("make", None) model = params.get("model", None) mileage = params.get("mileage", None) init_url = "https://www.autoscout24.be/nl/resultaten?sort=standard&desc=0&ustate=N%2CU&size=20&page=1&cy=B&mmvmd0={0}&mmvmk0={1}&kmto={2}&atype=C&".format( model, make, mileage) self.start_urls = [init_url] def parse(self, response): # Get total result on list load init_total_results = int(response.css('.cl-filters-summary-counter::...