Safely get title string

No thanks to you, San Holo, this would've worked perfectly
This commit is contained in:
Thomas Wade 2018-09-30 16:02:33 +09:30
parent f8a6aa3980
commit 61df852e63

View File

@ -209,8 +209,11 @@ def Get_Tracks_Info(url, limit = 100):
# Grab the title and url
title_elem = track_elem.find(class_='soundTitle__title')
if title_elem:
track.title = str(title_elem.span.string.strip())
track.url = 'https://soundcloud.com' + title_elem['href']
if title_elem.span.string:
track.title = str(title_elem.span.string.strip())
else:
track.title = ''
# Check if we have already gotten this track before
if track.url in tracks.keys():