LINUX.ORG.RU

Как указать исключения для “wget” при скачивании сайта?

 


0

1

Пытаюсь скачать сайт целиком через WGET, но требуется исключить некоторые URL по маске. Например нужно исключить страницы такого вида:

Нужно исключить все страницы, в которых есть «feed» либо «replytocom».

Делаю так:

wget -r -k -l 7 -p -nc -np -R "*replytocom*","*/feed*" http://site.ru/

Но эти страницы все равно скачиваются.

Вы читать 'man wget' пробовали?

‘-X list’
‘--exclude-directories=list’
Specify a comma-separated list of directories you wish to exclude from download (see Directory-Based Limits). Elements of list may contain wildcards.
anonymous
()
Ответ на: комментарий от napulsnik

Тогда вот:

‘--accept-regex urlregex’
‘--reject-regex urlregex’
Specify a regular expression to accept or reject the complete URL.
Опять же в 'man wget'.

Как писать regexp (регулярное выражение) разберитесь самостоятельно.

anonymous
()
Ответ на: комментарий от napulsnik

Я бы даже сказал, что вот эти все опции вам могут понадобиться:

‘-A acclist --accept acclist’
‘-R rejlist --reject rejlist’
Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘*’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it, like in ‘-A «*.mp3»’ or ‘-A '*.mp3'’.

‘--accept-regex urlregex’
‘--reject-regex urlregex’
Specify a regular expression to accept or reject the complete URL.

‘--regex-type regextype’
Specify the regular expression type. Possible types are ‘posix’ or ‘pcre’. Note that to be able to use ‘pcre’ type, wget has to be compiled with libpcre support.

Как написать «регулярку» сами разберитесь.

anonymous
()
Ответ на: комментарий от anonymous

Спасибо за мануал, который я уже читал, но весь вопрос в том, как эту регулярку составить.

napulsnik
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.