【发布时间】:2019-04-03 06:30:45
【问题描述】:
我正在使用python3.5 中的beautifulsoup 和requests 抓取网页。问题是当我试图解析p 中的电子邮件地址时,它给了我[email protected]。我尝试了其他链接,但没有任何收获。 cf_email 标记甚至不存在。我正在解析这个
email_addresses=[]
for email_address in detail.findAll('p'):
email_addresses.append(email_address.text)
information = {}
information['email'] = email_addresses
电子邮件位于<p> 标签中。
我在检查元素中有这个 html。
<div class="email">
<p>test1@hotmail.com</p>
<p>test2@yahoo.com</p>
<p>test3@yahoo.com</p>
<div>
当我打开页面源时,我注意到了这一点。
<p><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="472323222b2630262b2b26072f28332a262e2b6924282a">[email protected]</a></p>
【问题讨论】:
-
你能发布一个示例 html 吗?
-
您说您正在解析
div中的电子邮件地址,但您的代码中却通过了ps?detail有可能是一个 div 吗?请添加更多详细信息,就像@Rakesh 所说,您可以添加示例 html 吗? -
我已经编辑了我的答案。
-
所见即所得。在 html - 文本'电子邮件保护',并在你的结果'电子邮件保护'。
-
@crazyzubr 抱歉没听懂你在说什么
标签: django beautifulsoup python-3.5