【发布时间】:2017-11-09 20:50:23
【问题描述】:
我如何从这个 html sn-p 中获取电子邮件地址?
由于在某个网页中有数千条这样的线索,并且其中的文本并不总是像这里看到的那样找到。
唯一常见的是位于第一位的电子邮件地址。
我怎样才能得到电子邮件地址而忽略其余的?
这些是元素:
<div class="gm_popup"><div class="gm_name">Adel Outfitters</div><div class="gm_address">1221 W 4th St</div><div class="gm_location">Adel, Georgia 31620<div style="display:none" class="w3-address-country">United States</div></div><div class="gm_phone"><span class="gm_phone_label">P:</span> 229-896-7105</div><div class="gm_email">adeloutfitters@yahoo.com<div><div class="gm_website"><a href="https://www.facebook.com/pages/adel-outfitters/132735763434461" target="_blank">https://www.facebook.com/pages/Adel-Outfitters/132735763434461</a></div><br><a target="_blank" class="directions-link" href="http://maps.google.com/?saddr=+&daddr=1221+W 4th St, Adel, Georgia, 31620">Directions<span class="w3-arrow">different stuffs</span></a></div></div></div>
我尝试了什么:
Set post = html.getElementsByClassName("gm_email")(0)
MsgBox post.innerText
结果:
adeloutfitters@yahoo.com
https://www.facebook.com/pages/Adel-Outfitters/132735763434461
Directionsdifferent stuffs
预期输出:
adeloutfitters@yahoo.com
【问题讨论】:
标签: excel vba dom web-scraping