문제

I want to parse Google Images' links to thumbnails and full pictures with JSOUP in Android. The android part actually isn't important as all I need is selector-syntax. I searched for tutorials or similar questions but couldn't find any valuable information.

To get images the link is https://www.google.com/search?tbm=isch&q=search-string.

Below is screenshot of Chrome's Webkit and you can see the link to thumbnail. If I could just get that it would be a good start to try getting links to full images myself.

Full size screenshot

도움이 되었습니까?

해결책

It would be selecting with "#rg div.rg_di img"

So for example something like

Document doc = Jsoup.connect("https://www.google.com/search?tbm=isch&q=search-string")
            .userAgent("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36")
            .get()

doc.select("#rg div.rg_di img")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top