Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import re
  4. from twitter import *
  5. from keys import *
  6.  
  7. auth = OAuth ( TOKEN , TOKEN_SECRET , CONSUMER_KEY , CONSUMER_SECRET )
  8. t = Twitter ( auth = auth )
  9.  
  10. twitter_stream = TwitterStream ( auth = auth , domain="userstream.twitter.com" )
  11. iterator = twitter_stream.user ( )
  12.  
  13. p=re.compile(u"[ぁ-んァ-ヴ]{2,6}さん|[一-龠々]{2,6}さん")
  14.  
  15. for msg in iterator:
  16. if "in_reply_to_screen_name" in msg and "text" in msg:
  17. if msg["in_reply_to_screen_name"] == "k_bitter11":
  18. matchOB=p.search(msg["text"])
  19. if matchOB:
  20. t.account.update_profile ( name = matchOB.group()[0:-2])
  21. t.statuses.update ( status = "@" + msg["user"]["screen_name"] + " 名前を " + matchOB.group()[0:-2] + " に変更しました。" , in_reply_to_status_id = msg["id"] )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement