Advertisement
Guest User

Untitled

a guest
Jan 4th, 2012
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. StringBuilder whole = new StringBuilder();
  2.  
  3. try {
  4. URL url = new URL(
  5. "http://rootzwiki.com/forum/362-cdma-galaxy-nexus-developer-forum/");
  6.  
  7. HttpURLConnection urlConnection = (HttpURLConnection) url
  8. .openConnection();
  9. urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
  10. try {
  11. BufferedReader in = new BufferedReader(
  12. new InputStreamReader(new BufferedInputStream(
  13. urlConnection.getInputStream())));
  14. String inputLine;
  15.  
  16. while ((inputLine = in.readLine()) != null)
  17. whole.append(inputLine);
  18. in.close();
  19. } catch (IOException e) {
  20. Log.e("POC", e.getMessage());
  21. } finally {
  22. urlConnection.disconnect();
  23. }
  24. } catch (Exception e) {
  25. Log.e("POC", e.getMessage());
  26. }
  27. Document doc = Parser
  28. .parse(whole.toString(),
  29. "http://rootzwiki.com/forum/362-cdma-galaxy-nexus-developer-forum/");
  30. Elements authors = doc.select("a[hovercard-ref]");
  31. for (Element author : authors) {
  32. Log.d("POC", author.text() +" " + author.attr("href"));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement