iVin Virus iVin Virus - 2 years ago 98
Python Question

Scrapping Data with ID or Class(is it possible with Java?)

Is it possible to extract data from any url through id/class of an element and send it to a database? can the extraction be done within Java or Python is needed?

For example, on the url https://www.youtube.com/watch?v=9bZkp7q19f0 there is a div element with a class called "watch-view-count" which displays a number, how to find and extract data from this class?

Thanks alot in advance dear helper :)

Answer Source

Certainly possible with java, checkout the JSOUP lib and Tutorials

Document doc = Jsoup.connect("http://www.codeinventory.com").get();
Elements els = doc.getElementsByClass("notepad-index-post");
Elements els1 = doc.getElementsById("id1");

For Python checkout BeautifulSoup

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download