angularjs - How to scrape text from span with ng-if attribute using python? -


i trying scrape data paytm web page using python beautifulsoup https://paytm.com/shop/p/masha-mauve-satin-nighty-wnighw000nt14_45bbppfr?src=search-grid&tracker=autosuggest%7cundefined%7cmasha%20nighty%7cgrid%7csearch%7c1. able scrap fields using direct class names fields using angularjs attributes , don't have idea how that.

i know how scrape data of span defined class:-

mrp = link_soup.find_all("span" , class_="price")[0].string.strip() 

but don't know how same mentioned code.

code want scrape data:-

 <span ng-if="!product.product.isonlycarcategory">buy rs 329</span> 

i want scrape number 329 span.

whole code:-

<div itemprop="offers" itemscope="itemscope" itemtype="https://schema.org/offer" class="buy-bar">               <button class="md-raised fl md-button md-default-theme" ng-transclude="" type="button" ng-show="!product.product.notsellable &amp;&amp; !product.product.preorder" ng-click="product.buyproduct();_gaq.push(['_addtrans','3523347','bboy body wears', '329','', '0', '', '', 'india'])" ng-class="{'dealbtn' : product.product.vertical_id == 5 ,'cartupdating' : product.iscartupdating }" ng-disabled="product.iscartupdating || !product.product.instock" tabindex="0" aria-hidden="false" aria-disabled="false"><span ng-show="!product.product.add_qty_using_price &amp;&amp; product.product.vertical_id !=5" aria-hidden="false">  <span ng-if="!product.product.isonlycarcategory">buy rs 329</span>                   <meta itemprop="price" content="">                   <div> <span ng-show="product.product.actual_price != product.product.offer_price" class="strike" aria-hidden="false">rs. 749</span><span ng-show="product.product.actual_price != product.product.offer_price" aria-hidden="false" class=""> | 56%  discount</span></div>                   <meta itemprop="pricecurrency" content="inr"></span><span ng-show="!product.product.add_qty_using_price &amp;&amp; product.product.vertical_id ==5" aria-hidden="true" class="ng-hide"><span> buy rs.329</span>                   <meta itemprop="price" content="">                   <div><span ng-show="product.product.attributes.deal_mrp" class="strike ng-hide" aria-hidden="true">rs. </span><span ng-show="product.product.attributes.discounted_mrp" aria-hidden="true" class="ng-hide"> | pay @ store ~ rs. </span><span ng-show="product.product.attributes.discount_perc" aria-hidden="true" class="ng-hide"> | saving upto  %</span></div>                   <meta itemprop="pricecurrency" content="inr"></span><span ng-show="product.add_qty_using_price" aria-hidden="true" class="ng-hide"><span class="text"></span></span></button>               <button class="md-raised fl md-button md-default-theme ng-hide" ng-transclude="" type="button" ng-show="!product.product.notsellable &amp;&amp; product.product.preorder" ng-click="product.buyproduct();_gaq.push(['_addtrans','3523347','bboy body wears', '329','', '0', '', '', 'india'])" ng-class="product.iscartupdating ? 'cartupdating': ''" ng-disabled="product.iscartupdating || !product.product.instock ? &quot;disabled&quot;: &quot;&quot;" tabindex="0" aria-hidden="true" aria-disabled=""><span>preorder rs. 329                   <meta itemprop="price" content="329">                   <div><span ng-show="product.product.actual_price != product.product.offer_price" class="strike" aria-hidden="false">rs. 749</span><span ng-show="product.product.actual_price != product.product.offer_price" aria-hidden="false" class=""> | 56%  discount</span></div>                   <meta itemprop="pricecurrency" content="inr"></span></button>               <div ng-show="product.product.notsellable" class="md-button md-raised fr ng-hide" aria-hidden="true"><a ng-href="" target="_blank"><span class="text"></span></a></div>              </div> 

is there solution ?

use link better overview.
answer question more precisely, paytm gets data in js files product. following link gives data product listed @ paytm:
https://catalog.paytm.com/v1/p/product-url&callback=angular.callbacks._0&channel=web&version=2
link given you:
https://paytm.com/shop/p/masha-mauve-satin-nighty-wnighw000nt14_45bbppfr?src=search-grid&tracker=autosuggest%7cundefined%7cmasha%20nighty%7cgrid%7csearch%7c1.
product-url :
masha-mauve-satin-nighty-wnighw000nt14_45bbppfr?src=search-grid&tracker=autosuggest%7cundefined%7cmasha%20nighty%7cgrid%7csearch%7c1
hope helps you.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -