Created
July 4, 2023 02:39
-
-
Save camlspotter/636940c828e39bc258eef420b6eba904 to your computer and use it in GitHub Desktop.
Access BlueSky
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You need | |
# | |
# - curl | |
# - jq | |
# Your handle, ex xxxx.bsky.social or your custom handle like dailambda.jp. | |
# No '@' mark. | |
HANDLE=hogehoge.bsky.social | |
# Your App password: Settings > App password > Add App password | |
APP_PASSWORD=hoge-hoge-hoge-hoge | |
# Your identity. No auth required. | |
curl https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=$HANDLE | jq | |
# Get the session key | |
if [ ! -f _auth ]; then | |
curl --json '{ "identifier" : "'$HANDLE'", "password": "'$APP_PASSWORD'" }' \ | |
https://bsky.social/xrpc/com.atproto.server.createSession > _auth | |
fi | |
accessJwt=$(jq -r .accessJwt < _auth) | |
echo "Authorized" | |
# Get your last 10 posts | |
curl --header "Content-Type: application/json" \ | |
--header "Authorization: Bearer $accessJwt" \ | |
"https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed?actor=$HANDLE&limit=10" | jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment