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

  • 相关阅读:
    poj2346
    poj3748
    poj1205
    PostThreadMessage 使用注意问题
    CBitmap Detach DeleteObject关系
    音视频编码技术与格式大全
    利用 DirectShow 开发自己的 Filter
    VC+DirectShow对视频进行图片处理VC教程电脑教程之家.htm
    Directx报错01
    深圳超多维光电子有限公司
  • 原文地址:https://www.cnblogs.com/xproer/p/10745082.html
Copyright © 2011-2022 走看看