Jsoup : Extract Data and parse it in custom list
Welcome Guys I hope you are doing well 😊
In this video I'm going to show you how to extract any data from almost any website and parse it in custom list
Attention
Scraping data is likely illegal and I'm not responsible for anything happens
This video is just for educational purposes
For this video I'm going to scrape a website that supports that hhh
Just follow and see what we are going to extract
Open your project and add this
Design your app by adding listview
Number n
String url
List map
https://webscraper.io/test-sites/e-commerce/allinoneThis url is for testing purposes you use it for that without any problems
See this pic to know how to use the codes
I will provide only the code the other blocks add it by your self
class AsyncTaskEx extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... arg0) {
org.jsoup.nodes.Document doc = org.jsoup.Jsoup.connect(url).get();
org.jsoup.select.Elements data = doc.getElementsByClass("pull-right price");
org.jsoup.select.Elements datas = doc.getElementsByClass("description");
org.jsoup.select.Elements datass = doc.getElementsByClass("title");
for (org.jsoup.nodes.Element links : data) {
}
return null;
}
/** The system calls this to perform work in the UI thread and delivers
* the result from doInBackground() */
@Override
protected void onPostExecute(Void result) {
return ; }
@Override protected void onPreExecute() {
return ; } }
new AsyncTaskEx().execute();
And that's it just run your project and watch the magic happens 😁
Need project
ReplyDelete