Last active
August 1, 2021 14:36
-
-
Save devdilson/c5d333212381008cebd96d089c7b976a to your computer and use it in GitHub Desktop.
Clones a github Search
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
#!/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