Google Image Search extract tool
Posted: Fri Aug 20, 2021 9:03 am
Google Image Search extract tool
you can simply extract first image URL from Google search results using JSOUP.
https://jsoup.org/
For example: Code to retrieve image URL of the first thumbnail:
source
https://stackoverflow.com/questions/340 ... -available
you can simply extract first image URL from Google search results using JSOUP.
https://jsoup.org/
For example: Code to retrieve image URL of the first thumbnail:
Code: Select all
public static String FindImage(String question, String ua) {
String finRes = "";
try {
String googleUrl = "https://www.google.com/search?tbm=isch&q=" + question.replace(",", "");
Document doc1 = Jsoup.connect(googleUrl).userAgent(ua).timeout(10 * 1000).get();
Element media = doc1.select("[data-src]").first();
String finUrl = media.attr("abs:data-src");
finRes= "<a href=\"http://images.google.com/search?tbm=isch&q=" + question + "\"><img src=\"" + finUrl.replace(""", "") + "\" border=1/></a>";
} catch (Exception e) {
System.out.println(e);
}
return finRes;
}
https://stackoverflow.com/questions/340 ... -available