Last active
November 22, 2019 19:51
-
-
Save zentrification/0ea1237daf99d329e8d4317a1144e525 to your computer and use it in GitHub Desktop.
Create directories of instagram usernames to download, run script
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 | |
PS3="Choice: " | |
USERS=$(ls | grep -v instagram-scraper) | |
MENU="stats download_all download_new "$USERS | |
function download_user { | |
echo "downloading instagram.com/$1" | |
#~/.local/bin/instalooter user $1 $1 | |
~/.local/bin/instagram-scraper @.instagram-credentials $1 | |
} | |
function download_all { | |
for USER in $USERS; do | |
download_user $USER | |
done | |
} | |
function download_new { | |
for USER in $USERS; do | |
FILES=$(ls -lh $USER | wc -l) | |
if (( FILES < 5 )); then | |
download_user $USER | |
fi | |
done | |
} | |
function stats { | |
for USER in $USERS; do | |
echo -e "$(ls -lh $USER | wc -l)\t$USER" | |
done | |
} | |
function menu { | |
while true; do | |
echo "Choose an Option: " | |
select COMMAND in $MENU; do | |
case $COMMAND in | |
download_all) download_all; break ;; | |
download_new) download_new; break ;; | |
stats) stats; break ;; | |
*) download_user $COMMAND; break ;; | |
esac | |
done | |
done | |
} | |
case $1 in | |
download_all) download_all ;; | |
download_new) download_new ;; | |
stats) stats ;; | |
*) menu ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment