LoginSignup
4
3

More than 5 years have passed since last update.

力の限り「バルス」をつぶやき続けるpythonコード

Last updated at Posted at 2016-01-15

梢の金曜ロードショーは,恒例のバルス祭りということで,
バルスをツイートするpythonコードを作成しました.
twitterのAPIの制限は,15分180回ということなので,
プログラムを実行すると,その制限の限り「バルス」とつぶやき続けます.
最後の180回めには,なんとムスカが叫びます〜!

それでは,天空の城ラピュタ楽しみましょう〜!

tweetBalse.py
# coding=utf-8
import time
import tweepy

consumer_key = '****'
consumer_secret = '****'
access_key = '****'
access_secret = '****'

comment = 'バルス'
last_comment = '目が、目がぁ~〜〜〜〜〜〜〜〜!!!!!!! '
exclamation = '!'
counter = 179

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# set access token to OAuth handler
auth.set_access_token(access_key, access_secret)
# create API
api = tweepy.API(auth_handler=auth)

for var in range(counter):
    api.update_status(comment)
    if len(comment) >= 140:
        comment = 'バルス'
    comment+=exclamation
    print comment
    time.sleep(0.1)

api.update_status(last_comment)
print last_comment
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3