gallery-dl
gallery-dl copied to clipboard
[reddit] support images and videos inside text posts
Images and videos can be embedded inside text posts using the fancy-pants editor in New Reddit, which gallery-dl does not pick up. Their format seems to be \n\n<p><a href="image url">caption or url again</a></p>\n
. Some test posts I wrote and information I gathered about them:
In https://reddit.com/r/test/comments/wkzf4i/is_media_metadata_sorted_by_something_else (old reddit, json):
Images that are uploaded to the post are in media_metadata
while links that look like images are not. media_metadata
seems to be sorted in alphabetical order of its keys however, so we'd probably need to parse the text.
In https://reddit.com/r/test/comments/wl01st/more_testing (old reddit, json):
There are links to images that are in the post which could be parsed as images (but I had to send HTTP requests to add them in since the editor kept bugging out, so this probably is a nitpick or non-issue). I've MITM'd New Reddit and saw that adding &rtj=1
to the url lets you get another representation of the post's body that lets you distinguish between images and links.
I'm willing to implement this, but should &rtj=1
be used?
What should be done if extractor.reddit.videos is set to ytdl? youtube-dl and yt-dlp currently don't support these posts either, nor do I really plan to make them (unless if necessary)