0

I am trying to get the image source of some image using jsoup in a google widget like this:

https://i.stack.imgur.com/sYFZ0.png

These come up if you just search for "weather houston". I am new to jsoup and don't even know if that is possible. My current code looks like this, but can't find anything.

Document doc = Jsoup.connect("https://www.google.com/search?q=weather houston").userAgent("Mozilla/5.0").timeout(5000).get();
Element e = doc.select("img").first();
String src = e.absUrl("src");

It seems to me, that the widget is non existent from jsoups side of view. Again I am completely new to this, so I might be saying something stupid right now. I couldn't find any problem or solution related on the internet.

  • Maybe best to post your stacktrace, but anywaym you could also try to use urlencoding `https://www.google.com/search?q=weather%20houston` – Scary Wombat Mar 19 '20 at 01:44
  • `jsoup` doesn't support JavaScript, and that image seems to be added later dynamically by executing JS. See [Jsoup Java HTML parser : Executing Javascript events](https://stackoverflow.com/q/7344258) – Pshemo Mar 19 '20 at 02:06

0 Answers0