[BUGFIX] Use epoch_date if upload_date is missing (#927)
Fixes https://github.com/jmbannon/ytdl-sub/issues/912 If a required variable (like uid) is missing, ytdl-sub will error. This bugfix prevents sites that do not provide an upload date from erroring.
This commit is contained in:
parent
7c217db843
commit
b95ba86279
1 changed files with 3 additions and 1 deletions
|
|
@ -394,7 +394,9 @@ class UploadDateVariableDefinitions(ABC):
|
||||||
:description:
|
:description:
|
||||||
The entry’s uploaded date, in YYYYMMDD format. If not present, return today’s date.
|
The entry’s uploaded date, in YYYYMMDD format. If not present, return today’s date.
|
||||||
"""
|
"""
|
||||||
return StringDateMetadataVariable.from_entry(metadata_key="upload_date").as_date_variable()
|
return StringDateMetadataVariable.from_entry(
|
||||||
|
metadata_key="upload_date", default=self.epoch_date
|
||||||
|
).as_date_variable()
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def upload_year(self: "VariableDefinitions") -> IntegerVariable:
|
def upload_year(self: "VariableDefinitions") -> IntegerVariable:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue