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> <groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId> <artifactId>ripme</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.39</version> <version>1.0.40</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

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