Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to download videos from Instagram and other sites using youtube-dl/yt-dlp? #2699

Open
KonoVitoDa opened this issue Jun 24, 2022 · 9 comments

Comments

@KonoVitoDa
Copy link

It's probably a noob question, sorry.

@github-account1111
Copy link

@KonoVitoDa
Copy link
Author

@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.

@github-account1111
Copy link

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?

@KonoVitoDa
Copy link
Author

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.

@github-account1111
Copy link

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?

@KonoVitoDa
Copy link
Author

KonoVitoDa commented Jun 28, 2022

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...

@github-account1111
Copy link

Postprocessors have the ability to utilize external tools to write metadata directly to files.
#374 (comment) 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!

@mikf
Copy link
Owner

mikf commented Jun 28, 2022

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 c18fadc. It would also not be feasible with IG's current rate limits, which were much more lenient back then.

@KonoVitoDa
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants