Why Jsoup?
Jsoup is a java library which support to extract and manipulate HTML elements. We can use this library parse HTML in android. The specialty is that, jsoup allows you to extract the info instead of rendering it.
Setup the android project
Insert following code to your grandle.build file and sync the project to add the jsoup library to android workplace.
Add these lines to onCreate.
1 | compile 'org.jsoup:jsoup:1.7.3' |
Create the app
First of all you have to identify what exactly do you want to extract from the web site. If you are using google chrome simple press F12 to open devTool, in the Element find the HTML view of the web page you want. Take some time and identify right elements. I'm gonna extract img src from the "div.post-thumbnail".
Add these lines to onCreate.