LoginSignup
6
5

More than 5 years have passed since last update.

リプ爆撃

Last updated at Posted at 2013-05-28

コードを見れば、わかる人はわかると思うので、何やってるかは聞かないでください。
中二みたいなことやってごめんなさい。正直反省してない。

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy
import re
import time

KEYFILE='keys'
TARGET='@???' # 爆撃相手

def getAuth():
    keys={}
    for l in open(KEYFILE):
        ll=re.sub('#.*','',l)
        a=ll.split(':')
        if len(a)>=2:
            keys[a[0].strip().lower()]=a[1].strip()
    auth=tweepy.OAuthHandler(keys['consumer_key'],keys['consumer_secret'])
    auth.set_access_token(keys['access_token'],keys['access_token_secret'])
    return auth

def tweet(api,x):
    api.update_status(TARGET+' '+x)

def tweetmain(api):
    for _ in xrange(1):
        for i in xrange(20):
            s=' '*i+u'⊂二二二( ^ω^)二⊃'+(u'ブーン' if i==0 else '')
            print s
            tweet(api,s)
            time.sleep(2)
        for i in xrange(20,0,-1):
            s=' '*i+u'⊂二( ^ω^)二二二⊃'+(u'ブーン' if i==20 else '')
            print s
            tweet(api,s)
            time.sleep(2)

def main():
    auth=getAuth()
    api=tweepy.API(auth)
    tweetmain(api)

if __name__=='__main__':
    main()
6
5
3

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
6
5