【发布时间】:2020-09-30 10:48:31
【问题描述】:
我正在尝试仅检索以下公司页面上的链接: https://clutch.co/it-services/msp
看来这是一个常见问题,我花了一天时间查看其他帖子,但没有任何成功。
代码:
links = []
for l in soup.find_all(class_='website-link website-link-a'):
results = (l.get('href'))
links.append(results)
print(links)
输出:
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
当我只打印 soup.find_all 的结果时,我得到:
<a data-extlink-pid="1219089" href="https://fulcrumdigital.com/" rel="nofollow" target="_blank">
<i class="icon icon-visit-site"></i><span class="">Visit Website</span>
</a>
</li>, etc, etc,
我需要在 href 之后提取但不知道如何。非常感谢任何建议。
【问题讨论】:
标签: python web-scraping beautifulsoup hyperlink tags