forked from MasterChenb0x/TwitterWordPhrequency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitfunctions.py
executable file
·62 lines (51 loc) · 1.96 KB
/
twitfunctions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
import sys
from twython import Twython
#-- Twitter instance setup
TWITTER = open("TwiTokens.txt", "r").read().splitlines()
apiKey = TWITTER[0]
apiSecret = TWITTER[1]
accessToken = TWITTER[2]
accessTokenSecret = TWITTER[3]
api = Twython(apiKey,apiSecret,accessToken,accessTokenSecret)
#--
def getUserInfobyID(userid):
"""
Returns info on user passed to the function as a dictionary object.
"""
# Difference between lookup_user and show_user is list vs dictionary. Not sure on benefits of either yet.
return api.show_user(user_id=userid)
def getUserInfobyName(username):
"""
Returns info on user passed to the function as a dictionary object.
"""
# Difference between lookup_user and show_user is list vs dictionary. Not sure on benefits of either yet.
return api.show_user(screen_name=username)
def getFollowersbyName(username):
"""
return a list of followers of the username passed as an argument as a dictionary object.
"""
return api.get_followers_ids(screen_name=username)
def getFollowersbyID(userid):
"""
return a list of followers of the username passed as an argument as a dictionary object.
"""
return api.get_followers_ids(user_id=userid)
def getFriendsbyName(username):
"""
return a list of "friends"; people the username follows as a dictionary object.
"""
return api.get_friends_ids(screen_name=username)
def getFriendsbyID(userid):
"""
return a list of "friends"; people the username follows as a dictionary object.
"""
return api.get_friends_ids(user_id=userid)
def getUserTimeline(username: str, count: int):
"""
return a list of the latest tweets.
"""
return api.get_user_timeline(screen_name=username, count=count)
if __name__ == "__main__":
print("This is a supporting file. Please run stalkerbot.py, or antistalkerbot.py.")
sys.exit()