Skip to content

Instantly share code, notes, and snippets.

@syui
Created November 17, 2015 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syui/e28a8113f30956300d11 to your computer and use it in GitHub Desktop.
Save syui/e28a8113f30956300d11 to your computer and use it in GitHub Desktop.
qiita-unfollow
#!/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