1.0.40 - Flickr groups support, thread bug fix for #32

This commit is contained in:
4pr0n 2014-05-13 23:16:37 -07:00
parent 95f3eb6d36
commit 29b1afea06
3 changed files with 23 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId>
<packaging>jar</packaging>
<version>1.0.39</version>
<version>1.0.40</version>
<name>ripme</name>
<url>http://rip.rarchives.com</url>
<properties>

View File

@ -43,7 +43,15 @@ public class FlickrRipper extends AlbumRipper {
}
public URL sanitizeURL(URL url) throws MalformedURLException {
return url;
String sUrl = url.toExternalForm();
sUrl = sUrl.replace("secure.flickr.com", "flickr.com");
if (sUrl.contains("flickr.com/groups/") && !sUrl.contains("/pool")) {
if (!sUrl.endsWith("/")) {
sUrl += "/";
}
sUrl += "pool";
}
return new URL(sUrl);
}
public String getAlbumTitle(URL url) throws MalformedURLException {
@ -75,21 +83,28 @@ public class FlickrRipper extends AlbumRipper {
// Root: https://www.flickr.com/photos/115858035@N04/
// Album: https://www.flickr.com/photos/115858035@N04/sets/72157644042355643/
final String domainRegex = "https?://[wm.]*flickr.com";
final String userRegex = "[a-zA-Z0-9@]+";
// Album
p = Pattern.compile("^https?://[wm.]*flickr.com/photos/(" + userRegex + ")/sets/([0-9]+)/?.*$");
p = Pattern.compile("^" + domainRegex + "/photos/(" + userRegex + ")/sets/([0-9]+)/?.*$");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(1) + "_" + m.group(2);
}
// User page
p = Pattern.compile("^https?://[wm.]*flickr.com/photos/(" + userRegex + ").*$");
p = Pattern.compile("^" + domainRegex + "/photos/(" + userRegex + ").*$");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(1);
}
// Groups page
p = Pattern.compile("^" + domainRegex + "/groups/(" + userRegex + ").*$");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return "groups-" + m.group(1);
}
throw new MalformedURLException(
"Expected flickr.com URL formats: "
+ "flickr.com/photos/username or "
@ -230,8 +245,10 @@ public class FlickrRipper extends AlbumRipper {
}
else {
String prefix = String.format("%03d_%s_", index, Utils.filesystemSafe(title));
synchronized (flickrThreadPool) {
addURLToDownload(new URL(fullsizeImages.get(0).attr("src")), prefix);
}
}
} catch (IOException e) {
logger.error("[!] Exception while loading/parsing " + this.url, e);
}

View File

@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
private static final String DEFAULT_VERSION = "1.0.39";
private static final String DEFAULT_VERSION = "1.0.40";
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar";