zoukankan      html  css  js  c++  java
  • wget批量下载http文件

    eg:http://hgdownload.soe.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeAwgDnaseUniform/

    下载该路径下的所有文件

    wget http://hgdownload.soe.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeAwgDnaseUniform/

    得到一个 index.html 文件

    然后 

    wget -i index.html -F -B http://hgdownload.soe.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeAwgDnaseUniform/

    -i file

    --input-file=file

              Read URLs from a local or external file.  If - is specified as file, URLs are read from the standard input.  (Use ./- to read from a file literally named -.)

    从文件 index.html 中导入链接,默认按行读取URL

    -F 

     --force-html 

    When input is read from a file, force it to be treated as an HTML file. This enables you to retrieve relative links from existing HTML files on your local disk, by adding "" to HTML, or using the --base command-line option.

    将文件以HTML格式解析,(其实就是解析<a>?)<a> 代表链接

    -B URL

    --base=URL

              Resolves relative links using URL as the point of reference, when reading links from an HTML file specified via the -i/--input-file option (together with --force-html, or when the input file was fetched remotely from a server describing it as HTML). This is equivalent to the presence of a "BASE" tag in the HTML input file, with URL as the value for the "href" attribute.

    因为发现解析出来的链接用的都是相对路径,而为了下载这个文件,必须在相对路径前添加上Base URL,-B就是用来添加Base URL。

    DEMO下载地址:https://dwz.cn/Jw3z6fVq

  • 相关阅读:
    在LinuxMint 17 MATE中安装NVIDIA显卡驱动
    如何在VeryCD中下载资源
    创建多个Dialog时,namespace冲突问题的解决 -- 基于QT 5.2
    Qt 5.2中编译加载MySQL数据库驱动问题的总结
    Python入门 -- 001
    Qt 入门 ---- 布局管理
    Qt 入门 ---- 如何在程序窗口显示图片?
    Redis 教程笔记
    Python pip 报错
    Python手动安装 package
  • 原文地址:https://www.cnblogs.com/xproer/p/10745082.html
Copyright © 2011-2022 走看看