Web scraping 刮皮不';无法从页面抓取所有数据
我有蜘蛛,但它不工作。Web scraping 刮皮不';无法从页面抓取所有数据,web-scraping,scrapy,python-3.4,scrapy-spider,Web Scraping,Scrapy,Python 3.4,Scrapy Spider,我有蜘蛛,但它不工作。 我的蜘蛛只从一些链接中抓取信息。 ,但是。 我尝试用不同的方法进行报废,但结果还是一样。 我的错在哪里?以下是我目前的代码: 更新:要解决问题集下载延迟=3 import scrapy from NotebookDB.items import NotebookDB class NotebookDBSpider(scrapy.Spider): name = "notebookDB" allowed_domains = ["price.ua"] st
我的蜘蛛只从一些链接中抓取信息。 ,但是。
我尝试用不同的方法进行报废,但结果还是一样。
我的错在哪里?以下是我目前的代码: 更新:要解决问题集下载延迟=3
import scrapy
from NotebookDB.items import NotebookDB
class NotebookDBSpider(scrapy.Spider):
name = "notebookDB"
allowed_domains = ["price.ua"]
start_urls = [
"http://price.ua/catc839t14.html",
]
def parse(self, response):
sites = response.xpath('//*[@id="list-grid"]//div[@class="info-wrap"]/a/@href').extract()
for site in sites:
yield scrapy.Request(site, callback=self.parse_notebook, dont_filter=True)
def parse_notebook(sels, response):
item = NotebookDB()
item['url'] = response.url
item['brand'] = response.xpath('//div[@id="page-title"]/h1//span[@itemprop="brand"]/text()').extract()
item['title'] = response.xpath('//div[@id="page-title"]/h1/span[1]/span[2]/text()').extract()#response.xpath('//div[@id="page-title"]/h1//span[@itemprop="model"]/text()').extract()
item['image'] = response.xpath('//a[@id="model-big-photo"]//@href').extract()
item['price'] = str(response.xpath('//div[@class="price-diapazon"]/span/text()').extract_first()).replace("\u00a0","")
item['properties'] = response.xpath('//div[@class="relative-wrap"]/text()').extract()[2:-2]
yield item
python脚本调用的浏览器引擎与打开的浏览器不同 您可能需要提供: 1) 饼干 2) 通过机器人测试(如果您不在乌克兰) 3) 其他一些信息(如果他们要求您登录)
您可以尝试硒,您将了解其中的差异。谢谢您的回答。