2021年1月7日星期四

Scraping webpage with _ngcontent value within different html tags

I am new to scraping and coding as well. So far I am able to scrap data using beautiful soup using below code:

sub_soup = BeautifulSoup(sub_page, 'html.parser')  content = sub_soup.find('div',class_='detail-view-content')  print(content)  

This works correct when tag and class are in format:

<div class="masthead-card masthead-hover">  

But fail when format is with _ngcontent:

<span _ngcontent-ixr-c5="" class="btn-trailer-text">  or  <div _ngcontent-wak-c4="" class="col-md-6">  

An example of _ngcontent webpage screenshot I am trying to scrap is below : enter image description here

All I tried results in blank or 'None'. What am I missing.

https://stackoverflow.com/questions/65623323/scraping-webpage-with-ngcontent-value-within-different-html-tags January 08, 2021 at 12:07PM

没有评论:

发表评论