diff --git a/scrape.py b/scrape.py index cd8ed2f..6042b33 100755 --- a/scrape.py +++ b/scrape.py @@ -146,15 +146,15 @@ def Get_Tracks_Info(url, limit = 100): track.title = title_elem.span.string.strip() track.url = 'https://soundcloud.com' + title_elem['href'] + # Check if we have already gotten this track before + if track.url in tracks.keys(): + continue + # Grab who uploaded it (usually the artist unless it's a label) artist_elem = track_elem.find(class_='soundTitle__usernameText') if artist_elem: track.artist = artist_elem.string.strip() - # Check if we have already gotten this track before - if str(track.artist) + str(track.title) in tracks.keys(): - continue - # Grab when it was uploaded date_elem = track_elem.find(class_='soundTitle__uploadTime') if date_elem: @@ -186,7 +186,7 @@ def Get_Tracks_Info(url, limit = 100): track.reposts = repost_elem.string.strip() # Finally add the track to the dictionary - tracks[track.artist + track.title] = track + tracks[track.url] = track print(' ' + track.artist + ' - ' + track.title)