channel_id is the only available key

This commit is contained in:
tcely 2025-01-22 20:59:21 -05:00 committed by GitHub
parent 25892388a1
commit fb87b54300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,14 +61,15 @@ def get_channel_id(url):
with yt_dlp.YoutubeDL(opts) as y:
try:
response = y.extract_info(url, download=False)
channel_id = response['channel_id']
playlist_id = response['playlist_id']
playlist_channel_id = response['playlist_channel_id']
except yt_dlp.utils.DownloadError as e:
raise YouTubeError(f'Failed to extract channel ID for "{url}": {e}') from e
else:
return playlist_channel_id or playlist_id or channel_id
try:
channel_id = response['channel_id']
except Exception as e:
raise YouTubeError(f'Failed to extract channel ID for "{url}": {e}') from e
else:
return channel_id
def get_channel_image_info(url):
opts = get_yt_opts()