Skip to content

Commit

Permalink
randommeme filter out unavailable media files
Browse files Browse the repository at this point in the history
  • Loading branch information
Supinic committed Oct 29, 2024
1 parent 589263d commit 6678cc7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion commands/randommeme/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ module.exports = class RedditPost {
if (data.is_gallery) {
const meta = data.media_metadata;
for (const item of data.gallery_data.items) {
const mime = meta[item.media_id].m;
const itemMeta = meta[item.media_id];
if (itemMeta.status === "failed" || !itemMeta.m) {
continue;
}

const mime = itemMeta.m;
const ext = mime.split("/")[1];
const link = `https://i.redd.it/${item.media_id}.${ext}`;

Expand Down

0 comments on commit 6678cc7

Please sign in to comment.