We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 4b8a80ae authored by clint's avatar clint

fix bug #26342: & instead of & when importing from last.fm

parent 8939faf6
......@@ -11,7 +11,7 @@ sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
def parse_page(page):
"""Parse a page of recently listened tracks and return a list."""
soup = BeautifulSoup(urllib2.urlopen(page))
soup = BeautifulSoup(urllib2.urlopen(page), convertEntities=BeautifulSoup.HTML_ENTITIES)
for row in soup.find('table', 'candyStriped tracklist').findAll('tr'):
artist, track, timestamp = parse_track(row)
# Tracks submitted before 2005 have no timestamp
......@@ -37,7 +37,7 @@ def parse_track(row):
def fetch_tracks(user, request_delay=0.5):
"""Fetch all tracks from a profile page and return a list."""
url = 'http://last.fm/user/%s/tracks' % user
soup = BeautifulSoup(urllib2.urlopen(url))
soup = BeautifulSoup(urllib2.urlopen(url), convertEntities=BeautifulSoup.HTML_ENTITIES)
try:
num_pages = int(soup.find('a', 'lastpage').contents[0])
except:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment