jsoup

Update a tag name along with its value

怎甘沉沦 提交于 2020-01-07 08:01:12
问题 I am trying to replace html tags with updated values. I had tried using JSOUP but could not work out a way yet. The functionality : if (webText.contains("a href")) { // Parse it into jsoup Document doc = Jsoup.parse(webText); // Create an array to tackle every type individually as wrap can // affect whole body types otherwises. Element[] array = new Element[doc.select("a").size()]; for (int i = 0; i < doc.select("a").size(); i++) { if (doc.select("a").get(i) != null) { array[i] = doc.select(

ProGuard difficulties when obfuscating with libraries

烈酒焚心 提交于 2020-01-07 05:52:27
问题 While trying to use ProGuard (4.9) to obfuscate and optimise a desktop application everything works up until I use something from an external library such as JSoup.connect("http://google.com/").get(); . I would get the following error: Exception in thread "Thread-2" java.lang.ExceptionInInitializerError at org.jsoup.b.l.<clinit>(Unknown Source) at org.jsoup.b.f.<init>(Unknown Source) at org.jsoup.b.e.<init>(Unknown Source) at org.jsoup.c.bh.b(Unknown Source) at org.jsoup.c.bh.a(Unknown Source

ProGuard difficulties when obfuscating with libraries

痞子三分冷 提交于 2020-01-07 05:52:06
问题 While trying to use ProGuard (4.9) to obfuscate and optimise a desktop application everything works up until I use something from an external library such as JSoup.connect("http://google.com/").get(); . I would get the following error: Exception in thread "Thread-2" java.lang.ExceptionInInitializerError at org.jsoup.b.l.<clinit>(Unknown Source) at org.jsoup.b.f.<init>(Unknown Source) at org.jsoup.b.e.<init>(Unknown Source) at org.jsoup.c.bh.b(Unknown Source) at org.jsoup.c.bh.a(Unknown Source

Jsoup authentication failed

混江龙づ霸主 提交于 2020-01-07 04:33:06
问题 I'm trying to connect this website : https://ent.enteduc.fr/CookieAuth.dll?GetLogon?curl=Z2F&reason=0&formdir=1 with the following code : Connection.Response response = Jsoup.connect("https://ent.enteduc.fr/CookieAuth.dll?GetLogon?curl=Z2F&flags=0&forcedownlevel=0&formdir=1&username=XXX&password=XXX&trusted=4&SubmitCreds.x=36&SubmitCreds.y=7&SubmitCreds=Ouvrir+une+session") .method(Connection.Method.GET) .execute(); Document Doc = Jsoup.connect("https://ent.enteduc.fr/CookieAuth.dll?GetLogon

Android: Adding external library to project not working

怎甘沉沦 提交于 2020-01-06 23:46:12
问题 I am trying to add Jsoup library to my project, but I am getting an error in the program saying "Cannot resolve symbol 'Jsoup'". Below is what I have done, but not working. 1)From the Jsoup website, I downloaded the core library jsoup-1.10.2.jar 2)Dragged and dropped the .jar file under libs folder in my project 3)Under build.gradle in dependencies, I added the following line compile files('libs/jsoup-1.10.2.jar') 4)In MainActivity.java file, I tried to add the following line String url =

Java's URL/URI doesn't resolve correctly links starting with ? (interrogation point)

妖精的绣舞 提交于 2020-01-06 23:42:17
问题 I'm trying to resolve a relative link that starts with a question mark ? using Java's URL or URI classes. HTML example: <a href="?test=xyz">Test XYZ</a> Code examples (from Scala REPL): import java.net._ scala> new URL(new URL("http://abc.com.br/index.php?hello=world"), "?test=xyz").toExternalForm() res30: String = http://abc.com.br/?test=xyz scala> (new URI("http://abc.com.br/index.php?hello=world")).resolve("?test=xyz").toString res31: java.net.URI = http://abc.com.br/?test=xyz The problem

JSoup .followRedirects(true) does not work

左心房为你撑大大i 提交于 2020-01-06 20:04:22
问题 Does not follow (or at least does not get entire page content), how to solve that ? There is no client side redirects I presume ... <meta http-equiv ... stackoverflow http-equiv inside what I get down from this: Document doc1 = Jsoup.connect("http://e-uprava.gov.si/e-uprava/oglasnadeska.htm") .header("Accept-Encoding", "gzip, deflate") .userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21") .ignoreContentType(true)

Jsoup returns Status 400

懵懂的女人 提交于 2020-01-06 11:25:11
问题 I want to crawl data from this URL : http://www.expedia.co.jp/Osaka-Hotels-Hotel-Consort.h5522663.Hotel-Information?chkin=2017/12/13&chkout=2017/12/14&rm1=a2 So I have written following code import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import static org.jsoup.Connection.*; /** * Created by avi on 11/24/17. */ public class ExpediaCurl { public static void main(String[] args) { final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit

Jsoup : How to parse multiple HTML files from local drive?

馋奶兔 提交于 2020-01-06 09:01:14
问题 I've got multiple HTML files on my hdd to parse with Jsoup. I've been able to parse one file but not multiple files. I would like to parse all the files of a folder. I wrote this code wich extracts text (within certain ids) from a html file (named "file.htm" in the folder "C:/html") : package jsouptest; import java.io.File; 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 Main {

JSOUP parsing HTML get class inside class

亡梦爱人 提交于 2020-01-06 08:12:43
问题 i am developing android application using JSOUP for parsing HTML. i have HTML syntax <div class='wrapper'> <div style='margin:7px;'> <div class='box' style='height:595px'> <div class='boxtitlebox'> <div class='boxtitle'><h4>13 RECENT CHORDS</h4></div><div class='clear'></div> </div> <div class='listitem'><a href='http://www.chordfrenzy.com/chord/9742/ungu-apa-sih-maumu-kord-lirik-lagu'> <div class='subtitle'>Chord Ungu</div> <div class='title'>Apa Sih Maumu</div> </a></div> <div class=