如何从此html代码段中获取电子邮件地址?
由于在某个网页上有数千个这样的潜在客户,并且其中的文字并不总是如此处所见。
唯一常见的是位于第一个位置的电子邮件地址。
如何获取电子邮件地址并忽略其余地址?
这些是要素:
<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
答案 0 :(得分:1)
结束</div>
标记进一步缩小,这就是您获取额外文本的原因。新线后你可以砍掉任何东西吗?或者检查字符串中的每个单词并保存其中带有“@”的单词?不好的方式,但它可能会有用......