これは私のコードです。スパイダーは、それらを抽出しないか、そういうものを抽出しません。もし私が "start urls"でurlを検索したら、scrapyはアイテムを見つけますが、前方にはクロールしません。そして、 "url"を始めるとターゲットリストを含むurlを返します。 :)私は、テキストはあなたがallowed_domains
でhttp://
を削除する必要がScrapyは1ページのみクロールします
from scrapy.spiders import Spider
from testing.items import TestingItem
import scrapy
class MySpider(scrapy.Spider):
name = 'testing'
allowed_domains = ['http://somewebsite.com']
start_urls = ['http://somewebsite.com/listings.php']
def parse(self, response):
for href in response.xpath('//h5/a/@href'):
full_url = response.urljoin(href.extract())
yield scrapy.Request(full_url, callback=self.parse_item)
def parse_item(self, response):
titles = response.xpath('//*[@class="panel-content user-info"]').extract()
for title in titles:
item = TestingItem()
item["nimi"] = response.xpath('//*[@class="seller-info"]/h3/text()').extract()
yield item
allowed_domains –
ニースtanx mate :)の「http://」を削除してください。次のページに改ページするために必要なものが分かっていますか? :) –