不确定是否可以共享我试图获取其来源的网站,但我认为有必要进行更好的解释。如果不是提前,我深表歉意
命令:
curl -k -L -s https://www.mi.com
由于出现以下错误,由于某种原因,输出是二进制数据
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
Run Code Online (Sandbox Code Playgroud)
如何阅读页面 HTML 源代码?谢谢!
ter*_*don 10
只需将其重定向到一个文件,然后您就可以调查它是什么:
curl -k -L -s https://www.mi.com > outFile
Run Code Online (Sandbox Code Playgroud)
您现在可以使用该file
命令查看outFile
包含的内容:
$ file outFile
outFile: gzip compressed data, from Unix, original size modulo 2^32 135402
Run Code Online (Sandbox Code Playgroud)
所以,您刚刚下载了压缩数据。要查看它,请解压缩:
mv outFile outFile.gz ## gzip requires the .gz extension
gunzip outFile.gz
Run Code Online (Sandbox Code Playgroud)
或者只是使用可以处理压缩数据的工具,例如zmore
:
zmore outFile
Run Code Online (Sandbox Code Playgroud)
或者zcat
:
zcat outFile
Run Code Online (Sandbox Code Playgroud)
返回的数据是经过压缩的,可以curl
通过添加--compressed
选项指示直接处理解压:
curl -k -L -s --compressed https://www.mi.com
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6728 次 |
最近记录: |