-1
我想拉扯使用j湯的reddit源代碼的用戶名,然後試圖DM他們,但我不能圖我們如何拉鍊接說/用戶。對不起,這真的很混亂。試圖從使用Jsoup從Reddit的用戶名
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
public class Main
{
public static void main(String[] args) {
Document doc;
try {
// need http protocol
doc = Jsoup.connect("https://www.reddit.com/new/).get();
// get page title
String title = doc.title();
System.out.println("title : " + title);
// get all links
Document doc = Jsoup.parse("https://www.reddit.com/new");
Elements certainLinks =
doc.select("https://www.reddit.com/user"); {
// get the value from href attribute
{
System.out.println("\nlink : " + link.attr("href"));
System.out.println("text : " + link.text());
}
catch (IOException e) {
e.printStackTrace();
}
}
}
}
什麼是你的問題? – tnw
聽起來像垃圾郵件給我 – efekctive