本文是Linux Shell脚本系列教程的第(四)篇,更多shell教程请看:Linux Shell脚本系列教程 与许多的编程语言一样,Shell中也有注释符号,继上一篇之后,今天就为大家来介绍下Shell中的注释的语法及用法。 Shell中的注释以“#”号开头,所有以“#”号开头的代码都会被解释器所忽略。 比如下面的代码: #!/bin/bash # Author…
April 19, 2018
Linux: cURL抓取页面, cURL支持页面跳转抓取, Follow Redirects with cURL
最近抓取谷歌首页面:
curl google.com
结果
#<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> #<TITLE>301 Moved</TITLE></HEAD><BODY> #<H1>301 Moved</H1> #The document has moved #<A HREF="http://www.google.com/">here</A>. #</BODY></HTML>
内容大概就是,页面发生了跳转,解决方法如下:
curl -L google.com
结果
#<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en">...
The -L
flag instructs cURL to follow any redirect so that you reach the eventual endpoint.
本文:Linux: cURL抓取页面, cURL支持页面跳转抓取, Follow Redirects with cURL
One Comment