mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-06 22:06:48 +02:00
new URL is deprecated, use new URI, abstractripper
This commit is contained in:
@@ -8,6 +8,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -48,7 +49,7 @@ public abstract class AbstractRipper
|
|||||||
|
|
||||||
private boolean completed = true;
|
private boolean completed = true;
|
||||||
|
|
||||||
public abstract void rip() throws IOException;
|
public abstract void rip() throws IOException, URISyntaxException;
|
||||||
public abstract String getHost();
|
public abstract String getHost();
|
||||||
public abstract String getGID(URL url) throws MalformedURLException;
|
public abstract String getGID(URL url) throws MalformedURLException;
|
||||||
public boolean hasASAPRipping() { return false; }
|
public boolean hasASAPRipping() { return false; }
|
||||||
|
@@ -2,6 +2,7 @@ package com.rarchives.ripme.ripper;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +12,7 @@ import java.net.URL;
|
|||||||
* (cheers!)
|
* (cheers!)
|
||||||
*/
|
*/
|
||||||
interface RipperInterface {
|
interface RipperInterface {
|
||||||
void rip() throws IOException;
|
void rip() throws IOException, URISyntaxException;
|
||||||
boolean canRip(URL url);
|
boolean canRip(URL url);
|
||||||
URL sanitizeURL(URL url) throws MalformedURLException;
|
URL sanitizeURL(URL url) throws MalformedURLException;
|
||||||
void setWorkingDir(URL url) throws IOException;
|
void setWorkingDir(URL url) throws IOException;
|
||||||
|
@@ -8,6 +8,7 @@ import java.io.File;
|
|||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -22,7 +23,7 @@ public abstract class VideoRipper extends AbstractRipper {
|
|||||||
super(url);
|
super(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void rip() throws IOException;
|
public abstract void rip() throws IOException, URISyntaxException;
|
||||||
|
|
||||||
public abstract String getHost();
|
public abstract String getHost();
|
||||||
|
|
||||||
|
@@ -2,6 +2,8 @@ package com.rarchives.ripme.ripper.rippers.video;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -34,11 +36,6 @@ public class YuvutuRipper extends VideoRipper {
|
|||||||
return m.matches();
|
return m.matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^http://www\\.yuvutu\\.com/video/[0-9]+/(.*)$");
|
Pattern p = Pattern.compile("^http://www\\.yuvutu\\.com/video/[0-9]+/(.*)$");
|
||||||
@@ -54,7 +51,7 @@ public class YuvutuRipper extends VideoRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rip() throws IOException {
|
public void rip() throws IOException, URISyntaxException {
|
||||||
LOGGER.info("Retrieving " + this.url);
|
LOGGER.info("Retrieving " + this.url);
|
||||||
Document doc = Http.url(url).get();
|
Document doc = Http.url(url).get();
|
||||||
Element iframe = doc.select("iframe").first();
|
Element iframe = doc.select("iframe").first();
|
||||||
@@ -74,7 +71,7 @@ public class YuvutuRipper extends VideoRipper {
|
|||||||
Matcher m = p.matcher(element.data());
|
Matcher m = p.matcher(element.data());
|
||||||
if (m.find()){
|
if (m.find()){
|
||||||
String vidUrl = m.group(1);
|
String vidUrl = m.group(1);
|
||||||
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
|
addURLToDownload(new URI(vidUrl).toURL(), HOST + "_" + getGID(this.url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
waitForThreads();
|
waitForThreads();
|
||||||
|
Reference in New Issue
Block a user