Skip Youtube-API-only fields when scraping

This happens because YouTube recently disabled older API keys for some
reason, and so the API key being used internally in Pafy no longer
works.

See #671 for more information.
This commit is contained in:
Ritiek Malhotra
2020-03-02 15:49:21 +05:30
parent b45f75b5ca
commit 9a594d37c7

View File

@@ -109,8 +109,8 @@ def generate_metadata(content):
"artists": [{"name": None}],
"name": None,
},
"year": content.published.split("-")[0],
"release_date": content.published.split(" ")[0],
"year": None,
"release_date": None,
"type": "track",
"disc_number": 1,
"track_number": 1,
@@ -122,6 +122,14 @@ def generate_metadata(content):
"genre": None,
}
# Workaround for
# https://github.com/ritiek/spotify-downloader/issues/671
try:
meta_tags["year"] = content.published.split("-")[0]
meta_tags["release_date"] = content.published.split(" ")[0]
except pafy.util.GdataError:
pass
return meta_tags