我正在努力使用 Wiki Api。我如何使用 API 简单地获取页面 html。我知道这是可能的,因为我以前做过,但我不记得该怎么做。
假设我想要页面 http://en.wiktionary.org/wiki/bicycle 的页面源代码我该怎么做。我使用什么API。我不想在浏览器中查看?
最佳答案
使用 Java 和 Jsoup你可以这样做:
Document document = Jsoup
.connect("http://en.wiktionary.org/wiki/bicycle")
.get();
Element bodyContent = document.select("div#bodyContent").first();
System.out.println(bodyContent.html());
关于java - 如何获取维基词典页面的 Html 源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16254480/