Pitchfork response format has changed, breaks a number of features
Closed this issue · 1 comments
johnwmillr commented
The response format from Pitchfork has changed and breaks a number of this package's features. I've tested the code on a Mac using the Anaconda distribution of python 2.7.13
, and python 3.5.2
from python.org.
Most of these issues can be fixed by changing the JSON keys the search()
function expects and the HTML classes used when parsing with BeautifulSoup
.
I'm working on a fix for the bugs that I've found and will submit a pull request soon.
John
Bugs
Within the search function
URL to the review
File "pitchfork/pitchfork.py", line 203, in search
url = review_dict['site_url']
KeyError: 'site_url'
Key for artist name
File "pitchfork/pitchfork.py", line 204, in search
matched_artist = review_dict['content'].strip().split('\n\n\n')[0]
KeyError: 'content'
Within the Review class
URL to the album cover
File "pitchfork/pitchfork.py", line 70, in cover
image_link = artwork.img['src'].strip()
AttributeError: 'NoneType' object has no attribute 'img'
Label
File "pitchfork/pitchfork.py", line 85, in label
label = self.soup.find(class_='label-list').get_text()
AttributeError: 'NoneType' object has no attribute 'get_text'
Year
File "pitchfork/pitchfork.py", line 95, in year
year = self.soup.find(class_='year').contents[1].get_text()
File "/usr/local/lib/python3.5/site-packages/bs4/element.py", line 737, in __getattr__
self.__class__.__name__, attr))
AttributeError: 'Comment' object has no attribute 'get_text'
johnwmillr commented
Closed by #13.