1
0
bot/scpt/bluesky.zsh
2024-02-15 20:53:41 +09:00

25 lines
838 B
Bash
Executable File

#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}/json
#https://github.com/bluesky-social/atproto/issues/597
host=bsky.social
base=https://$host/xrpc
handle=`cat ~/.config/atr/token.json| jq -r .handle`
token=`cat ~/.config/atr/token.json| jq -r .accessJwt`
if [ -n "$1" ];then
url=$base/$1
else
url="$base/app.bsky.actor.getProfile?actor=$handle"
fi
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url | jq . >! $dd/profile.json
cat $dd/profile.json
url=$base/app.bsky.feed.getTimeline
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url | jq . >! $dd/timeline.json
cat $dd/timeline.json
url=$base/app.bsky.notification.listNotifications
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" $url | jq . >! $dd/notify.json
cat $dd/notify.json|jq .