私はGoogle Scholarのhtmlからタグを抽出する必要があります。私はスクリプトを書いたが、それはすべてのものを抽出する。私は紙のダウンロードリンクが休止している特定のタグを抽出する方法を見つけることができません。助けてください。! は、以下のコード<a>をダウンロードするにはpdfファイルをダウンロードするリンクが含まれているgoogle scholar
public static void main(String[] args) throws IOException {
Document doc;
try {
doc = Jsoup.connect("https://scholar.google.com.pk/scholar?q=Bergmark%2C+D.+%282000%29.+Automatic+extraction+of+reference+linking+information+from+online+documents.+Technical+Report+CSTR2000-1821%2C+Cornell+Digital+Library+Research+Group&btnG=&hl=en&as_sdt=0%2C5").get();
String title = doc.title();
System.out.println("title : " + title);
Elements links = doc.select("a[href]");
// Elements link = doc.select(".pdf");
for (Element link : links) {
// get the value from href attribute
System.out.println("\nlink : " + link.attr("href"));
System.out.println("text : " + link.text());
}
} catch (IOException e) {
e.printStackTrace();
}
であり、ここで、これは、このタグの構造は次のとおりです。CSSクエリとして
<a href="https://ecommons.cornell.edu/bitstream/handle/1813/5809/2000-1821.pdf?sequence=1" data-clk="hl=en&sa=T&oi=gga&ct=gga&cd=0&ei=YBMXWYbRO8a72Ab_2o24CQ"><span class="gs_ctg2">[PDF]</span> cornell.edu</a>
はあなたのコードを表示!! –
@を見てください! –
ありがとうございました。 –