Skip to content

Instantly share code, notes, and snippets.

@devdilson
Last active August 1, 2021 14:36
Show Gist options
  • Save devdilson/c5d333212381008cebd96d089c7b976a to your computer and use it in GitHub Desktop.
Save devdilson/c5d333212381008cebd96d089c7b976a to your computer and use it in GitHub Desktop.
Clones a github Search
#!/bin/bash
TOKEN=
SEARCH=maplestory
SORT=desc
CREATED=2006-01-11T00:00:00Z
mkdir "logs" &
mkdir result &
for i in {1..100}
do
url="https://api.github.com/search/repositories?q=$SEARCH&per_page=100&page=$i&created>=$CREATED&sort=created&order=$SORT"
echo "URL: $url"
repos=`curl -s "$url" -H 'Authorization: token '$TOKEN`
github_urls=`echo $repos | grep -o 'git@[^"]*'`
for url in $github_urls; do
filename=${url/git@github.com:/}
if [ ! -d "./result/$filename" ] ; then
echo "Downloading $filename"
git clone --quiet "$url" "./result/$filename"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment