Added support for downloading embedded images from tumblrs
This commit is contained in:
parent
6b8101533a
commit
c489d86192
@ -19,6 +19,9 @@ import com.rarchives.ripme.ripper.AlbumRipper;
|
|||||||
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
import com.rarchives.ripme.utils.Utils;
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
public class TumblrRipper extends AlbumRipper {
|
public class TumblrRipper extends AlbumRipper {
|
||||||
|
|
||||||
@ -235,7 +238,6 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
for (int j = 0; j < photos.length(); j++) {
|
for (int j = 0; j < photos.length(); j++) {
|
||||||
photo = photos.getJSONObject(j);
|
photo = photos.getJSONObject(j);
|
||||||
try {
|
try {
|
||||||
// If the url is shorter than 65 chars long we skip it because it's those images don't support grabbing them in fullsize
|
|
||||||
fileURL = new URL(photo.getJSONObject("original_size").getString("url").replaceAll("http:", "https:"));
|
fileURL = new URL(photo.getJSONObject("original_size").getString("url").replaceAll("http:", "https:"));
|
||||||
|
|
||||||
m = p.matcher(fileURL.toString());
|
m = p.matcher(fileURL.toString());
|
||||||
@ -257,6 +259,16 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
LOGGER.error("[!] Error while parsing video in " + post, e);
|
LOGGER.error("[!] Error while parsing video in " + post, e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (post.has("body")) {
|
||||||
|
Document d = Jsoup.parse(post.getString("body"));
|
||||||
|
if (!d.select("img").attr("src").isEmpty()) {
|
||||||
|
try {
|
||||||
|
addURLToDownload(new URL(d.select("img").attr("src")));
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
LOGGER.error("[!] Error while getting embedded image at " + post, e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (albumType == ALBUM_TYPE.POST) {
|
if (albumType == ALBUM_TYPE.POST) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user