Skip to content

Commit

Permalink
[BUGFIX] Handle case when yt-dlp returns LazyList (#929)
Browse files Browse the repository at this point in the history
Fixes #910 , when yt-dlp sometimes returns a non-serializable LazyList
  • Loading branch information
jmbannon authored Feb 17, 2024
1 parent 248e9a1 commit f346b0e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ytdl_sub/entries/base_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import TypeVar
from typing import final

from yt_dlp.utils import LazyList
from yt_dlp.utils import sanitize_filename

from ytdl_sub.entries.script.variable_definitions import VARIABLES
Expand Down Expand Up @@ -37,6 +38,12 @@ def __init__(self, entry_dict: Dict, working_directory: str):
self._working_directory = working_directory
self._kwargs = entry_dict

# Sometimes yt-dlp can return a LazyList which is not JSON serializable.
# Cast it to a native list here. (https://github.com/jmbannon/ytdl-sub/issues/910)
for key in self._kwargs.keys():
if isinstance(self._kwargs[key], LazyList):
self._kwargs[key] = list(self._kwargs[key])

@property
def uid(self) -> str:
"""
Expand Down

0 comments on commit f346b0e

Please sign in to comment.