-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
158 lines (129 loc) · 5.22 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy
import keys
import menu
from menu import Menu
from Twitter import Twitter
if __name__ == '__main__':
auth = tweepy.OAuthHandler(keys.consumer_key, keys.consumer_secret)
auth.set_access_token(keys.access_token, keys.access_token_secret)
api = tweepy.API(auth)
menu = Menu()
menu.blue_world()
usuario = menu.log_menu()
while not usuario:
print("Check that you put a screen name")
usuario = menu.log_menu()
user = api.get_user(usuario)
tw = Twitter(user, api)
menu.welcome_message()
menu.print_main_menu()
menu.set_main_menu_opt()
while menu.option != -1:
if menu.option == 0:
num_opt = 3
menu.print_user_menu()
menu.set_submenu_opt(num_opt-1)
while menu.suboption_menu != -1:
if menu.suboption_menu == 0:
print("More mentioned users by "+user.screen_name)
tw.more_mentioned()
menu.continue_()
menu.print_user_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 1:
print("Users who more mention "+user.screen_name)
tw.mentioners()
menu.continue_()
menu.print_user_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 2:
tw.relationship()
menu.continue_()
menu.print_user_menu()
menu.set_submenu_opt(num_opt-1)
menu.print_main_menu()
menu.set_main_menu_opt()
elif menu.option == 1:
num_opt = 3
menu.print_rt_menu()
menu.set_submenu_opt(num_opt-1)
while menu.suboption_menu != -1:
if menu.suboption_menu == 0:
print("Users more retweeted by "+user.screen_name)
tw.most_rtd_users()
menu.continue_()
menu.print_rt_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 1:
print("Users who most retweet "+user.screen_name)
tw.most_rters()
menu.continue_()
menu.print_rt_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 2:
print("Most retweeted tweets by " + user.screen_name)
tw.most_rted_tweets()
menu.continue_()
menu.print_rt_menu()
menu.set_submenu_opt(num_opt-1)
menu.print_main_menu()
menu.set_main_menu_opt()
elif menu.option == 2:
num_opt = 2
menu.print_fav_menu()
menu.set_submenu_opt(num_opt-1)
while menu.suboption_menu != -1:
if menu.suboption_menu == 0:
print("Users more favorited by "+user.screen_name)
tw.most_faved_users()
menu.continue_()
menu.print_fav_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 1:
print("Most faved tweets by "+user.screen_name)
tw.most_faved_tweets()
menu.continue_()
menu.print_fav_menu()
menu.set_submenu_opt(num_opt-1)
menu.print_main_menu()
menu.set_main_menu_opt()
elif menu.option == 3:
num_opt = 3
menu.print_follower_menu()
menu.set_submenu_opt(num_opt-1)
while menu.suboption_menu != -1:
if menu.suboption_menu == 0:
print("Users who does not follow back "+user.screen_name)
my_followers = api.followers_ids(user.id)
my_fol_sn = tw.get_screen_names(my_followers)
tw.not_follow_back(my_fol_sn)
menu.continue_()
menu.print_follower_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 1:
print(user.screen_name+"\'s new followers")
tw.new_followers()
menu.continue_()
menu.print_follower_menu()
menu.set_submenu_opt(num_opt-1)
elif menu.suboption_menu == 2:
print("Last unfollows of "+user.screen_name)
tw.who_unfollowed()
menu.continue_()
menu.print_follower_menu()
menu.set_submenu_opt(num_opt-1)
menu.print_main_menu()
menu.set_main_menu_opt()
elif menu.option == 4:
num_opt = 1
menu.extra()
menu.set_submenu_opt(num_opt-1)
while menu.suboption_menu != -1:
menu.set_submenu_opt(num_opt-1)
menu.print_main_menu()
menu.set_main_menu_opt()
if menu.option == -1:
menu.print_exit_log()
menu.normal_world()