-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