我试图将一个站点镜像到archive.org,但是使用curl非常慢,所以我想尝试使用aria2。
我首先使用以下命令制作站点的链接地图
wget -c -m --restrict-file-names=nocontrol https://www.example.com/然后使用curl运行以下命令
find . -type f -exec curl -v "https://web.archive.org/save/https://{}" ';'(实际上,我使用这个命令来获得一个足够好的日志来记录我正在做的事情。
find . -type f -exec curl -v "https://web.archive.org/save/https://{}" ';' 2> >(grep 'Rebuilt URL' >>/tmp/error ) >/tmp/stdout --包括在这里供参考)
它运行良好,find命令生成输出,如
./www.example.com/index卷曲神奇地忽略了领先的./
嗯,Aria2不是那么聪明。这个命令
find . -type f -exec aria2c -x 16 -s 1 "https://web.archive.org/save/https://{}" ';'导致此错误:
07/24 23:40:45 [ERROR] CUID#7 - Download aborted. URI=https://web.archive.org/save/https://./www.example.com/index(请注意URL中间的额外./ )。
然后我找到了这个问题,它帮助我修改了find的输出
find . -type f -printf '%P\n'返回
www.example.com/index(没有领先的./)
但是,当向aria2提供这个链接时,连接的URL仍然包含中间的./!??
find . -type f -printf '%P\n' -exec aria2c -x 16 -s 1 "https://web.archive.org/save/https://{}" ';'提供此错误消息。
www.example.com/index
07/24 23:52:34 [NOTICE] Downloading 1 item(s)
[#d44753 0B/0B CN:1 DL:0B]
07/24 23:52:35 [ERROR] CUID#7 - Download aborted. URI=https://web.archive.org/save/https://./www.example.com/index
Exception: [AbstractCommand.cc:351] errorCode=29 URI=https://web.archive.org/save/https://./www.example.com/index
-> [HttpSkipResponseCommand.cc:232] errorCode=29 The response status is not successful. status=502
07/24 23:52:35 [NOTICE] Download GID#d44753fe24ebf448 not complete:
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
d44753|ERR | 0B/s|https://web.archive.org/save/https://./www.example.com/index我如何摆脱./,这样aria2才能得到正确的URL呢?
奖金问题:
./www.example.com/index移动到./processed/www.example.com/index。我该怎么做?在exec of find命令中有什么?或者这需要一个完整的脚本吗?发布于 2018-07-25 09:06:45
最后一个不能工作,因为-exec独立于-printf。
但是您可以使用xargs而不是-exec:
find . -type f -printf '%P\n' \
| xargs -I{} aria2c -x 16 -s 1 "https://web.archive.org/save/https://{}"您还可以让多个aria2c实例与xargs -P <num>并行运行。
更好的选择是从find创建一个文件描述符,作为aria2的输入,而不是使用管道和xargs。
aria2c -x 16 -s 1 -i <(find . -type f -printf 'https://web.archive.org/save/https://%P\n')https://unix.stackexchange.com/questions/458296
复制相似问题