Created
October 27, 2018 13:12
-
-
Save tpdn/3a09305f40df3418a5aa5e118274022d to your computer and use it in GitHub Desktop.
ガンバリ事務次長クリーナー
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
import twitter | |
from pprint import pprint as pp | |
from time import sleep | |
# 1. twitterから全ツイートを取得する | |
# 2. grep \#ガンバリ事務次長 tweets.csv | grep IFTTT | cut -d ',' -f 1 | tr -d \" > gambari.txt | |
# 3. このスクリプト実行 | |
# twitterのアクセスキー等を設定する | |
auth = twitter.OAuth(consumer_key='', | |
consumer_secret='', | |
token='', | |
token_secret='') | |
with open('gambari.txt', 'r') as f: | |
ids = [int(x.rstrip('\r\n')) for x in f.readlines()] | |
t = twitter.Twitter(auth=auth) | |
for x in ids: | |
try: | |
response = t.statuses.destroy(id=x) | |
except twitter.TwitterHTTPError as _e: | |
continue | |
pp({'id': x, 'text': response['text']}) | |
sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment