commit
7792f3d99e
@ -28,7 +28,7 @@ public class PornhubRipper extends VideoRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRip(URL url) {
|
public boolean canRip(URL url) {
|
||||||
Pattern p = Pattern.compile("^https?://[wm.]*pornhub\\.com/view_video.php\\?viewkey=[0-9]+.*$");
|
Pattern p = Pattern.compile("^https?://[wm.]*pornhub\\.com/view_video.php\\?viewkey=[a-z0-9]+$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
return m.matches();
|
return m.matches();
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ public class PornhubRipper extends VideoRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^https?://[wm.]*pornhub\\.com/view_video.php\\?viewkey=([0-9]+).*$");
|
Pattern p = Pattern.compile("^https?://[wm.]*pornhub\\.com/view_video.php\\?viewkey=([a-z0-9]+)$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
@ -69,7 +69,7 @@ public class PornhubRipper extends VideoRipper {
|
|||||||
|
|
||||||
vidUrl = null;
|
vidUrl = null;
|
||||||
for (String quality : new String[] {"1080", "720", "480", "240"}) {
|
for (String quality : new String[] {"1080", "720", "480", "240"}) {
|
||||||
Pattern pv = Pattern.compile("\"quality\":\"" + quality + "\",\"videoUrl\":\"(.*?)\"");
|
Pattern pv = Pattern.compile("\"format\":\"\",\"quality\":\"" + quality + "\",\"videoUrl\":\"(.*?)\"");
|
||||||
Matcher mv = pv.matcher(html);
|
Matcher mv = pv.matcher(html);
|
||||||
if (mv.find()) {
|
if (mv.find()) {
|
||||||
vidUrl = mv.group(1).replace("\\/", "/");
|
vidUrl = mv.group(1).replace("\\/", "/");
|
||||||
|
@ -68,7 +68,7 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
|
|
||||||
public void testPornhubRipper() throws IOException {
|
public void testPornhubRipper() throws IOException {
|
||||||
List<URL> contentURLs = new ArrayList<>();
|
List<URL> contentURLs = new ArrayList<>();
|
||||||
contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542"));
|
contentURLs.add(new URL("https://www.pornhub.com/view_video.php?viewkey=ph5a329fa707269"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
PornhubRipper ripper = new PornhubRipper(url);
|
PornhubRipper ripper = new PornhubRipper(url);
|
||||||
videoTestHelper(ripper);
|
videoTestHelper(ripper);
|
||||||
|
Loading…
Reference in New Issue
Block a user