| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| from collections import Counter | |
| from mastodon import Mastodon | |
| ''' | |
| register app in "Settings -> Development (when in doubt consult your friendly instance admin)" | |
| instantiate Mastodon with given key/secret (=client_cred.secret) and | |
| access token (=access_token.txt) and instance url | |
| ''' | |
| m = Mastodon( | |
| client_id = "client_cred.secret", | |
| access_token = "access_token.txt", | |
| api_base_url = "https://octodon.social" | |
| ) | |
| # favourites function only gets the first results, then get all others | |
| fav_first_page = m.favourites() | |
| favs = m.fetch_remaining(fav_first_page) | |
| fav_users = [] | |
| for f in favs: | |
| fav_users.append((f["account"]["username"], | |
| f["account"]["display_name"], | |
| f["account"]["url"], | |
| )) | |
| count_users = Counter(fav_users).most_common() | |
| for c in count_users: | |
| print(c[1], c[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment