ubershmekel / redditp

Convert any reddit page to a presentation or slide show
https://redditp.com
MIT License
261 stars 102 forks source link

Cross posts aren't shown #103

Closed ubershmekel closed 4 years ago

ubershmekel commented 4 years ago

https://www.reddit.com/r/LavaGifs/top/?t=all

https://www.redditp.com/r/LavaGifs/top/?t=all

The first gifs aren't shown on redditp. I assume it's because of the x-posting.

in4u commented 4 years ago

In script.js, replacing

if (!pic.data.media) return;  // skip crossposts, they don't have a pic.data.media obj
pic.type = imageTypes.gifv;
pic.url = pic.data.media.reddit_video.fallback_url;

with

if (pic.data.media) {
    pic.type = imageTypes.gifv;
    pic.url = pic.data.media.reddit_video.fallback_url;
} else if (pic.data.crosspost_parent_list[0].media) {
    pic.type = imageTypes.gifv;
    pic.url = pic.data.crosspost_parent_list[0].media.reddit_video.fallback_url;
} else {
    return;
}

seems to work.

ubershmekel commented 4 years ago

That worked. Just pushed it out. Thank you.