【问题标题】:Java - Get every webpage associated with domain name programmaticallyJava - 以编程方式获取与域名关联的每个网页
【发布时间】:2016-08-04 00:13:42
【问题描述】:

我想制作一个用户输入 URL 的程序,该程序会响应该域名下关联的每个网页。现在,我正在使用 Jsoup 来获取每个 <a href> 链接,但如果站点通过 AngularJS 或其他方式更改页面,这并不总是涵盖站点上的每个网页。关于如何最好地做到这一点的任何建议?

【问题讨论】:

  • 每个网页?许多页面是动态的,仅根据用户的输入生成。另外,没有从原始网页链接的页面怎么办?

标签: java jsoup


【解决方案1】:

您不需要 jsoup。只需导航到主持人的robots.txt

https://stackoverflow.com/robots.txt

然后找到sitemap.xml。

Sitemap: /sitemap.xml

如果是 SO,Google 上的theirs is cached:

cache:https://stackoverflow.com/sitemap.xml

这将包含网站希望公开的所有链接。或者在 SO 的情况下,要扫描的其他站点地图列表。

https://stackoverflow.com/sitemap-questions-0.xml      
https://stackoverflow.com/sitemap-questions-1.xml 
https://stackoverflow.com/sitemap-questions-2.xml 
https://stackoverflow.com/sitemap-questions-3.xml 
https://stackoverflow.com/sitemap-questions-4.xml 
https://stackoverflow.com/sitemap-questions-5.xml 
https://stackoverflow.com/sitemap-questions-6.xml
....

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-06
    • 1970-01-01
    • 2021-08-08
    • 2010-09-28
    • 2012-08-04
    • 1970-01-01
    相关资源
    最近更新 更多