나는 필터가있는 웹 사이트의 데이터를 가져 오려고합니다. 웹 사이트는 다음 중 하나입니다 : https://www.lequipe.fr/Basket/RES_NBA.html치료와 함께 웹 사이트에서 필터를 관리하는 방법
나는 필요한 모든 정보를 수집하는 단순한 거미를 가지고 있지만 표시되는 날짜에만 있습니다.
필터에서 사용할 수있는 모든 날짜의 데이터를 수집하려면 필터를 반복해야합니다.
누군가가 도와 주시면 감사하겠습니다.
내 거미는 다음과 같이이다 :
그래서# -*- coding: utf-8 -*-
import scrapy
class LequipeBotSpider(scrapy.Spider):
name = 'Lequipe_bot'
allowed_domains = ['www.lequipe.fr/Basket/RES_NBA.html']
start_urls = ['http://www.lequipe.fr/Basket/RES_NBA.html']
#location of csv file
custom_settings = {
'FEED_FORMAT' : "csv",
'FEED_URI' : 'tmp/lequipe2.csv'
}
def parse(self, response):
#Extracting the content using css selectors
#recap = response.css(".equipeDom a::text,div.score span.score--chiffre::text,.equipeExt a::text").extract()
recap=response.css(".equipeDom a::text,div.score span.score--chiffre::text,.equipeExt a::text,div.equipeDom span.nba--ranking::text,div.equipeExt span.nba--ranking::text").extract()
#Give the extracted content row wise
for x in range(0,(len(recap))/6):
#create a dictionary to store the scraped info
scraped_info = {
'equipe_dom' : recap[1+6*x],
'score_dom' : recap[2+6*x],
'score_ext' : recap[3+6*x],
'equipe_ext' : recap[4+6*x],
'classement_dom' : recap[0+6*x],
'classement_ext' : recap[5+6*x],
}
#yield or give the scraped info to scrapy
yield scraped_info
, 내가 어떻게
감사합니다 사전에 @furas의 솔루션으로 모든 페이지의 스크 레이 핑을 반복 할 수
당신은 클래스 = filtrecalendrier''의 모든 날짜가 모든 날짜는 세부 사항 페이지에 대한 링크가 있습니다. 문제가 어디에 있습니까? – furas