diff --git a/scrape.py b/scrape.py index 2a49339..f8c6e46 100755 --- a/scrape.py +++ b/scrape.py @@ -172,6 +172,7 @@ def Get_Tracks_Info(url, limit = 100): tracks = {} + # Get all of the track elements up to the given limit track_elems = soup.find_all('li', class_='soundList__item')[:limit] for track_elem in track_elems: # Initialise a track object to hold our data @@ -272,8 +273,10 @@ def Get_Follows(url, limit = 100): users = {} + # Get all of the user badges up to the given limit badge_elems = soup.find_all(class_='badgeList__item')[:limit] for badge_elem in badge_elems: + # Grab their URL username username_elem = badge_elem.find('a', class_='userBadgeListItem__heading') if username_elem: user = User() @@ -282,8 +285,10 @@ def Get_Follows(url, limit = 100): print(' ' + user.url_username) + # Return just the values to make adding to the list easier return users.values() +# Converts string representations of numbers such as '1,234' or '35.6M' to integers def Human_Str_To_Int(string): num = None string = string.lower().replace(',', '')