Gathering Hashtags from the Fediverse

Background

One minor foible of the fediverse[a] instance I’m on is that searching (for accounts or hashtags) can be quite slow. As a workaround for now, I’ve saved a list of accounts I’ve followed for easy reference, but I also wanted some way of saving a list of hashtags to refer to.

[a]

There are plenty of sites that will give you a list of 10, 20, maybe one hundred currently active hashtags, but for general purposes, I’d really like to have a thousand to look through, because I never know what hashtag might be popular enough to use, but not so popular that it lands in the top twenty or whatnot.

So, I asked around[a] on the fediverse, and was helped greatly by Don Hayward[b], who gave me the URL and usage.

[a]
[b]

The one-liner

So, here is how I generated the list:

for ((x=0; x<1000; x+=20)); do curl -sL "https://mastodon.social/api/v1/trends/tags?limit=20&offset=$x" |grep -o '"name":"[^"]*"' |cut -f4 -d\"; echo $x; sleep $(($RANDOM/1500)); done |tee fediverse-hashtags.txt

# A more readable version:

for ((x=0; x<1000; x+=20))
do
    curl -sL "https://mastodon.social/api/v1/trends/tags?limit=20&offset=$x" |grep -o '"name":"[^"]*"' |cut -f4 -d\"
    echo $x     #show progress
    sleep $(($RANDOM/1500))     #sleep a random amount of time between 0 and 21 seconds to give the server a break and not get flagged
done |tee fediverse-hashtags.txt

The results

Now, strangely, I didn’t get 1000 unique results. I couldn’t figure out what was wrong until fellow polymath[a] Clayton pointed out[b] that the list probably changed between the various invokations, and so there were some repeats.

[a]
[b]

So, here are all 1000 *cough* 975 hashtags, as of 2025-05-05:

(Oh, and a content warning: I haven’t read, vetted, or censored any of these)

~~~~~~~~

# 100 Days to Offload 2025 - Day 27