怎么批量提取一个网页里面的链接?

有时候我们需要批量提取网页中的链接,可以使用各种不同的工具和方法。以下是几种常用的方法:

审查元素发

右键 审查元素 在console中输入

for(var a of document.getElementsByTagName('a')){

console.log(a.href)

}

然后使用记事本批量替换掉签名的数字编号即可!

wget 下载

可以使用如wgetcurl配合文本处理工具如grepawksed来提取链接。例如,使用wgetgrep

wget -qO- http://example.com | grep -oP 'href="\K[^"]+'

在线工具

有一些在线工具和网站允许您输入一个网页地址,然后为您提取出所有的链接。例如,“Extract Links From Web Page”这类在线服务。

https://www.prepostseo.com/link-extractor

https://uutool.cn/extract-hyperlink/

使用插件

Link Grabber: https://chrome.google.com/webstore/detail/link-grabber/caodelkhipncidmoebgbbeemedohcdma/related?utm_source=ext_app_menu