繁体   English   中英

Scrapy + Splash呈现JavaScript数据

[英]Scrapy + Splash Rendering a JavaScript data

我正在尝试使用scrapysplash抓取电子商务网站,因为页面上的大多数内容都是动态的,由JS呈现,所以我正在使用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

我如何获得该价格数据。

这是页面链接

最终解决了这个问题,我在带有飞溅的刮板外壳中运行了网页,然后当我执行view(response) ,发现价格部分未加载,然后我四处搜寻并找到了这个答案 ,基本上,我只是按照链接答案中的显示以私有模式运行启动。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM