I have a website from where I want to fetch video link from using Jsoup. But Im unable to do so my program throws an error. Can somebody please help me?
Here is the code:
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class MovMaker {
public static void main(String[] args) {
try {
String url="http://www.tamilyogi.tv/7aum-arivu-2011-hd-720p-tamil-movie-watch-online/";
Document doc = Jsoup.connect(url).get();
Element vid = doc.getElementsByTag("video").get(0);
System.out.println("\nlink: " + vid.attr("src"));
System.out.println("text: " + vid.text());
catch (IOException e) {
e.printStackTrace();
}
}
}
My Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at MovMaker.main(MovMaker.java:16)
The page source where I want to fetch the data from is: Here
Im new to java and jsoup completely I would be thankful if someone can give me the code.
Regards, Bhuvanesh