diff --git a/CHANGES.md b/CHANGES.md index 5b48b85..9551192 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Skip crash when accessing YouTube-API-only fields in scrape mode ([@ritiek](https://github.com/ritiek)) (#672) ## [1.2.4] - 2020-01-10 ### Fixed diff --git a/spotdl/youtube_tools.py b/spotdl/youtube_tools.py index 66528f7..c8346f2 100644 --- a/spotdl/youtube_tools.py +++ b/spotdl/youtube_tools.py @@ -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