我正在尝试使用wget下载我的网站存档 - 3dsforums.com,但有数百万个页面我不想下载。因此,我想告诉wget只下载与特定URL模式匹配的页面,但我遇到了一些问题。
例如,这是我想要下载的一个URL: http://3dsforums.com/forumdisplay.php?f=46 因此,我尝试使用
这将提供以下响应:
例如,这是我想要下载的一个URL: http://3dsforums.com/forumdisplay.php?f=46 因此,我尝试使用
--accept-regex
选项:wget -mkEpnp --accept-regex "(forumdisplay\.php\?f=(\d+)$)" http://3dsforums.com
但它只下载了网站的主页。
到目前为止,唯一远程生效的命令是以下命令:
wget -mkEpnp --accept-regex "(\w+\.php$)" http://3dsforums.com
这将提供以下响应:
Downloaded 9 files, 215K in 0.1s (1.72 MB/s)
Converting links in 3dsforums.com/faq.php.html... 16-19
Converting links in 3dsforums.com/index.html... 8-88
Converting links in 3dsforums.com/sendmessage.php.html... 14-15
Converting links in 3dsforums.com/register.php.html... 13-14
Converting links in 3dsforums.com/showgroups.php.html... 14-29
Converting links in 3dsforums.com/index.php.html... 16-80
Converting links in 3dsforums.com/calendar.php.html... 17-145
Converting links in 3dsforums.com/memberlist.php.html... 14-99
Converting links in 3dsforums.com/search.php.html... 15-16
Converted links in 9 files in 0.009 seconds.
我的正则表达式有问题吗?或者我误解了--accept-regex
选项的用法?今天我尝试了各种变化,但是我还没有完全掌握实际问题是什么。