Skip to content

Commit

Permalink
Added extra condition to include reddit gallery gifs urls
Browse files Browse the repository at this point in the history
  • Loading branch information
charan2628 committed May 24, 2021
1 parent 3c4e303 commit 8b3b60c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,12 @@ private void handleGallery(JSONArray data, JSONObject metadata, String id, Strin
prefix += String.format("%02d-", i + 1);
}
try {
URL mediaURL = new URL(media.getJSONObject("s").getString("u").replaceAll("&", "&"));
URL mediaURL;
if (!media.getJSONObject("s").isNull("gif")) {
mediaURL = new URL(media.getJSONObject("s").getString("gif").replaceAll("&", "&"));
} else {
mediaURL = new URL(media.getJSONObject("s").getString("u").replaceAll("&", "&"));
}
addURLToDownload(mediaURL, prefix, subdirectory);
} catch (MalformedURLException | JSONException e) {
LOGGER.error("[!] Unable to parse gallery JSON:\ngallery_data:\n" + data +"\nmedia_metadata:\n" + metadata);
Expand Down

0 comments on commit 8b3b60c

Please sign in to comment.