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

Video extraction does not work with yt-dlp #35

Open
cenodis opened this issue Dec 5, 2024 · 0 comments
Open

Video extraction does not work with yt-dlp #35

cenodis opened this issue Dec 5, 2024 · 0 comments

Comments

@cenodis
Copy link

cenodis commented Dec 5, 2024

tumblr-backup 1.0.5 via pip
tumblr-backup --save-video --save-audio acesentialsketches

Using the --save-video flag does not work with yt-dlp. Instead every post with a video will always fail with a simple failure message.

Unable to download video in post #152679750480

Looking into the code the cause seems to be that the result returned from yt-dlp does not contain a key called entries.

result = ydl.extract_info(youtube_url, download=False)
media_filename = youtube_dl.utils.sanitize_filename(filetmpl % result['entries'][0], restricted=True)

I'm not sure if this is a change between youtube-dl and yt-dlp but with yt-dlp 2024.11.18 there is no "entries" key in the result object. Instead the template keys seem to be embedded directly at the root level. This results in an exception and means no videos will be saved.

A simple fix preserving compatibility with any ancient version of youtube-dl would be:

result = ydl.extract_info(youtube_url, download=False)
if 'entries' in result:
    result = result['entries'][0]
media_filename = youtube_dl.utils.sanitize_filename(filetmpl % result, restricted=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant