mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Adding debugging when finding channel.
This commit is contained in:
parent
cccdd8fe4e
commit
760d949f5e
2 changed files with 5 additions and 4 deletions
|
|
@ -217,12 +217,14 @@ class VideoDownloader(Downloader, ABC):
|
|||
source_channel_id = info.get('channel_id')
|
||||
channel_url = info.get('channel_url')
|
||||
channel = None
|
||||
logger.debug(f'{channel_name=} {source_channel_id=} {channel_url=}')
|
||||
if channel_name or source_channel_id:
|
||||
# Try to find the channel via info_json from yt-dlp.
|
||||
try:
|
||||
channel = get_or_create_channel(source_id=source_channel_id, url=channel_url, name=channel_name)
|
||||
if channel:
|
||||
found_channel = 'yt_dlp'
|
||||
logger.debug(f'Found a channel with source_id {channel=}')
|
||||
except UnknownChannel:
|
||||
# Can't find a channel, use the no channel directory.
|
||||
pass
|
||||
|
|
@ -234,6 +236,7 @@ class VideoDownloader(Downloader, ABC):
|
|||
try:
|
||||
channel = get_channel(directory=destination, return_dict=False)
|
||||
found_channel = 'download_settings_directory'
|
||||
logger.debug(f'Found a channel that shares the destination directory {channel=}')
|
||||
except UnknownChannel:
|
||||
# Destination must not be a channel.
|
||||
pass
|
||||
|
|
@ -245,6 +248,7 @@ class VideoDownloader(Downloader, ABC):
|
|||
logger.info(f'Using download.settings to find channel')
|
||||
try:
|
||||
channel = get_channel(channel_id=local_channel_id, url=channel_url, return_dict=False)
|
||||
logger.debug(f'Found channel with channel url {channel=}')
|
||||
except UnknownChannel:
|
||||
# We do not need a Channel if we have a destination directory.
|
||||
if not destination:
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ def strip_extra_from_url(url: str) -> str:
|
|||
def normalize_video_url(url: str) -> str:
|
||||
"""Convert video URLs to what is expected to be in the yt-dlp info json."""
|
||||
url = url.strip()
|
||||
if match := YOUTUBE_SHORT_REGEX.match(url):
|
||||
source_id = match.group(1)
|
||||
url = f'https://www.youtube.com/watch?v={source_id}'
|
||||
if match := YOUTU_BE_REGEX.match(url):
|
||||
if (match := YOUTUBE_SHORT_REGEX.match(url)) or (match := YOUTU_BE_REGEX.match(url)):
|
||||
source_id = match.group(1)
|
||||
url = f'https://www.youtube.com/watch?v={source_id}'
|
||||
url = strip_extra_from_url(url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue