A tool to determine the most used hashtags on a Mastodon instance
New Mastadon users must choose a server with little more information than a general description. To assist new users, a web page showing the top x# of recently used hashtags on an instance would provide more information.
Using the Mastodon API, you can programmatically retreive the public timeline for a single Mastodon instance. The timeline is an ordered list of statuses, which may or may not included one or more hashtags.
An example status object with two hashtags:
This tool will pull status objects from the public timeline, parse the objects and look for hashtags in the status objects. A global object will keep a running total of times each hashtag is used, over some specified period of time. This data will populate a public web page showing a list of the most used hashtags for that instance during the specified period of time. Each hashtag on that public page will be linked to the hashtag URL for that instance.
- Surface "Trending Tags" - Each instance can show trending tags, however, this may not be ideal for new users. It appears that Mastodon admins must allow a tag to be "trendable" so it appears.
- Use the Tag history for a subset of statuses on the public timeline. This will reduce the number of API calls because the full public timeline will not need to be queried. Tag history shows the number of uses of a tag over a set period of time, typically one week.
- Create a simple method to parse a small amount of public tags and calculate the totals for each tag used.
Check API limits for the above outlined approach.(Found on 2/27/23: 300 calls per 5 minutes per IP address or account) Note: Using the stream API, so a non-issue.- Mock up a public web page for the tag data.
- Reach out to Eugen and see if there's some private API / feature to accomplish the scope of this proposal.
-
2/27/2023 -- Basic NodeJS functionality as POC. Pull the latest 20 statuses and show the first tag (if any) in any statuses using a hashtag.
-
3/21/2023 -- Revamped the POC to get a stream of Mastodon status and output them to the console.
-
3/23/2032 -- Added real time status messages to a web page. Video below; first 16 seconds is waiting for someone to post a status.
Screencast.from.03-23-2023.02-41-09.PM.mp4
- 3/30/2023 -- Now parsing the stream to get hashtags only. Storing them in a flat file with the intention of storing in a database. Not yet passing this data to a web page.
- 4/1/2023 -- Added data validation so the code seems to be running more stable. Ran for 30 minutes and logged about 1,900 hashtags into the database.db file.