Created
November 17, 2015 08:48
-
-
Save syui/e28a8113f30956300d11 to your computer and use it in GitHub Desktop.
qiita-unfollow
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
#!/usr/local/bin/zsh | |
user=$USER | |
page=`curl -sL http://qiita.com/${user}/following_users | grep data-pjax | tail -n 1 | cut -d "?" -f 2 | cut -d '"' -f 1 | cut -d = -f 2` | |
#user=syui | |
#page=12 | |
following=$(for (( i=1;i<=${page};i++ )) | |
do | |
html=`curl -sL "http://qiita.com/${user}/following_users?page=${i}" | grep 'span itemprop="name"' | tr '>' '\n' | grep -A1 'itemprop="name"' |cut -d '<' -f -1` | |
echo "$html" | |
done) | |
followers=$(for (( i=1;i<=${page};i++ )) | |
do | |
html=`curl -sL "http://qiita.com/${user}/followers?page=${i}" | grep 'span itemprop="name"' | tr '>' '\n' | grep -A1 'itemprop="name"' |cut -d '<' -f -1` | |
echo "$html" | |
done) | |
d=`echo "$following"` | |
d=$d`echo "$followers"` | |
user=`echo "$d"|sort | uniq -u` | |
case $user in | |
"") echo ok ;; | |
*) echo "http://qiita.com/${user}" ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment