shrugginG 在 如何较为精准全面的提取html中所有的URL 中发帖
我当前有一个需求就是我手中有大量的爬取后的.html文件,现在我需要判定不同网页与外部的关联关系,一个很重要的指标就是网页中存在的”链接“,这个”链接“以URL标识
之前我使用的简单bs遍历所有的tag寻找特定属性中的URL
url_attributes = [
"href", # Hyperlink reference - Used for links and anchors
"src", # Source - Used for images, scripts, iframes etc.
"action", # Form submission URL
"data", # Data URL or URI
"background", # Background image URL
...