解决办法
用mwget代替wget,mwget支持多线程下载
git : https://github.com/shengliwang/mwget
m -> multithread
下载mwget
先安装或更新组件:
sudo apt install build-essential
sudo apt upgrade intltool
sudo apt install libssl-dev
通过安装包安装:
wget http://jaist.dl.sourceforge.net/project/kmphpfm/mwget/0.1/mwget_0.1.0.orig.tar.bz2
tar -xjvf mwget_0.1.0.orig.tar.bz2
cd mwget_0.1.0.orig
./configure
sudo make
sudo make install
出现的问题
ftpplugin.cpp: In member function ‘virtual int FtpPlugin::get_info(Task*)’:
ftpplugin.cpp:85:19: error: ‘strlen’ was not declared in this scope
ptr = new char[strlen(task->url.get_file()) + 2];
^~~~~~
ftpplugin.cpp:85:19: note: suggested alternative: ‘mbrlen’
ptr = new char[strlen(task->url.get_file()) + 2];
^~~~~~
mbrlen
ftpplugin.cpp: In member function ‘int FtpPlugin::recursive_get_dir_list(Task&, Ftp*, const char*, const char*, FILE*, FILE*, off_t*)’:
ftpplugin.cpp:219:14: error: ‘strlen’ was not declared in this scope
currdir[strlen(currdir) - 1] = '\0';
^~~~~~
ftpplugin.cpp:219:14: note: suggested alternative: ‘mbrlen’
currdir[strlen(currdir) - 1] = '\0';
^~~~~~
mbrlen
ftpplugin.cpp:256:7: error: ‘strcmp’ was not declared in this scope
if(strcmp(ptr, ".") == 0 || strcmp(ptr, "..") == 0) continue;
^~~~~~
ftpplugin.cpp:256:7: note: suggested alternative: ‘StrDup’
if(strcmp(ptr, ".") == 0 || strcmp(ptr, "..") == 0) continue;
^~~~~~
StrDup
有好几个文件都报了这个错,在对应的.cpp中添加
#include <string.h>
可以解决。
* 后来发现这些报错的.cpp 都include了utils.h,所以也可以只在utils.h 中添加 #include <string.h>
使用方法
mwget [URL]
查看使用方式:
mwget -h
eg,修改线程数:
mwget -n 16 [URL] #16线程下载(默认为4)