From 4f36369d84ac8bd5184a6988d7277cf988964cf2 Mon Sep 17 00:00:00 2001 From: Thomas Wade Date: Tue, 18 Sep 2018 18:13:07 +0930 Subject: [PATCH] Get follower and following count --- scrape.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scrape.py b/scrape.py index f9b5878..8427481 100755 --- a/scrape.py +++ b/scrape.py @@ -72,6 +72,14 @@ for user_str in users_to_process: track_count = soup.find('a', href='/' + user.url_username + '/tracks', class_='infoStats__statLink').div.string user.track_count = track_count + # Grab their following count + following_count = soup.find('a', href='/' + user.url_username + '/following', class_='infoStats__statLink').div.string + user.following_count = following_count + + # Grab their follower count + follower_count = soup.find('a', href='/' + user.url_username + '/followers', class_='infoStats__statLink').div.string + user.follower_count = follower_count + # Grab their like count like_count_elem = soup.find('a', href='/' + user.url_username + '/likes').find(class_='sidebarHeader__actualTitle') if like_count_elem: @@ -84,5 +92,7 @@ driver.quit() for _, user in user_dict.items(): print(user.username) - print(' ' + user.track_count + ' tracks') - print(' ' + user.like_count + ' likes') + print(' ' + str(user.track_count) + ' tracks') + print(' ' + str(user.like_count) + ' likes') + print(' Following ' + str(user.following_count)) + print(' Followed by ' + str(user.follower_count))