Created
August 20, 2018 15:30
-
-
Save cat-in-136/c593874dce597cfc6d1d09568e6b55b1 to your computer and use it in GitHub Desktop.
migrate twitter timeline to list https://twitter.com/cat_in_136/status/1030436058272428033
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
# Created by https://www.gitignore.io/api/vim,emacs,ruby | |
### Emacs ### | |
# -*- mode: gitignore; -*- | |
*~ | |
\#*\# | |
/.emacs.desktop | |
/.emacs.desktop.lock | |
*.elc | |
auto-save-list | |
tramp | |
.\#* | |
# Org-mode | |
.org-id-locations | |
*_archive | |
# flymake-mode | |
*_flymake.* | |
# eshell files | |
/eshell/history | |
/eshell/lastdir | |
# elpa packages | |
/elpa/ | |
# reftex files | |
*.rel | |
# AUCTeX auto folder | |
/auto/ | |
# cask packages | |
.cask/ | |
dist/ | |
# Flycheck | |
flycheck_*.el | |
# server auth directory | |
/server/ | |
# projectiles files | |
.projectile | |
# directory configuration | |
.dir-locals.el | |
### Ruby ### | |
*.gem | |
*.rbc | |
/.config | |
/coverage/ | |
/InstalledFiles | |
/pkg/ | |
/spec/reports/ | |
/spec/examples.txt | |
/test/tmp/ | |
/test/version_tmp/ | |
/tmp/ | |
# Used by dotenv library to load environment variables. | |
# .env | |
## Specific to RubyMotion: | |
.dat* | |
.repl_history | |
build/ | |
*.bridgesupport | |
build-iPhoneOS/ | |
build-iPhoneSimulator/ | |
## Specific to RubyMotion (use of CocoaPods): | |
# | |
# We recommend against adding the Pods directory to your .gitignore. However | |
# you should judge for yourself, the pros and cons are mentioned at: | |
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | |
# | |
# vendor/Pods/ | |
## Documentation cache and generated files: | |
/.yardoc/ | |
/_yardoc/ | |
/doc/ | |
/rdoc/ | |
## Environment normalization: | |
/.bundle/ | |
/vendor/bundle | |
/lib/bundler/man/ | |
# for a library or gem, you might want to ignore these files since the code is | |
# intended to run in multiple environments; otherwise, check them in: | |
# Gemfile.lock | |
# .ruby-version | |
# .ruby-gemset | |
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | |
.rvmrc | |
### Vim ### | |
# Swap | |
[._]*.s[a-v][a-z] | |
[._]*.sw[a-p] | |
[._]s[a-rt-v][a-z] | |
[._]ss[a-gi-z] | |
[._]sw[a-p] | |
# Session | |
Session.vim | |
# Temporary | |
.netrwhist | |
# Auto-generated tag files | |
tags | |
# Persistent undo | |
[._]*.un~ | |
# End of https://www.gitignore.io/api/vim,emacs,ruby |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
#git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem "twitter" |
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
# frozen_string_literal: true | |
require 'readline' | |
require 'twitter' | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = ENV["TWITTER_CONSUMER_KEY"] || Readline.readline("Consumer Key:") | |
config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"] || Readline.readline("Consumer Secret:") | |
config.access_token = ENV["TWITTER_ACCESS_TOKEN"] || Readline.readline("Access Token:") | |
config.access_token_secret = ENV["TWITTER_ACCESS_TOKEN_SECRET"] || Readline.readline("Access Token Secret:") | |
end | |
timeline_list = client.list('timeline') # TODO create "timeline" list manually in advance. | |
client.friends.each do |user| | |
$stdout << "@#{user.screen_name} ... " | |
client.add_list_member(timeline_list, user) | |
$stdout << "Added\n" | |
sleep 0.5 | |
end | |
$stdout << "Done.\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment