How it works

Top posts

When you view an accounts top posts at /by/@{username}/{server}, your browser makes requests to {server}s public API to get all public posts by that account, sorts them by favourite_count descending, then displays the top 20 most-favorited posts.

For example, for @kottke@botsin.space, your browser will make requests to https://botsin.space/api/v1/accounts/109478699916859289/statuses

Search

When you search for an account, your browser makes requests requests to mastodon.socials public search endpoint, e.g. https://mastodon.social/api/v2/search?q=kottke.org. Its the same request that mastodon.socials search page uses.

Source code

Source code is available on GitHub at patrik-csak / top-mastodon-posts