Get follower and following count
This commit is contained in:
parent
51624e9715
commit
4f36369d84
14
scrape.py
14
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
|
track_count = soup.find('a', href='/' + user.url_username + '/tracks', class_='infoStats__statLink').div.string
|
||||||
user.track_count = track_count
|
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
|
# Grab their like count
|
||||||
like_count_elem = soup.find('a', href='/' + user.url_username + '/likes').find(class_='sidebarHeader__actualTitle')
|
like_count_elem = soup.find('a', href='/' + user.url_username + '/likes').find(class_='sidebarHeader__actualTitle')
|
||||||
if like_count_elem:
|
if like_count_elem:
|
||||||
@ -84,5 +92,7 @@ driver.quit()
|
|||||||
|
|
||||||
for _, user in user_dict.items():
|
for _, user in user_dict.items():
|
||||||
print(user.username)
|
print(user.username)
|
||||||
print(' ' + user.track_count + ' tracks')
|
print(' ' + str(user.track_count) + ' tracks')
|
||||||
print(' ' + user.like_count + ' likes')
|
print(' ' + str(user.like_count) + ' likes')
|
||||||
|
print(' Following ' + str(user.following_count))
|
||||||
|
print(' Followed by ' + str(user.follower_count))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user