无法抓取 html 中的某些文本元素

问题描述 投票:0回答:1
python html web-scraping beautifulsoup
1个回答
0
投票

这应该有效。如果你的 div 有不同的类,你应该将它们放在一个列表中。

find_all
返回一个列表,并且可能返回多个
div
s

div_jobs = soup.find_all(class_=['Text__TextElement-sc-if376j-0', 'gYdBJW', 'encore-text-title-small'])
for div_job in div_jobs:
    job_title = div_job.text[1:]
© www.soinside.com 2019 - 2024. All rights reserved.