diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/PornhubRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/PornhubRipper.java index 7f10323d..88207123 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/PornhubRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/PornhubRipper.java @@ -68,11 +68,11 @@ public class PornhubRipper extends VideoRipper { title = title.replaceAll("\\+", " "); vidUrl = null; - for (String quality : new String[] {"quality_1080p", "quality_720p", "quality_480p", "quality_240p"}) { - Pattern pv = Pattern.compile("^.*var player_" + quality + " = '([^']*)'.*$", Pattern.DOTALL); + for (String quality : new String[] {"1080", "720", "480", "240"}) { + Pattern pv = Pattern.compile("\"quality\":\"" + quality + "\",\"videoUrl\":\"(.*?)\""); Matcher mv = pv.matcher(html); - if (mv.matches()) { - vidUrl = mv.group(1); + if (mv.find()) { + vidUrl = mv.group(1).replace("\\/", "/"); break; } } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java index 74d206e1..a6b990ad 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java @@ -56,8 +56,6 @@ public class VideoRippersTest extends RippersTest { } } - // https://github.com/RipMeApp/ripme/issues/187 - /* public void testPornhubRipper() throws IOException { List contentURLs = new ArrayList<>(); contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542")); @@ -66,7 +64,6 @@ public class VideoRippersTest extends RippersTest { videoTestHelper(ripper); } } - */ // https://github.com/RipMeApp/ripme/issues/186 /*