Tcl Tk 显示所有可用链接

Tcl Tk show all available links

Tcl/Tk 中是否有一个函数可以显示来自 link 的所有可用网址?我想开始编写具有某些功能的网络爬虫程序。

For example:
the user types this:
"www.testsite.com"
and he will get that:
"www.testsite.com/dir1/"
"www.testsite.com/dir2/"
e.g.

还是用phyton等其他语言编程更好?

br

使用 http 和 tDOM 包很容易做到。您只需要了解一点 XPath 就可以了……

package require http
package require tdom

set tok [http::geturl http://example.com/index.html]
set html [http::data $tok]
http::cleanup $tok

set doc [dom parse -html $html]
foreach anchor [$doc selectNodes "//a"] {
    puts [$anchor @href]
}