【发布时间】:2021-12-18 03:44:25
【问题描述】:
我正在尝试从 Udemy 网站提取价格数据以及学生人数。 我在 Windows 上,我在 conda 环境中使用 Python 3.8 和 BeautifoulSoup。
这是我的代码:
url = 'https://www.udemy.com/course/business-analysis-conduct-a-strategy-analysis/'
html = requests.get(url).content
bs = BeautifulSoup(html, 'lxml')
searchingprice = bs.find('div', {'class':'price-text--price-part--2npPm udlite-clp-discount-price udlite-heading-xxl','data-purpose':'course-price-text'})
searchingstudents = bs.find('div', {'class':'','data-purpose':'enrollment'})
print(searchingprice)
print(searchingstudents)
而且我只获得有关学生的信息,而不是价格。我做错了什么?
None
<div class="" data-purpose="enrollment">
13,490 students
</div>
谢谢!
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup