Idiomdrottning’s homepage

jx — JSON explore

I sourced these into my shell environment so I can browse around on the JSON side of the Fediverse:

acct2url () {
    echo "$1"|sed 's;^@*\([^@]*\)@\(.*\)$;https://\2/.well-known/webfinger?resource=acct:\1@\2;'
}

jx () {
    wget -qO- --header \
	 'Accept: application/json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"' \
	 "$(acct2url "$1")" |jq
}

I can call this jx on an URL or Fedi account name, get out some JSON, copy and paste the URLs from there into new calls to jx and so on in order to browse around what’s going on. Because most of the time the web view of Fedi pages are pretty incomprehensible to me. People are sometimes better at API design than UI design.

So you call it like this:

jx @account@instance

And in that JSON you’ll find more URLs and when you wanna look at them, you call jx on those URLs too:

jx https://more.urls/that/you/found

acct2url is only called as a helper and if the input is already an URL, it just passes it through. jq is only used for pretty-printing and you can swap it out for your other fave JSON converter or parser, or tack on a pager like |less -e after.

Authenticated fetch interferes with this probably, I dunno. This stuff is pretty hard to understand even for a stable genius like me. Sad!

I’ve been using it to find posts from a.gup.pe or from PeerTube. They can be a li’l tricky to interact with otherwise if you don’t follow. Or at least I couldn’t find the object URLs.

I’m really enamored with the idea of one account for all things ActivityPub whether it be photos, texts, videos, topic threads, book reviews etc. Mainly that’s an aesthetic hangup, there’s certainly a lot of drawbacks to this approach. I like it because it feels a li’l more like email and a li’l less than web silos.

Standalone script version

If you don’t like sourcing things in, you can put this in a file and call it as a shell script:

#!/bin/sh

acct2url () {
    echo "$1"|sed 's;^@*\([^@]*\)@\(.*\)$;https://\2/.well-known/webfinger?resource=acct:\1@\2;'
}

wget -qO- --header \
	 'Accept: application/json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"' \
	 "$(acct2url "$1")" |jq