Add some better structure to status prints

This commit is contained in:
Thomas Wade 2018-09-19 09:49:01 +09:30
parent 3f8aa7304f
commit 5781fab7bd

View File

@ -67,6 +67,8 @@ def Get_Basic_Info(user):
driver.get('https://soundcloud.com/' + user.url_username) driver.get('https://soundcloud.com/' + user.url_username)
soup = BeautifulSoup(driver.page_source, 'lxml') soup = BeautifulSoup(driver.page_source, 'lxml')
print(' Basic Info:')
# Grab their username # Grab their username
# Use stripped_strings generator as workaround for users with premium badge # Use stripped_strings generator as workaround for users with premium badge
username = next(soup.find(class_='profileHeaderInfo__userName').stripped_strings) username = next(soup.find(class_='profileHeaderInfo__userName').stripped_strings)
@ -100,6 +102,8 @@ def Get_Tracks_Info(user):
driver.get('https://soundcloud.com/' + user.url_username + '/tracks') driver.get('https://soundcloud.com/' + user.url_username + '/tracks')
soup = BeautifulSoup(driver.page_source, 'lxml') soup = BeautifulSoup(driver.page_source, 'lxml')
print(' Tracks:')
tracks = {} tracks = {}
track_elems = soup.find_all(class_='soundList__item') track_elems = soup.find_all(class_='soundList__item')
@ -150,6 +154,8 @@ def Get_Tracks_Info(user):
# Finally add the track to the dictionary # Finally add the track to the dictionary
tracks[track.artist + track.title] = track tracks[track.artist + track.title] = track
print(' ' + track.artist + ' - ' + track.title)
user.tracks = tracks user.tracks = tracks
user_dict = {} user_dict = {}