Last active
December 4, 2015 03:44
-
-
Save Momijinn/0a4e903aee710f74445a to your computer and use it in GitHub Desktop.
pythonでTwitter自動フォロー
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
Create date: 2015/10/11 | |
implementafor: K.Takano | |
HP: http://miyakawamomiji.blogspot.jp/ | |
''' | |
from twitter import * | |
def Initialize(): | |
#あなたのツイッターIDを記入 | |
your_twitter_id = "@Your_twitterID" #(ex)"momijinn_aka" | |
#OAuth ToolからもらえるKeyなどを入力 | |
consumerKey = "Consumer key" | |
consumerSecret = "Consumer secret" | |
accessToken = "Access token" | |
accessSecret = "Access token secret" | |
return Twitter(auth=OAuth(accessToken, accessSecret, consumerKey, consumerSecret)),your_twitter_id | |
pass | |
def main(tw, your_id): | |
followers = tw.followers.list(screen_name=your_id, count=200) | |
for fw in followers['users']: | |
name = fw['screen_name'] | |
if fw['following']: | |
pass | |
else: | |
tw.friendships.create(screen_name=name) | |
pass | |
pass | |
pass | |
if __name__ == '__main__': | |
tw,your_id = Initialize() | |
main(tw, your_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python3でTwitter自動フォロー
Twitter Auto Follow us on Python3