mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-29 16:50:10 +02:00
new URL is deprecated, use new URI, setGID, imgur
This commit is contained in:
@@ -51,7 +51,7 @@ public abstract class AbstractRipper
|
|||||||
|
|
||||||
public abstract void rip() throws IOException, URISyntaxException;
|
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, URISyntaxException;
|
||||||
public boolean hasASAPRipping() { return false; }
|
public boolean hasASAPRipping() { return false; }
|
||||||
// Everytime addUrlToDownload skips a already downloaded url this increases by 1
|
// Everytime addUrlToDownload skips a already downloaded url this increases by 1
|
||||||
public int alreadyDownloadedUrls = 0;
|
public int alreadyDownloadedUrls = 0;
|
||||||
@@ -551,7 +551,11 @@ public abstract class AbstractRipper
|
|||||||
* If any of those damned URLs gets malformed.
|
* If any of those damned URLs gets malformed.
|
||||||
*/
|
*/
|
||||||
public String getAlbumTitle(URL url) throws MalformedURLException {
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
|
try {
|
||||||
return getHost() + "_" + getGID(url);
|
return getHost() + "_" + getGID(url);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new MalformedURLException(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -37,7 +37,7 @@ public abstract class AlbumRipper extends AbstractRipper {
|
|||||||
public abstract URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException;
|
public abstract URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException;
|
||||||
public abstract void rip() throws IOException;
|
public abstract void rip() throws IOException;
|
||||||
public abstract String getHost();
|
public abstract String getHost();
|
||||||
public abstract String getGID(URL url) throws MalformedURLException;
|
public abstract String getGID(URL url) throws MalformedURLException, URISyntaxException;
|
||||||
|
|
||||||
protected boolean allowDuplicates() {
|
protected boolean allowDuplicates() {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -17,5 +17,5 @@ interface RipperInterface {
|
|||||||
URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException;
|
URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException;
|
||||||
void setWorkingDir(URL url) throws IOException;
|
void setWorkingDir(URL url) throws IOException;
|
||||||
String getHost();
|
String getHost();
|
||||||
String getGID(URL url) throws MalformedURLException;
|
String getGID(URL url) throws MalformedURLException, URISyntaxException;
|
||||||
}
|
}
|
@@ -86,7 +86,12 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getAlbumTitle(URL url) throws MalformedURLException {
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
String gid = getGID(url);
|
String gid = null;
|
||||||
|
try {
|
||||||
|
gid = getGID(url);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new MalformedURLException(e.getMessage());
|
||||||
|
}
|
||||||
if (this.albumType == ALBUM_TYPE.ALBUM) {
|
if (this.albumType == ALBUM_TYPE.ALBUM) {
|
||||||
try {
|
try {
|
||||||
// Attempt to use album title as GID
|
// Attempt to use album title as GID
|
||||||
@@ -459,7 +464,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException, URISyntaxException {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
Matcher m;
|
Matcher m;
|
||||||
|
|
||||||
@@ -469,7 +474,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
// Imgur album or gallery
|
// Imgur album or gallery
|
||||||
albumType = ALBUM_TYPE.ALBUM;
|
albumType = ALBUM_TYPE.ALBUM;
|
||||||
String gid = m.group(m.groupCount());
|
String gid = m.group(m.groupCount());
|
||||||
this.url = new URL("http://imgur.com/a/" + gid);
|
this.url = new URI("http://imgur.com/a/" + gid).toURL();
|
||||||
return gid;
|
return gid;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://(www\\.|m\\.)?imgur\\.com/(a|gallery|t)/[a-zA-Z0-9]*/([a-zA-Z0-9]{5,}).*$");
|
p = Pattern.compile("^https?://(www\\.|m\\.)?imgur\\.com/(a|gallery|t)/[a-zA-Z0-9]*/([a-zA-Z0-9]{5,}).*$");
|
||||||
@@ -478,7 +483,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
// Imgur album or gallery
|
// Imgur album or gallery
|
||||||
albumType = ALBUM_TYPE.ALBUM;
|
albumType = ALBUM_TYPE.ALBUM;
|
||||||
String gid = m.group(m.groupCount());
|
String gid = m.group(m.groupCount());
|
||||||
this.url = new URL("http://imgur.com/a/" + gid);
|
this.url = new URI("http://imgur.com/a/" + gid).toURL();
|
||||||
return gid;
|
return gid;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/?$");
|
p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/?$");
|
||||||
@@ -526,7 +531,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
albumType = ALBUM_TYPE.ALBUM;
|
albumType = ALBUM_TYPE.ALBUM;
|
||||||
String subreddit = m.group(m.groupCount() - 1);
|
String subreddit = m.group(m.groupCount() - 1);
|
||||||
String gid = m.group(m.groupCount());
|
String gid = m.group(m.groupCount());
|
||||||
this.url = new URL("http://imgur.com/r/" + subreddit + "/" + gid);
|
this.url = new URI("http://imgur.com/r/" + subreddit + "/" + gid).toURL();
|
||||||
return "r_" + subreddit + "_" + gid;
|
return "r_" + subreddit + "_" + gid;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://(i\\.|www\\.|m\\.)?imgur\\.com/([a-zA-Z0-9]{5,})$");
|
p = Pattern.compile("^https?://(i\\.|www\\.|m\\.)?imgur\\.com/([a-zA-Z0-9]{5,})$");
|
||||||
|
Reference in New Issue
Block a user