取消跟踪所有没有回复你的twitter用户

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了取消跟踪所有没有回复你的twitter用户相关的知识,希望对你有一定的参考价值。

Also posted at http://pastebin.com/9FzakUcd
  1. #! /usr/bin/env bash
  2. # unfollow_nofriends.sh
  3. # unfollow twitter users not following back to you.
  4. # ksaver (at identi.ca), Aug, 2010.
  5. # uses friendorfollow.com csv file at:
  6. # "http://friendorfollow.com/$USERNAME/results/?
  7. # orderby=undefined&type=following&format=csv"
  8. # and twitter API at:
  9. # "http://api.twitter.com/1/friendships/destroy/$ID.xml"
  10. # Requieres: curl, egrep, in order to work properly.
  11. # This script has been written to help in some twitter account maintanance,
  12. # please do not use it for evil pourposes :-)
  13. # Public Domain Code.
  14. # Not warranty at all.
  15.  
  16. # Edit this two lines according to your correct twitter account:
  17. USERNAME='username123'
  18. PASSWORD='password321'
  19.  
  20. TWIT_AUTH="$USERNAME:$PASSWORD"
  21. TWIT_API="http://api.twitter.com/1/friendships/destroy"
  22. FOF_CSV="http://friendorfollow.com/$USERNAME/results/?orderby=undefined&type=following&format=csv"
  23. ERR=0
  24. OK=0
  25.  
  26. function _curl()
  27. {
  28. /usr/bin/env curl -s -A 'Mozilla' "[email protected]"
  29. }
  30.  
  31. function get_nofriend_list()
  32. {
  33. _curl "$FOF_CSV" |cut -d',' -f2 |egrep -e [0-9]
  34. }
  35.  
  36. function unfollow_id()
  37. {
  38. ID="$1"
  39. _curl -u "$TWIT_AUTH" -d '' "$TWIT_API/$ID.xml"
  40. |grep '<error>' > /dev/null && return 1 || return 0
  41. }
  42.  
  43. function error_msg()
  44. {
  45. ID="$1"
  46. echo "Error unfollowing user with ID: $ID"
  47. }
  48.  
  49. function __main__()
  50. {
  51. ## Getting no-friend list in an Array...
  52. NOFRIENDS=( $(get_nofriend_list) )
  53.  
  54. echo "Unfollowing ${#NOFRIENDS[@]} total users..."
  55. for id in ${NOFRIENDS[@]}
  56. do
  57. unfollow_id $id && let OK=$OK+1 || (error_msg $id && let ERR=$ERR+1)
  58. done
  59.  
  60. echo "$OK total no-friend users unfollowed and $ERR errors."
  61. }
  62.  
  63. ## Run script if not called by source.
  64. if [ "$0" != 'bash' ]
  65. then
  66. __main__
  67. fi

以上是关于取消跟踪所有没有回复你的twitter用户的主要内容,如果未能解决你的问题,请参考以下文章

使用 Fabric SDK 从 Twitter 授权中取消时出现授权错误

twitter 的节点回复脚本实际上并没有回复

在Twitter上取消关注你的所有追随者

在 Firebase 中禁用自动活动跟踪

从 twitter 流中排除回复 - tweepy

回复特定推文Twitter API