【发布时间】:2018-02-12 00:49:19
【问题描述】:
真的需要这个社区的帮助。
我的问题是,当我在 python 中使用代码时
response.xpath("//div[contains(@class,'check-prices-widget-not-sponsored')]/a/div[contains(@class,'check-prices-widget-not-sponsored-link')]").extract()
在scrapy shell中提取供应商名称,输出为空。我真的不知道为什么会这样,在我看来问题可能是网站信息正在动态更新?
这个网页抓取的网址是:https://cruiseline.com/cruise/7-night-bahamas-florida-new-york-roundtrip-32860,我需要的是每个供应商的供应商名称和价格。除了附图是“检查”的截图。 enter image description here
但是,类似的代码可以提取以下页面网址中的价格('https://cruiseline.com/destination/caribbean/cruise/best?sort=rank,ship_status&&direction=desc&page=1&per_page=10&sailing_counts=0')
Prices = response.xpath(
"//div[contains(@class,'featured-cruise-price-inner-price')]/span/descendant::text()").extract()
非常感谢您的帮助!
【问题讨论】:
标签: python xpath web-scraping scrapy