
做博客,有时会引用些外链;
但,有些时候,外链中部分回称为死链;
网上搜了些、自己也写了个小工具,
去检测死链,发现准确度不很高;
故此:再这儿求助下:
请求推荐一款检测网站链接有效性工具(大谢);
若是开源小项目就更好了(比如用 Node)。
1 ivmm 2017 年 2 月 6 日 |
3 yangqi 2017 年 2 月 6 日 |
4 jeffjade OP 感谢,涨了点姿势。 但若是,一个网站 or 网页中存在很多外链,需要先抓取,然后再逐一判断,这样做,看起来就不能很好的工作了。 |
5 benbenlang 2017 年 2 月 6 日 via Android WordPress 有插件的,你搜搜 |
6 justyy 2017 年 2 月 6 日 |
7 wujysh 2017 年 2 月 6 日 $ sed -n 's/.*href="\([^"]*\).*/\1/p' file |
9 wujysh 2017 年 2 月 6 日 file 是 html 文件,也可以管道连 curl 得到的源网页 |
10 jeffjade OP @benbenlang 我用的是 Hexo ,之后我瞅瞅有否; |
11 yangqi 2017 年 2 月 7 日 @jeffjade @wujysh 改进了一下,加上-I, 只需要获取 header ,不需要下载整个页面 curl -sI -o /dev/null -w "%{http_code}" http://www.example.org/ |
12 jeffjade OP @yangqi 目测这样无法判断 http://www.example.org/ 页面中包含的外链是否有效呢。 |
13 wujysh 2017 年 2 月 7 日 wget -q http://www.sina.com.cn -O - | \ tr "\t\r\n'" ' "' | \ grep -i -o '<a[^>]\+href[ ]*=[ \t]*"\(ht\|f\)tps\?:[^"]\+"' | \ sed -e 's/^.*"\([^"]\+\)".*$/\1/' \ | \ xargs -n1 -P 10 curl -o /dev/null --silent --head --write-out '%{url_effective};%{http_code};%{time_total};%{time_namelookup};%{time_connect};%{size_download};%{speed_download}\n' 拼凑了一下 stackoverflow 上的例子,能达到效果,@jeffjade 你可以试试。 参考: http://stackoverflow.com/questions/2804467/spider-a-website-and-return-urls-only http://stackoverflow.com/questions/6136022/script-to-get-the-http-status-code-of-a-list-of-urls |
17 lslqtz 2017 年 2 月 7 日 有友链就上监控,外链就不用管了 |
18 jeffjade OP @yangqi 所以我想请教的是,有没有比“站长工具”中 http://tool.chinaz.com/links/ 这个类似,但比他精确的工具 |