Describe the bug
When using the search_album function, an attribute error occurs for albums that do not have the full release data listed on their Genius page. For example, the page for Joey Purp's album iiiDrops says "Released 2016", while most pages give an exact date.
Expected behavior
I expect the function to retrieve the album information for the given album and provide either a null value or just the year for the release date if the exact release date is not known.
To Reproduce
Search for any album that does not have a full release date. Using the same example given before:
Searching for "iiiDrops" by Joey Purp...
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-58-0284c1ae1410> in <module>
----> 1 album = genius.search_album("iiiDrops", "Joey Purp")
~/opt/anaconda3/envs/DataMining/lib/python3.8/site-packages/lyricsgenius/genius.py in search_album(self, name, artist, album_id, get_full_info, text_format)
354 album_info.update(new_info)
355
--> 356 return Album(self, album_info, tracks)
357
358 def search_song(self, title=None, artist="", song_id=None,
~/opt/anaconda3/envs/DataMining/lib/python3.8/site-packages/lyricsgenius/types/album.py in __init__(self, client, json_dict, tracks)
15 self.artist = Artist(client, body['artist'])
16 self.tracks = tracks
---> 17 self.release_date_components = convert_to_datetime(
18 body['release_date_components']
19 )
~/opt/anaconda3/envs/DataMining/lib/python3.8/site-packages/lyricsgenius/utils.py in convert_to_datetime(f)
55 f = date
56
---> 57 if f.count('-') == 2:
58 date_format = "%Y-%m-%d"
59 elif f.count('-') == 1:
AttributeError: 'int' object has no attribute 'count'
Include the error message associated with the bug.
Version info
Package version 3.0.0
OS: macOS 10.15 (Catalina)
Additional context
Based on the error message, I figured the issue likely had something to do with the date format. After checking manually, all of the albums I tried that produced this error had a release date like the example given here on their respective Genius pages, but it is possible that there may be other problematic date formats as well. This is the only problem I have had using the API so far, thank you for the great work you all have done on this!
Describe the bug When using the search_album function, an attribute error occurs for albums that do not have the full release data listed on their Genius page. For example, the page for Joey Purp's album iiiDrops says "Released 2016", while most pages give an exact date.
Expected behavior I expect the function to retrieve the album information for the given album and provide either a null value or just the year for the release date if the exact release date is not known.
To Reproduce Search for any album that does not have a full release date. Using the same example given before:
Output:
Include the error message associated with the bug.
Version info
Additional context Based on the error message, I figured the issue likely had something to do with the date format. After checking manually, all of the albums I tried that produced this error had a release date like the example given here on their respective Genius pages, but it is possible that there may be other problematic date formats as well. This is the only problem I have had using the API so far, thank you for the great work you all have done on this!