hatte ich diesen Code, um zu versuchenPython-Shell nicht Raupenlauf
import scrapy
from scrapy.cmdline import execute
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from metacritic.items import MetacriticItem
class MetacriticSpider(scrapy.spider):
name = "metacritic" # Name of the spider, to be used when crawling
allowed_domains = ["metacritic.com"] # Where the spider is allowed to go
start_urls = [
"http://www.metacritic.com/browse/games/title/pc?page=0"
]
def parse(self, response):
hxs = HtmlXPathSelector(response) # The XPath selector
sites = hxs.select('//li[contains(@class, "product game_product")]/div[@class="product_wrap"]')
items = []
for site in sites:
item = MetacriticItem()
item['title'] = site.select('div[@class="basic_stat product_title"]/a/text()').extract()
item['link'] = site.select('div[@class="basic_stat product_title"]/a/@href').extract()
item['cscore'] = site.select('div[@class="basic_stat product_score brief_metascore"]/div/div/span[contains(@class, "data metascore score")]/text()').extract()
item['uscore'] = site.select('div[@class="more_stats condensed_stats"]/ul/li/span[contains(@class, "data textscore textscore")]/text()').extract()
item['date'] = site.select('div[@class="more_stats condensed_stats"]/ul/li/span[@class="data"]/text()').extract()
items.append(item)
return items
i schon irgendwie versuchen, diesen Code zu beheben, aber ich bekomme immer einen Fehler /home/Kautsar/Metacritic 2/Metacritic/Spinnen/metacritic_spider.py:3: ScrapyDeprecationWarning: Modul scrapy.spider
ist veraltet, verwenden Sie stattdessen scrapy.spiders
von scrapy.spider Import BaseSpider Traceback (jüngste Aufforderung zuletzt): Datei „/ home/Kautsar/Metacritic 2/Metacritic/Spinnen/metacritic_spider.py ", Zeile 6, in Klasse MetacriticSpider (scrapy.spider): TypeErro r: Fehler beim Aufruf der Metaklassengrundlagen Modul. init() dauert höchstens 2 Argumente (3 gegeben) jemand weiß, wie das zu beheben?