Skip to content

Instantly share code, notes, and snippets.

@sebble
Last active September 29, 2026 04:18
Show Gist options
  • Select an option

  • Save sebble/e5af3d03700bfd31c62054488bfe8d4f to your computer and use it in GitHub Desktop.

Select an option

Save sebble/e5af3d03700bfd31c62054488bfe8d4f to your computer and use it in GitHub Desktop.
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
for PAGE in `seq $PAGES`; do
curl -sH "Accept: application/vnd.github.v3.star+json" "https://api.github.com/users/$USER/starred?per_page=100&page=$PAGE"|jq -r '.[]|[.starred_at,.repo.full_name]|@tsv'
done
echo
# curl -sI https://api.github.com/users/$USER/starred?per_page=100|egrep '^Link: '|tr , \\n|grep 'rel="next"'|egrep -o '<https[^>]+'|tr -d \<
@cs-mshah

cs-mshah commented Oct 21, 2022 •

Copy link
Copy Markdown

doesnt work jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at"

You need to do:
sudo apt-get install -y jq and have a GITHUB_TOKEN

@waylzafr58-source

Copy link
Copy Markdown

[
{
"id": "1",
"title": "أغنية يمنية AI 1",
"artist": "ذكاء اصطناعي يمني",
"url": "https://files.catbox.moe/di13ru.mp3",
"image": "yemeni1"
},
{
"id": "2",
"title": "أغنية يمنية AI 2",
"artist": "ذكاء اصطناعي يمني",
"url": "https://files.catbox.moe/bjy68a.mp3",
"image": "yemeni2"
},
{
"id": "3",
"title": "أغنية يمنية AI 3",
"artist": "ذكاء اصطناعي يمني",
"url": "https://files.catbox.moe/rvxy1h.mp3",
"image": "yemeni3"
},
{
"id": "4",
"title": "أغنية يمنية AI 4",
"artist": "ذكاء اصطناعي يمني",
"url": "https://files.catbox.moe/7l4vrg.mp3",
"image": "yemeni4"
}
]

@BullShark

Copy link
Copy Markdown

doesnt work jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at" jq: error (at :4): Cannot index string with string "starred_at"

You need to do: sudo apt-get install -y jq and have a GITHUB_TOKEN

Maybe the script should have checked if exists $which jq and if the token is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment