ウェブページからデータをスクラップしようとしています。ウェブページは単に2500のURLの箇条書きのリストです。 Scrapyは今問題がある Scrapy:ValueError( 'リクエストURLのスキームがありません:%s'%self._url)
は、ここに私のコードclass MySpider(CrawlSpider):
name = 'dknews'
start_urls = ['http://www.example.org/uat-area/scrapy/all-news-listing']
allowed_domains = ['example.org']
def parse(self, response):
hxs = Selector(response)
soup = BeautifulSoup(response.body, 'lxml')
nf = NewsFields()
ptype = soup.find_all(attrs={"name":"dkpagetype"})
ptitle = soup.find_all(attrs={"name":"dkpagetitle"})
pturl = soup.find_all(attrs={"name":"dkpageurl"})
ptdate = soup.find_all(attrs={"name":"dkpagedate"})
ptdesc = soup.find_all(attrs={"name":"dkpagedescription"})
for node in soup.find_all("div", class_="module_content-panel-sidebar-content"):
ptbody = ''.join(node.find_all(text=True))
ptbody = ' '.join(ptbody.split())
nf['pagetype'] = ptype[0]['content'].encode('ascii', 'ignore')
nf['pagetitle'] = ptitle[0]['content'].encode('ascii', 'ignore')
nf['pageurl'] = pturl[0]['content'].encode('ascii', 'ignore')
nf['pagedate'] = ptdate[0]['content'].encode('ascii', 'ignore')
nf['pagedescription'] = ptdesc[0]['content'].encode('ascii', 'ignore')
nf['bodytext'] = ptbody.encode('ascii', 'ignore')
yield nf
for url in hxs.xpath('//ul[@class="scrapy"]/li/a/@href').extract():
yield Request(url, callback=self.parse)
です...フェッチし、それぞれ、すべてのURLに行くといくつかのデータをフェッチしている2500件の記事のうち215の周りに上記のコード命拾い。これは、( '要求URLに欠落スキーム:%s' は%self._url)...このエラーを与えることによって
とValueErrorを閉じ
私は、このエラーの原因を見当がつかない... 。
ご協力いただきありがとうございます。
おかげ以下