Advertisement
Guest User

V2CHttpUtil.patch

a guest
Dec 6th, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. --- V2CHttpUtil_old.java    Sun Mar 22 17:04:12 2015
  2. +++ V2CHttpUtil.java    Mon Dec 07 12:06:53 2015
  3. @@ -83,2 +83,5 @@
  4.             .compile("<dt>([0-9]*).+(<a href=\"(.+)\">(.+)<\\/a>|<font color=green>(.+)<\\/font>):(.+)<dd>(.+)<br><br>");
  5. +   static Pattern html2dat_potato = Pattern
  6. +           .compile("<div class=\"post\"[^>]+?><div class=\"number\">([0-9]*).+?<\\/div><div class=\"name\"><b>(<a href=\"(.+?)\">(.+?)<\\/a>|(.+?))<\\/b><\\/div><div class=\"date\">(.+?)<\\/div><div class=\"message\">(.+?)<\\/div><\\/div>");
  7. +
  8.     private static String sid;
  9. @@ -977,3 +980,9 @@
  10.         StringBuffer buff = new StringBuffer();
  11. -       Matcher datMatcher = html2dat.matcher(orig);
  12. +       Matcher datMatcher;
  13. +      
  14. +       if (orig.contains("<dl class=\"thread\""))
  15. +           datMatcher = html2dat.matcher(orig);
  16. +       else
  17. +           datMatcher = html2dat_potato.matcher(orig);
  18. +      
  19.         while (datMatcher.find()) {
  20. @@ -1000,3 +1009,3 @@
  21.             if (currRes == 1) {
  22. -               Pattern titlePat = Pattern.compile("<title>([^<]+)<\\/title>");
  23. +               Pattern titlePat = Pattern.compile("<title>([^<]+)(:|\\n)<\\/title>");
  24.                 Matcher m = titlePat.matcher(orig);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement