Как скачать все ссылки на файлы.zip на заданной веб-странице, используя wget/curl?
Страница содержит ссылки на набор ZIP-файлов, все из которых я хочу скачать. Я знаю, что это можно сделать с помощью wget и curl. Как это сделать?
3 ответа
Решение
Команда:
wget -r -np -l 1 -A zip http://example.com/download/
Значения параметров:
-r, --recursive specify recursive download.
-np, --no-parent don't ascend to the parent directory.
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).
-A, --accept=LIST comma-separated list of accepted extensions.
Выше решение не работает для меня. Для меня только это работает:
wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off [url of website]
Значения параметров:
-r recursive
-l1 maximum recursion depth (1=use only this directory)
-H span hosts (visit other hosts in the recursion)
-t1 Number of retries
-nd Don't make new directories, put downloaded files in this one
-N turn on timestamping
-A.mp3 download only mp3s
-erobots=off execute "robots.off" as if it were a part of .wgetrc
Для других сценариев с некоторой параллельной магией я использую:
curl [url] | grep -i [filending] | sed -n 's/.*href="\([^"]*\).*/\1/p' | parallel -N5 wget -