【发布时间】:2020-07-23 19:48:47
【问题描述】:
我正在尝试从Udacity Catalog Webiste 中提取所有课程信息。
当我尝试从任何课程页面中提取价格时,它会返回一个 null months access 和一个空值,如下所示:
the Data Analyst course in the example
page_req = requests.get('https://www.udacity.com/course/data-analyst-nanodegree--nd002')
page_soup = BeautifulSoup(page_req.content, 'html.parser')
page_soup.find('div', class_='price-cards').find('div', class_='price-card bundle')
<div class="price-card bundle"><div class="flag"><p class="flag__text">10% OFF</p></div><div
class="price-info"><div class="price-info__deal" hidden="">BEST DEAL</div><div class="title h6">null
months access</div><div class="price"><span class="price__payable"><span class="skeleton
skeleton__default"><span style="width:100px"> </span></span></span><span class="price__label"><span
class="current-price"> per month</span></span></div><p class="blurb">Start learning today! Switch to
the monthly price afterwards if more time is needed.</p><div class="enroll-button__container"></div>
</div></div>
那么我怎样才能知道课程的价格呢?
注意:价格因国家/地区而异。 (即:在美国是 美元和意大利是欧元)
【问题讨论】:
标签: python web-scraping beautifulsoup request