Skip to content

Instantly share code, notes, and snippets.

@ryosuke-hujisawa
Last active August 11, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryosuke-hujisawa/9c0d774f54dcf90e5d4cd3fcd67c26d3 to your computer and use it in GitHub Desktop.
Save ryosuke-hujisawa/9c0d774f54dcf90e5d4cd3fcd67c26d3 to your computer and use it in GitHub Desktop.
Find the someone who posted the tweet with the tag "# Eminem". After that, favorite the Tweet and than follow the user who tweeted it.
"""
#
#
#
# - mac os local
# - Python 3.5.0
#
#
#
"""
import time
import tweepy
import sys
"""
#
#
#自分をフォローしているユーザーを取得する
#Someone who is follow me
#
#
"""
CONSUMER_KEY = 'fzTUU7B7Aul'
CONSUMER_SECRET = 'aSsWsw4RpN5R2MYDJIA'
ACCESS_TOKEN = '816184364203589632PJIZ'
ACCESS_TOKEN_SECRET = 'hoxQCZGPbOLtBTSrMSO'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
"""
#
#
#
#
# Find the someone who posted the tweet with the tag "# Eminem".
# After that, favorite the Tweet and than follow the user who tweeted it.
#
#
#
#タグ "#Eminem"でツイートを投稿した人を探す。その後、
#そのツイートをファボしてそれをツイートしたユーザーをFollowする
#
#
#
#
"""
search = api.search(q='#eminem',lang='en',count=2)
for s in search:
try:
print(s.author._json['screen_name'])
print("follow done")
api.create_friendship(s.author._json['screen_name'])
print(s.text)
print("favorite done")
api.create_favorite(s.id)
except:
print("you already have followers or favo that")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment