-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
85 lines (69 loc) · 2.59 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
import os
import dotenv
import argparse
import logging
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
logger = logging.getLogger('FolloRizz')
import instagram
igClient = instagram.User()
import menu
import inputs
def displayBanner():
print(" ___ ___ _ _ ___ ___ ___ ________")
print(" | __/ _ \| | | | / _ \| _ \_ _|_ /_ /")
print(" | _| (_) | |__| |_| (_) | /| | / / / / ")
print(" |_| \___/|____|____\___/|_|_\___/___/___|")
print(" ")
print(" Made with <3 by @gahrlt ")
print(" ")
def clearScreen():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
def app(parsedArgs):
#~ Initialize Instagram user
if parsedArgs.env:
env = {
**os.environ,
**dotenv.dotenv_values('.env'),
**dotenv.dotenv_values(parsedArgs.env)
}
igClient.login(
env['INSTAGRAM_USERNAME'], env['INSTAGRAM_PASSWORD'],
mfaSeed=env['INSTAGRAM_2FA_SEED'], sessionFile=f'{env.get("SESSION_FILE_PATH")}.json'
)
else:
igClient.login(
parsedArgs.username, parsedArgs.password,
mfaSeed=parsedArgs.twofseed, sessionFile=f'{parsedArgs.username}.json'
)
#~ Display menu
displayBanner()
print(f'Welcome @{igClient.username}! Here is the menu:')
nbOpts = menu.Home.display()
_, choice = print('What do you want to do?', end=' '), inputs.getInteger(1, nbOpts)
clearScreen()
displayBanner()
menu.Home.opts[choice - 1]['action']()
if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog="FolloRizz",
description='Utility tool to play with your Instagram account followers/following lists',
epilog='Made with <3 by @gahrlt'
)
#~ Only provide either username or env file
dataGroup = parser.add_mutually_exclusive_group(required=True)
dataGroup.add_argument('--username', '-u', help='Instagram username')
dataGroup.add_argument('--env', help='Environment file where credentials are stored')
parser.add_argument('--password', '-p', help='Instagram password', required=False)
parser.add_argument('--twofseed', '-2fa', '--2fa', '-mfa', '--mfa', help='2FA seed', required=False)
parser.add_argument('-v', '--verbose', help='Verbose mode', action='store_true')
args = parser.parse_args()
if args.verbose:
logger.setLevel(logging.DEBUG)
app(args)