parent
c29cca2b3d
commit
be0f6f2d2d
1 changed files with 16 additions and 11 deletions
|
|
@ -221,6 +221,7 @@ class YTDLP:
|
|||
with cls._listen_and_log_downloaded_info_json(
|
||||
working_directory=working_directory, log_prefix=log_prefix_on_info_json_dl
|
||||
):
|
||||
# TODO: Fetch parent_dict if it breaks
|
||||
parent_dict = cls.extract_info(
|
||||
ytdl_options_overrides=ytdl_options_overrides, **kwargs
|
||||
)
|
||||
|
|
@ -239,17 +240,21 @@ class YTDLP:
|
|||
|
||||
# For YouTube playlists in particular, channel metadata is not fetched. Attempt to get
|
||||
# channel metadata via grabbing uploader_url info json a max of 3 times
|
||||
current_iter = 0
|
||||
url = kwargs.get("url")
|
||||
uploader_url = parent_dict.get("uploader_url")
|
||||
while current_iter < 3 and uploader_url and url != uploader_url:
|
||||
cls.logger.debug("Attempting to get parent metadata from URL %s", uploader_url)
|
||||
parent_dict = cls.extract_info(
|
||||
ytdl_options_overrides=ytdl_options_overrides | {"playlist_items": "0:0"},
|
||||
url=uploader_url,
|
||||
)
|
||||
current_iter += 1
|
||||
url = uploader_url
|
||||
if isinstance(parent_dict, dict):
|
||||
current_iter = 0
|
||||
url = kwargs.get("url")
|
||||
uploader_url = parent_dict.get("uploader_url")
|
||||
while current_iter < 3 and uploader_url and url != uploader_url:
|
||||
cls.logger.debug("Attempting to get parent metadata from URL %s", uploader_url)
|
||||
parent_dict = cls.extract_info(
|
||||
ytdl_options_overrides=ytdl_options_overrides | {"playlist_items": "0:0"},
|
||||
url=uploader_url,
|
||||
)
|
||||
|
||||
if not isinstance(parent_dict, dict):
|
||||
break
|
||||
current_iter += 1
|
||||
url = uploader_url
|
||||
uploader_url = parent_dict.get("uploader_url")
|
||||
|
||||
return cls._get_entry_dicts_from_info_json_files(working_directory=working_directory)
|
||||
|
|
|
|||
Loading…
Reference in a new issue