Browsed by
Tag: jsoup

Multithreading Program in Java with online shop scrap Example

Multithreading Program in Java with online shop scrap Example

Multithreading Program in Java with online shop scrap Example: Multithreading is a process of executing multiple threads at a time. In our below example, we are sending the book ISBN number to 3 different online shops to scrap and get the price details. Final scrapped price details are written as JSON data. We have implemented multithreading in the below program by implementing runnable interface. This below programs sends an ISBN number to amazon, crossword and uread shops to get the…

Read More Read More

991 total views, 1 views today

How to Send SMS in Java using Third Party SMS API’s

How to Send SMS in Java using Third Party SMS API’s

How to Send SMS in Java using Third Party SMS API’s : Almost all the bulk SMS providers are sharing the SMS Apis as well to send the SMS from our java/php/any other programming languages. When you are planning to send bulk sms to your customers/users about any offers then you may need to buy bulk SMS from any bulksms provider in india. I have bought bulksms from shlrtechnosoft, I really enjoyed too with their service.   Requirements: 1. Buy…

Read More Read More

1,223 total views, no views today

PNR Live Status using Java

PNR Live Status using Java

When I wanted to get the PNR(Passenger Name Record) status programmatically, it can be done only using third party API’s. But none of the third party API’s are free and even if it is free then number of pnr status per day is limited. So I googled for java code to get the PNR status. I could able to see many links and programs, but as of today nothing is working.   Finally I took some code base from stack overflow…

Read More Read More

2,978 total views, 3 views today

AsyncTask with Broadcast Receiver in Android – Tutorial and Example

AsyncTask with Broadcast Receiver in Android – Tutorial and Example

AsyncTask with Broadcast Receiver in Android: What we are going to do ? We are going to see an example for AsyncTask in Android with Broadcastreceiver. In our example we will be fetching the operator and circle information for the received new SMS sender phone number. What is AsyncTask & BroadcastReceiver? AsyncTask: [sociallocker] AsyncTask is basically to do a aynchronous jobs in android, which is nothing but the background processes. We can use AsynCTask to call URL’s, to fetch some…

Read More Read More

4,238 total views, 2 views today

PDF Scrapping in Java Sample code

PDF Scrapping in Java Sample code

PDF Scrapping: We may needed to scrap the pdf using java. This involves parsing tables and different areas of pdf. How can we proceed ? We can proceed this way, 1. Converting pdf to html/xml 2. Parsing the converted html/xml using the Jsoup open source Jar (Jsoup-1.7.2). Converting pdf to html: To convert pdf to html we can use pdfbox jar (opensource). Disadvantage with pdfbox jar is, it will not convert the tables as exactly as there and also it…

Read More Read More

1,531 total views, 1 views today

Parsing Flipkart using Java

Parsing Flipkart using Java

Hi webscrappers, Herewith I have given the example working java code to parse flipkart and take the price of the given book (isbn). I have used Jsoup library. you can download from here, Jar Download: Jsoup Jar Java Program: package in.javadomain; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class FlipkartBookPrice { public static void main(String[] args) throws IOException { String bookIsbn = "9780070264984"; String fkPrice = getFlipkartPrice(bookIsbn); System.out.println("Flipkart Price of " + bookIsbn + ": \n" + fkPrice); } private…

Read More Read More

1,845 total views, no views today

Free Mobile Price Comparison API by Javadomain.in

Free Mobile Price Comparison API by Javadomain.in

Hello All, As Requested by our blog readers/followers/subscribers/members/users Javadomain finally released Mobile Price Comparison API. Sample Program: Add jsoup-1.7.2.jar and the above downloaded mobilepricecompare.jar to your build path. package in.javadomain; import in.javadomain.Compare; public class MobilePrice { public static void main(String[] args) { Compare c = new Compare(); System.out.println(c.mobileComparedPrice("nokia lumia 520")); } } Output: [plain] ebay – Rs.6430 amazon – Rs.8015 flipkart – Rs.8149 homeshop18 – Rs.8206 adexmart – Rs.8399 snapdeal – Rs.8530 infibeam – Rs.8548 indiatimes – Rs.8599 tradeus – Rs.8649 shopclues – Rs.8776 saholic – Rs.8845 themobilestore – Rs.8999 univercell – Rs.8999…

Read More Read More

923 total views, no views today

Jsoup Tutorials

Jsoup Tutorials

1. Introduction 2. Input    2.a From String    2.b From URL    2.c From File 3. Parsing Data    3.1 parsing element by id    3.2 parsing element by tag    3.3 parsing element by class    3.4 parsing element by attributes    3.5 parsing sibling elements    3.6 parsing parent and children elements 4. Selectors    4.1 find elements by id    4.2 find elements by tag    4.3 find elements by tag in a namespace    4.4 find…

Read More Read More

1,155 total views, no views today

Train Route Java Program

Train Route Java Program

Now you can get the train route information by simply inputting train number to the below program, Requirement: Jsoup jar Train Route Java Program: package in.javadomain; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class TrainRoute { public static void main(String[] args) { TrainRoute tr = new TrainRoute(); System.out.println(tr.getTrainSchedule("12635")); } private String getTrainSchedule(String trainNumber) { String trainRoute = null; String trainUrl = "http://www.indianrail.gov.in/cgi_bin/inet_trnnum_cgi.cgi"; try { Document trainRouteDetails = Jsoup.connect(trainUrl).timeout(0) .data("lccp_trnname", trainNumber).post(); String parsedTrainNumber = "Train No:" + trainRouteDetails.select("table.table_border_both") .select("tbody").select("tr").get(1).select("td") .get(0).text() +…

Read More Read More

1,104 total views, 1 views today

Domain availability Java program

Domain availability Java program

Requirement: Register in the Freedomainapi.com for api key, of course its free. Once you got the apikey replace in the below program and run. Requied Jar file: Java Json Jar Domain Availability Java program: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import org.json.JSONException; import org.json.JSONObject; public class DomainCheck { public static void main(String[] args) { DomainCheck dc = new DomainCheck(); String apikey = "XXXXXXXXXX"; String isEnteredDomainAvailable = dc.getDomainAvailable("fforfriends.com",apikey); System.out.println(isEnteredDomainAvailable); } private String getDomainAvailable(String domainName,String apiKey) { String…

Read More Read More

682 total views, no views today