我想从网站的人员列表中提取bios:
https://blueprint.connectiv.com/speakers/
我想摘录他们的头衔、公司和简历。但是,只有当您单击网站上的每张照片时,bio才可用。
下面是我提取标题的代码&;公司:
driver.find_element_by_xpath("//*[@id='speakers']/div/div/div/div/div/div/div").text.split('\n')
有人能帮我提取每个人的bios吗?任何建议都将不胜感激
Tags:
如果您要查找的所有信息都在一个段落标记
<p>
内,该标记具有一个类bio
(so<p class='bio'>
),并且源代码中已经存在所有模态,那么您只需使用以下选项选择all:它将选择作为
<p>
标记的所有元素,该标记也有一个等于'bio'的类,并在列表中返回它。如果某些p标记中有其他类(即<p class='bio someotherclass'>
),则需要在xpath中使用contains()方法,如下所示:然后,您可以像这样循环查看结果:
您不必单击图像,因为每个扬声器的所有模态都已在源中完全填充。您可以使用
driver.execute_script
从这些模态中提取内容:输出(前20个结果):
在
pandas
中:输出:
您可以使用
BeautifulSoup
代替driver.execute_script
:相关问题 更多 >
编程相关推荐