mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-12 00:44:03 +02:00
added audio post downloading support for tumblr + test (#2101)
This commit is contained in:
@@ -144,7 +144,7 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
if (albumType == ALBUM_TYPE.POST) {
|
if (albumType == ALBUM_TYPE.POST) {
|
||||||
mediaTypes = new String[] { "post" };
|
mediaTypes = new String[] { "post" };
|
||||||
} else {
|
} else {
|
||||||
mediaTypes = new String[] { "photo", "video" };
|
mediaTypes = new String[] { "photo", "video", "audio" };
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset;
|
int offset;
|
||||||
@@ -294,6 +294,23 @@ 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("audio_url")) {
|
||||||
|
try {
|
||||||
|
fileURL = new URI(post.getString("audio_url").replaceAll("http:", "https:")).toURL();
|
||||||
|
downloadURL(fileURL, date);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("[!] Error while parsing audio in " + post, e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (post.has("album_art")) {
|
||||||
|
try {
|
||||||
|
fileURL = new URI(post.getString("album_art").replaceAll("http:", "https:")).toURL();
|
||||||
|
downloadURL(fileURL, date);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("[!] Error while parsing album art in " + post, e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (post.has("body")) {
|
} else if (post.has("body")) {
|
||||||
Document d = Jsoup.parse(post.getString("body"));
|
Document d = Jsoup.parse(post.getString("body"));
|
||||||
if (!d.select("img").attr("src").isEmpty()) {
|
if (!d.select("img").attr("src").isEmpty()) {
|
||||||
|
@@ -39,4 +39,9 @@ public class TumblrRipperTest extends RippersTest {
|
|||||||
new URI("https://these-are-my-b-sides.tumblr.com/post/178225921524/this-was-fun").toURL());
|
new URI("https://these-are-my-b-sides.tumblr.com/post/178225921524/this-was-fun").toURL());
|
||||||
testRipper(ripper);
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
public void testTumblrAudioRip() throws IOException, URISyntaxException {
|
||||||
|
TumblrRipper ripper = new TumblrRipper(new URI("https://pilotredsun.tumblr.com/post/117939380846/march-2015").toURL());
|
||||||
|
testRipper(ripper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user