【发布时间】:2015-05-09 12:56:05
【问题描述】:
我有一个网站,我想从那里刮取优惠券代码。我在这里有两个问题。我在这里使用 python 和美丽的汤。 1)span标签中显示的某些优惠券没有class或id,因此无法从这些标签中获取优惠券。我需要从强标签(AXISCB50)中获取
<h6><span style="color: #808000">25% Cashback on Recharges :</span></h6>
<ul>
<li>Get 25% Cashback upto Rs.25 per transaction.</li>
<li>Coupon Code : <span style="color: #ff0000"><strong>AXISCB50</strong></span></li>
<li>Maximum 2 transaction per Debit/Credit card.</li>
</ul>
是否可以通过指定 style="color: #808000 类似 this(style) 来进行抓取。
2)有些优惠券是通过ajax显示的,只有当我们点击按钮时才会显示。我将如何刮_这些通过脚本显示的数据?
我第一次进入网络抓取。任何帮助表示赞赏并提前感谢。
【问题讨论】:
标签: python html python-2.7 beautifulsoup html-parsing