Getting Webpage Title, Img, Metadata info from Linux Terminal

泄露秘密 提交于 2019-12-13 06:26:18

问题


is there any way or any tools that I could use to get from a SH script, a webpage title, metadata such as descriptions, maybe a little screenshot of the webpage or anything like that?

Thanks in advance!


回答1:


you could use curl or wget to get the webpage, and then pipe it to sed to get the contents of various tags. It's kludgy as, but that's kinda what you're going to get if you're doing this stuff with a shell script.

eg

wget http://example.com -O - | grep \<title\>|sed "s/\<title\>\([^<]*\).*/\1/"

will give you the contents of the title tag. Note that in this example it gives you the raw un-parsed source, so it looks like IANA &mdash; Example domains instead of IANA – Example domains.

Have you considered using something like perl?



来源:https://stackoverflow.com/questions/11711339/getting-webpage-title-img-metadata-info-from-linux-terminal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!