【发布时间】:2017-11-20 07:23:19
【问题描述】:
我正在尝试使用 scrapy 和 splash 来废弃电子商务网站,因为页面上的大部分内容都是由 JS 呈现的动态内容strong>,我正在使用 splash 来获取数据。我能够获取除价格数据之外的所有其他数据。
<div class="grid-row rendered">
<span data-id="from-price" data-bind="visible: showFromLabel, text: fromLabelText, css: { 'price-from-discounted' : isDiscountedPrice }" class="price-from" style="display: none;">From</span>
<span data-id="current-price" data-bind="text: priceText(), css: {'product-price-discounted' : isDiscountedPrice }" class="current-price">$31.58</span>
<span data-id="rrp-price" data-bind="text: rrpPriceText, visible: showRrpPrice" class="product-prev-price" style="display: none;"></span>
<span data-id="previous-price" data-bind="text: prevPriceText, visible: showPrevPrice" class="product-prev-price" style="display: none;"></span>
<span data-id="german-vat-message" data-bind="text: germanVatMessage, visible: showGermanVatMessage" class="product-german-vat" style="display: none;"></span>
</div>
我想获取第二个跨度数据,但是当我print(response.body) 时,渲染的div.grid-row 没有渲染。
我怎样才能得到那个价格数据。
这是page的链接
【问题讨论】:
标签: javascript python-3.x web-scraping scrapy-spider scrapy-splash