1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-16 20:28:15 +01:00

new URL is deprecated, use new URI, abstractripper

This commit is contained in:
soloturn 2023-06-15 12:06:31 +02:00
parent 3ae8fd916a
commit 7e6cdab4d7
4 changed files with 10 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@ -48,7 +49,7 @@ public abstract class AbstractRipper
private boolean completed = true;
public abstract void rip() throws IOException;
public abstract void rip() throws IOException, URISyntaxException;
public abstract String getHost();
public abstract String getGID(URL url) throws MalformedURLException;
public boolean hasASAPRipping() { return false; }

View File

@ -2,6 +2,7 @@ package com.rarchives.ripme.ripper;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
/**
@ -11,7 +12,7 @@ import java.net.URL;
* (cheers!)
*/
interface RipperInterface {
void rip() throws IOException;
void rip() throws IOException, URISyntaxException;
boolean canRip(URL url);
URL sanitizeURL(URL url) throws MalformedURLException;
void setWorkingDir(URL url) throws IOException;

View File

@ -8,6 +8,7 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.util.Map;
@ -22,7 +23,7 @@ public abstract class VideoRipper extends AbstractRipper {
super(url);
}
public abstract void rip() throws IOException;
public abstract void rip() throws IOException, URISyntaxException;
public abstract String getHost();

View File

@ -2,6 +2,8 @@ package com.rarchives.ripme.ripper.rippers.video;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -34,11 +36,6 @@ public class YuvutuRipper extends VideoRipper {
return m.matches();
}
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
return url;
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^http://www\\.yuvutu\\.com/video/[0-9]+/(.*)$");
@ -54,7 +51,7 @@ public class YuvutuRipper extends VideoRipper {
}
@Override
public void rip() throws IOException {
public void rip() throws IOException, URISyntaxException {
LOGGER.info("Retrieving " + this.url);
Document doc = Http.url(url).get();
Element iframe = doc.select("iframe").first();
@ -74,7 +71,7 @@ public class YuvutuRipper extends VideoRipper {
Matcher m = p.matcher(element.data());
if (m.find()){
String vidUrl = m.group(1);
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
addURLToDownload(new URI(vidUrl).toURL(), HOST + "_" + getGID(this.url));
}
}
waitForThreads();