0
quotes.py:
import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotes"
def start_requests(self):
start_urls = [
'http://www.successories.com/iquote/category/39/inspirational-quotes/4',
'http://www.successories.com/iquote/category/39/inspirational-quotes/6',
'http://www.successories.com/iquote/category/39/inspirational-quotes/7',
'http://www.successories.com/iquote/category/39/inspirational-quotes/8',
'http://www.successories.com/iquote/category/39/inspirational-quotes/9',
]
def parse(self,response):
items = []
for quote in response.css('div.quotebox'):
item = QuotesItem()
item['quoteAuthor'] = quote.css('div.quote a::text').extract_first()
item['quoteText'] = quote.css('div.quote a::text').extract_first()
items.append(item)
yield items
ここに私のアイテムコードが 私だ$ scrapyクロールが私のクモのコードです。ここ
を引用しますtems.py:
import scrapy
class QuotesItem(scrapy.Item):
quoteAuthor = scrapy.Field()
quoteText = scrapy.Field()
あなたはquotes.py'の名前空間 'に' 'import' QuotesItem'する必要があります。 –