[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:
Jesse Bannon 2024-02-17 08:19:21 -08:00 committed by GitHub
parent 7c217db843
commit b95ba86279
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -394,7 +394,9 @@ class UploadDateVariableDefinitions(ABC):
:description:
The entrys uploaded date, in YYYYMMDD format. If not present, return todays 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
def upload_year(self: "VariableDefinitions") -> IntegerVariable: