mercredi 1 décembre 2021

Scrapy python pagina web

I'm trying to extract the following data but it doesn't get me references.Can q be due to the page itself? I leave you the code:

import scrapy

scraped_inf=[]

class StackItem(scrapy.Item): producto = scrapy.Field() pass

class QuotesSpider(scrapy.Spider):

name = 'PAF - Apuestas'
allowed_domains = ['paf.es']
user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"
start_urls = ['https://www.paf.es/betting#/event/1018250220']

def parse(self, response):
    
    producto = response.xpath("//span[@class='KambiBC-modularized-scoreboard__participant-name']").get() 

    for item in producto:

        scraped_inf = {'Contenido' : item}
        yield scraped_inf



Aucun commentaire:

Enregistrer un commentaire