Thursday, 15 May 2014

android - Jsoup get absolute url from file and parse -


I want to load some txt files with some links inside. I want to parse this link (to see some results - tags or so) to view the scene list. I try to do something like this (but my knowledge in JSOUP is bad).

  file input = new file ("http://files.parsetfss.com / ce686da3-4464-47ec-ba73-24747f2da937 / tfss-75cfc482-96ab-45f8-8d8b-80b40a5a0298-http .txt "); Try {document doc = Jsoup.parse (Input, "UTF-8", "http://vao-priut.ru/"); } Hold (IOException e) {e.printStackTrace (); } 

If you have some files on the server available on the browser, then you can just read it line To do this, you can use the URL class and scanner for example. When you read each line, you can like it as you can parse it.

  URL input = new URL ("http://files.parsetfss.com/ce686da3-4464-47ec-ba73-24747f2da937 / tfss-75cfc482-96ab-45f8-8d8b-80b40a5a0298-http .txt "); Scanner sc = new scanner (input.openstream ()); While (sc.hasNextLine ()) {string link = sc.nextLine (); // Because each line has links to some resources / you can now use jsoup to parse it Document Doc = Jsoup.connect (link) .get (); // Here is the rest of the code responsible for parsing ... ... ...  

No comments:

Post a Comment