mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-29 00:29:55 +02:00
Fixes TheChive bug so that it can now rip gifs.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||
@@ -38,8 +37,8 @@ public class ThechiveRipper extends AbstractHTMLRipper {
|
||||
boolean isTag = false;
|
||||
return m.group(1);
|
||||
}
|
||||
throw new MalformedURLException("Expected thechive.com URL format: " +
|
||||
"thechive.com/YEAR/MONTH/DAY/POSTTITLE/ - got " + url + " instead");
|
||||
throw new MalformedURLException("Expected thechive.com URL format: "
|
||||
+ "thechive.com/YEAR/MONTH/DAY/POSTTITLE/ - got " + url + " instead");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,7 +51,15 @@ public class ThechiveRipper extends AbstractHTMLRipper {
|
||||
public List<String> getURLsFromPage(Document doc) {
|
||||
List<String> result = new ArrayList<>();
|
||||
for (Element el : doc.select("img.attachment-gallery-item-full")) {
|
||||
String imageSource = el.attr("src");
|
||||
String imageSource;
|
||||
if (el.attr("data-gifsrc").isEmpty()) { //If it's not a gif
|
||||
imageSource = el.attr("src");
|
||||
} else { //If it is a gif
|
||||
imageSource = el.attr("data-gifsrc") //from data-gifsrc attribute
|
||||
.replaceAll("\\?w=\\d{3}", ""); //remove the width modifier at the end to get highest resolution
|
||||
//May need to replace the regex's {3} later on if website starts giving higher-res photos by default.
|
||||
}
|
||||
|
||||
// We replace thumbs with resizes so we can the full sized images
|
||||
imageSource = imageSource.replace("thumbs", "resizes");
|
||||
result.add(imageSource);
|
||||
@@ -65,5 +72,4 @@ public class ThechiveRipper extends AbstractHTMLRipper {
|
||||
addURLToDownload(url, getPrefix(index));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user