1.0.62 - Imgur album directories named after album #49
This commit is contained in:
parent
848a0757fa
commit
8b2d30496d
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<groupId>com.rarchives.ripme</groupId>
|
<groupId>com.rarchives.ripme</groupId>
|
||||||
<artifactId>ripme</artifactId>
|
<artifactId>ripme</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.61</version>
|
<version>1.0.62</version>
|
||||||
<name>ripme</name>
|
<name>ripme</name>
|
||||||
<url>http://rip.rarchives.com</url>
|
<url>http://rip.rarchives.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -28,6 +28,8 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
|
|
||||||
private final int SLEEP_BETWEEN_ALBUMS;
|
private final int SLEEP_BETWEEN_ALBUMS;
|
||||||
|
|
||||||
|
private Document albumDoc;
|
||||||
|
|
||||||
static enum ALBUM_TYPE {
|
static enum ALBUM_TYPE {
|
||||||
ALBUM,
|
ALBUM,
|
||||||
USER,
|
USER,
|
||||||
@ -75,6 +77,32 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
return new URL(u);
|
return new URL(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
|
String gid = getGID(url);
|
||||||
|
if (this.albumType == ALBUM_TYPE.ALBUM) {
|
||||||
|
try {
|
||||||
|
// Attempt to use album title as GID
|
||||||
|
if (albumDoc == null) {
|
||||||
|
albumDoc = Jsoup.connect(url.toExternalForm())
|
||||||
|
.userAgent(USER_AGENT)
|
||||||
|
.timeout(10 * 1000)
|
||||||
|
.maxBodySize(0)
|
||||||
|
.get();
|
||||||
|
}
|
||||||
|
String title = albumDoc.title();
|
||||||
|
if (!title.contains(" - Imgur")
|
||||||
|
|| title.contains("'s albums")) {
|
||||||
|
throw new IOException("No title found");
|
||||||
|
}
|
||||||
|
title = title.replaceAll(" - Imgur.*", "");
|
||||||
|
return "imgur_" + gid + " (" + title + ")";
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Fall back to default album naming convention
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getHost() + "_" + gid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rip() throws IOException {
|
public void rip() throws IOException {
|
||||||
switch (albumType) {
|
switch (albumType) {
|
||||||
@ -83,11 +111,9 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
case USER_ALBUM:
|
case USER_ALBUM:
|
||||||
ripAlbum(this.url);
|
ripAlbum(this.url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERIES_OF_IMAGES:
|
case SERIES_OF_IMAGES:
|
||||||
ripAlbum(this.url);
|
ripAlbum(this.url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USER:
|
case USER:
|
||||||
ripUserAccount(url);
|
ripUserAccount(url);
|
||||||
break;
|
break;
|
||||||
@ -309,6 +335,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
logger.info(" Retrieving " + pageURL);
|
logger.info(" Retrieving " + pageURL);
|
||||||
Document doc = Jsoup.connect(pageURL)
|
Document doc = Jsoup.connect(pageURL)
|
||||||
.userAgent(USER_AGENT)
|
.userAgent(USER_AGENT)
|
||||||
|
.timeout(10 * 1000)
|
||||||
.get();
|
.get();
|
||||||
Elements imgs = doc.select(".post img");
|
Elements imgs = doc.select(".post img");
|
||||||
for (Element img : imgs) {
|
for (Element img : imgs) {
|
||||||
|
@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
public class UpdateUtils {
|
public class UpdateUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||||
private static final String DEFAULT_VERSION = "1.0.61";
|
private static final String DEFAULT_VERSION = "1.0.62";
|
||||||
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
||||||
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
||||||
private static final String mainFileName = "ripme.jar";
|
private static final String mainFileName = "ripme.jar";
|
||||||
|
Loading…
Reference in New Issue
Block a user