Posts

Showing posts with the label jsoup

Selecting Multiple Classes from an ID selection

Image
Clash Royale CLAN TAG #URR8PPP Selecting Multiple Classes from an ID selection I have the following XML <div id="Master25" class="open-pane" role="tabpanel"> <a href="/option1" title="option1" class="top-element "> <div class="top-element-description"> <div class="top-element-option-title">Spain</div> <div class="top-element-option-description">Test1</div> </div> <span class="top-element-price">23&euro;</span> </a> <a href="/option2" class="top-element "> <div class="top-element-description"> <div class="top-element-option-title">Greece</div> <div class="top-element-option-description">Test2</div> </div> <span class="top-element-price">25&euro;...

Extracting data from godaddy using jsoup

Image
Clash Royale CLAN TAG #URR8PPP Extracting data from godaddy using jsoup I'm using Jsoup to extract html from Godaddy's website. I want to extract this specific segment below. I have both the final webpage's specific segment, where it states "Sorry, google.com is taken" and the HTML code itself. However in my program I have the following: 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 test { public static void main(String args) throws IOException { String url = "https://www.godaddy.com/dpp/find?checkAvail=1&tmskey=&domainToCheck=google"; Document document = Jsoup.connect(url).get(); Element div = document.getElementById("searchResults"); Elements spans = div.select("span"); for (Element e: spans) System.out.println(e.text()); } } However, this code print...

Java Jsoup downloading torrent file

Image
Clash Royale CLAN TAG #URR8PPP Java Jsoup downloading torrent file I got a problem, I want to connect to this website (https://ww2.yggtorrent.is) to download torrent file. I've made a method to connect to the website by Jsoup who work well but when I try to use it to Download the torrent file, the website return "You must be connected to download file". Here is my code to connect: Response res = Jsoup.connect("https://ww2.yggtorrent.is/user/login") .data("id", "<MyLogin>", "pass", "<MyPassword>") .method(Method.POST) .execute(); and here is my code to download file Response resultImageResponse = Jsoup.connect("https://ww2.yggtorrent.is/engine/download_torrent?id=285633").cookies(cookies) .ignoreContentType(true).execute(); FileOutputStream out = (new FileOutputStream(new java.io.File("toto.torrent"))); out.write(resultIm...