[
  {
    "path": ".gitignore",
    "content": ".keys\nunfollowed_full_names.txt\nunfollowed_usernames.txt\n"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\ngem \"twitter\"\ngem \"pry\"\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 Felix Krause\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# twitter-unfollow\n\n> My goal for the next months is to spend less time on social media and more time creating. Instead of reacting to things, I want to focus on having a bigger vision, planning things ahead and doing what has the highest impact.\n> \n> I've been reading every single tweet in my timeline for the last 4 years with no interruption.\n> \n> In total I have over 100 custom mute filters, including custom regexes like `(@United|delta|Delta|JetBlue|jetblue)`), and muted clients like Buffer\n>\n> It's time for me to stop reading so much on social media portals, and focus on reading books instead.\n> \n> I'll still follow a small amount of people via Twitter lists, since there are certain things I really don't want to miss\n\n![unfollow.gif](unfollow.gif)\n\n[View full blog post on my Twitter setup](https://krausefx.com/blog/how-i-use-twitter)\n\nThis script does the following:\n\n- Unfollow everybody\n- Puts them into a list called \"Old Follows\"\n- Store the usernames of everyone in `unfollowed_usernames.txt` (this allows you to pretty easily follow everyone again when you feel like it)\n- Store the usernames, together with full name and bio into `unfollowed_full_names.txt` (this allows you to search for users)\n\n```\nbundle install\nbundle exec ruby unfollow.rb\n```\n\n## Notes:\n- Make sure to have DMs open to still be able to chat with your friends.\n- Use a list to follow a small subset of people. This way you follow 0 people and nobody feels left out. The list can be private.\n- Make sure to create a list called \"Old Follows\"\n\n## Technical Notes\n- Create your application via [Twitter Apps](https://apps.twitter.com)\n- Set the following environment variables\n  - `ENV[\"CONSUMER_KEY\"]`\n  - `ENV[\"CONSUMER_SECRET\"]`\n  - `ENV[\"ACCESS_TOKEN\"]`\n  - `ENV[\"ACCESS_TOKEN_SECRET\"]`\n- Due to the API limits this script can only unfollow about 420 people per run. You'll need to regenerate keys after this 🤷‍♀️\n\n[View full blog post on my Twitter setup](https://krausefx.com/blog/how-i-use-twitter)\n"
  },
  {
    "path": "unfollow.rb",
    "content": "require 'twitter'\nrequire 'shellwords'\n\nclass Unfollow\n  def run\n    raise \"Please create a list called 'Old Follows'\" if old_follows_list.nil?\n    followings = client.following\n\n    followings.each do |user|\n      next if user.screen_name == \"KrauseFx\" # trolololol\n\n      puts \"Unfollowing user #{user.screen_name} (#{user.name})\"\n      client.add_list_member(old_follows_list, user.id)\n      client.unfollow(user.id)\n      `echo \"#{user.screen_name.shellescape}\" >> unfollowed_usernames.txt`\n      `echo \"#{user.screen_name.shellescape} (#{user.name.shellescape}): #{user.description.shellescape}\" >> unfollowed_full_names.txt`\n      sleep 1\n    end\n  end\n\n  def old_follows_list\n    @_old_follows_list ||= client.lists.find { |a| a.name == \"Old Follows\" }\n  end\n\n  def client\n    client = Twitter::REST::Client.new do |config|\n      config.consumer_key        = ENV[\"CONSUMER_KEY\"]\n      config.consumer_secret     = ENV[\"CONSUMER_SECRET\"]\n      config.access_token        = ENV[\"ACCESS_TOKEN\"]\n      config.access_token_secret = ENV[\"ACCESS_TOKEN_SECRET\"]\n    end\n  end\nend\n\nUnfollow.new.run\n"
  }
]