gallery-dl
gallery-dl copied to clipboard
How to download videos from Instagram and other sites using youtube-dl/yt-dlp?
It's probably a noob question, sorry.
It's all in the docs:
https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#extractorytdlmodule https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#extractortwittervideos etc.
For yt-dlp/youtube-dl, make sure you're using the Python module, not the exe.
@github-account1111 I already added it to my downloader section, and it's working on Reddit and Twitter :
"downloader":
{
"ytdl":
{
"module": "yt_dlp",
"format": null,
"forward-cookies": true,
"config-file": "~/AppData/Roaming/yt-dlp/config.txt"
},
So it only can be used to download videos from those sites whose extractor expressly offers an ytdl option? Because Instagram doesn't have it.
According to https://github.com/mikf/gallery-dl/issues/462#issuecomment-548571035, Instagram is handled by youtube-dl/yt-dlp, and I'd imagine so do most sites that contain videos, but not sure. Why does that matter though?
According to #462 (comment), Instagram is handled by youtube-dl/yt-dlp, and I'd imagine so do most sites that contain videos, but not sure. Why does that matter though?
Mainly for metadata written directly to video files; and in the specific case of Instagram, because maybe the extractor has some problem in downloading the best/original quality sometimes. For example: I downloaded some videos last year and re-downloaded this year (because of the IG extractor update) and I noticed that several of them had differences, (even in resolution in one case), with the old downloaded videos having lower quality. Hope this new IG extractor is finally downloading the original videos.
The quality difference could be due to IG changing compression on their end (either using more aggressive algorithms on the original files or worse yet re-encoding the already compressed stuff). This definitely happens on YouTube. Some videos I downloaded years ago look better than when I download them now, no matter which quality I pick.
Mainly for metadata written directly to video files
Can't that be done with postprocessors?
Can't that be done with postprocessors?
It can? I thought gallery-dl could only write metadata to separate files. How to make it write them directly into the files? It would be so useful...
Postprocessors have the ability to utilize external tools to write metadata directly to files. https://github.com/mikf/gallery-dl/issues/374#issuecomment-945045349 explains nicely how to use Exiftool to achieve what you want, but for images, and provides a straightforward example. I've been using that one pretty much verbatim 😅
For videos I think you should be able to swap exiftool for ffmpeg and the corresponding ffmpeg cli flags.
But also - I haven't tried personally - but gallery-dl has quite a few options for youtube-dl (and by extension yt-dlp): https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#downloaderytdlraw-options https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#downloaderytdlcmdline-args https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#downloaderytdlconfig-file So maybe you can also modify the metadata that way.
For example, I have the following 3 lines in my yt-dlp config to embed the video url into the Title metadata field:
--embed-metadata
--parse-metadata " :%(meta_)s"
--parse-metadata 'webpage_url:%(meta_title)s'
That said, I've yet to try putting that into my gallery-dl config, so if you do try it lmk how it goes!
To answer the original question: Not possible. gallery-dl used to use youtube-dl to download videos from IG, but that was removed quite some time ago in c18fadc2. It would also not be feasible with IG's current rate limits, which were much more lenient back then.
@github-account1111 so, I'm already using an Exiftool postprocessor, thanks for your great help. And I think Exiftool can write metadata to videos as well. It's just not perfect because I'm having problems dealing with special characters, like Japanese characters, so please help me here if you know how. I'm almost there, I just need an Powershell/CMD command, I think.