Skip to content

Conversation

@tpikonen
Copy link
Contributor

I removed the youtube_dl module from my system (but left yt_dlp) and got an exception in the youtube-dl extension when running gPodder master:

  File "/home/tpikonen/src/gpodder/master-worktree/share/gpodder/extensions/youtube-dl.py", line 17, in <module>
    from youtube_dl.utils import DownloadError, ExtractorError, sanitize_url

This patch fixes the import error.

@auouymous
Copy link
Member

I can confirm that uninstalling youtube-dl throws a 'youtube_dl module not found' error. But this patch fails when yt-dlp is not installed because youtube-dl stores them in the utils module.

This seems to work for both cases.

try:
    import yt_dlp as youtube_dl
    from yt_dlp.utils import DownloadError, ExtractorError, sanitize_url
except:
    import youtube_dl
    from youtube_dl.utils import DownloadError, ExtractorError, sanitize_url

But simply inserting .utils into your patch works and eliminates the duplicate imports. So maybe youtube_dl.utils.* instead of youtube_dl.*?

These caused an exception when run on a system where only yt-dlp is
installed.
@tpikonen
Copy link
Contributor Author

Thanks for testing, the exceptions actually are also in youtube_dl.* namespace, but sanitize_url is only in youtube_dl.utils.*.

I changed the patch to use youtube_dl.utils.* for both.

@auouymous auouymous merged commit 8e7c8f1 into gpodder:master Mar 27, 2022
@auouymous
Copy link
Member

Thanks for fixing this.

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

Successfully merging this pull request may close these issues.

2 participants