-
Notifications
You must be signed in to change notification settings - Fork 4
/
InstaStats.py
145 lines (138 loc) · 9.9 KB
/
InstaStats.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
import os
import instaloader
import re
import pandas as pd
import colorama
from colorama import Fore
import sys
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bot = instaloader.Instaloader()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def Profile():
os.system('clear')
print(Fore.MAGENTA+"Profile:")
username = input(Fore.WHITE+"What is the exact username of the instagram account? >>> ")
profile = instaloader.Profile.from_username(bot.context, username)
print("Username: ", profile.username)
print("User ID: ", profile.userid)
print("Number of Posts: ", profile.mediacount)
print("Followers Count: ", profile.followers)
print("Following Count: ", profile.followees)
print("Bio: ", profile.biography)
print("External URL: ", profile.external_url)
input(Fore.RED+"Press Enter to continue...")
Start()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def Email():
os.system('clear')
print(Fore.MAGENTA+"Email:")
username = input(Fore.WHITE+"What is the exact username of the instagram account? >>> ")
profile = instaloader.Profile.from_username(bot.context, username)
print("Username: ", profile.username)
print("Bio: ", profile.biography)
emails = re.findall(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b", profile.biography)
print("Emails extracted from the bio:")
print(emails)
input(Fore.RED+"Press Enter to continue...")
Start()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def TopSearch():
os.system('clear')
print(Fore.MAGENTA+"Top Search:")
text = input(Fore.WHITE+'Type the word that you want the top search resulst for >>> ')
search_results = instaloader.TopSearchResults(bot.context, text)
print('')
print('Loading...')
print('')
for username in search_results.get_profiles():
print(username)
for hashtag in search_results.get_hashtags():
print(hashtag)
print('')
input(Fore.RED+"Press Enter to continue...")
Start()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def PostDownload():
os.system('clear')
print(Fore.MAGENTA+"Post Download:")
print('Careful when useing account, chance of disabling, use account that you are willing to risk a disable on')
print('')
username = input(Fore.WHITE+'Type in the username of the account to download data with >>> ')
print('')
password = input('Type in the password for that account >>> ')
print('')
UsernameTarget = input('Type in the username that you want to download the posts from >>> ')
os.system('clear')
print('')
print('Loading...')
print('')
bot.login(user=username,passwd=password)
profile = instaloader.Profile.from_username(bot.context, UsernameTarget)
posts = profile.get_posts()
for index, post in enumerate(posts, 1):
bot.download_post(post, target=f"{profile.username}_{index}")
print('')
input(Fore.RED+"Press Enter to continue...")
Start()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def FFExtracter():
os.system('clear')
print(Fore.MAGENTA+"Follower and Following Extractor:")
print('Careful when useing account, chance of disabling, use account that you are willing to risk a disable on')
print('')
username = input(Fore.WHITE+'Type in the username of the account to download data with >>> ')
print('')
password = input('Type in the password for that account >>> ')
print('')
bot.login(user=username,passwd=password)
UsernameTarget = input('Type in the username that you want to get the follwers and folling data from >>> ')
os.system('clear')
print('')
print('Loading...')
print('')
profile = instaloader.Profile.from_username(bot.context, UsernameTarget)
followers = [follower.username for follower in profile.get_followers()]
followers_df = pd.DataFrame(followers)
followers_df.to_csv('followers.csv', index=False)
followings = [followee.username for followee in profile.get_followees()]
followings_df = pd.DataFrame(followings)
followings_df.to_csv('followings.csv', index=False)
print('Done')
print('')
input(Fore.RED+"Press Enter to continue...")
Start()
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def Start():
os.system('clear')
print(Fore.MAGENTA+'█████████████████████████████████████████████████████████████████████████████████████████████████████████████████')
print('░░░░░░░░░░░░░░█░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░███░░░░░░░░░░░░░░█░░░░░░░░░░░░░░█░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░███')
print('░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀▄▀░░███░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀▄▀░░███')
print('░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░▄▀░░███░░▄▀░░░░░░▄▀░░█░░▄▀░░░░░░▄▀░░█░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░▄▀░░███')
print('░░▄▀░░█████████░░▄▀░░█████████░░▄▀░░████░░▄▀░░███░░▄▀░░██░░▄▀░░█░░▄▀░░██░░▄▀░░█░░▄▀░░█████████░░▄▀░░████░░▄▀░░███')
print('░░▄▀░░░░░░░░░░█░░▄▀░░█████████░░▄▀░░░░░░░░▄▀░░███░░▄▀░░░░░░▄▀░░█░░▄▀░░░░░░▄▀░░█░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░▄▀░░███')
print('░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀░░█████████░░▄▀▄▀▄▀▄▀▄▀▄▀░░███░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀▄▀░░███')
print('░░░░░░░░░░▄▀░░█░░▄▀░░█████████░░▄▀░░░░░░▄▀░░░░███░░▄▀░░░░░░▄▀░░█░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░░░█░░▄▀░░░░░░▄▀░░░░███')
print('████████░░▄▀░░█░░▄▀░░█████████░░▄▀░░██░░▄▀░░█████░░▄▀░░██░░▄▀░░█░░▄▀░░█████████░░▄▀░░█████████░░▄▀░░██░░▄▀░░█████')
print('░░░░░░░░░░▄▀░░█░░▄▀░░░░░░░░░░█░░▄▀░░██░░▄▀░░░░░░█░░▄▀░░██░░▄▀░░█░░▄▀░░█████████░░▄▀░░░░░░░░░░█░░▄▀░░██░░▄▀░░░░░░█')
print('░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀░░██░░▄▀▄▀▄▀░░█░░▄▀░░██░░▄▀░░█░░▄▀░░█████████░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀░░██░░▄▀▄▀▄▀░░█')
print('░░░░░░░░░░░░░░█░░░░░░░░░░░░░░█░░░░░░██░░░░░░░░░░█░░░░░░██░░░░░░█░░░░░░█████████░░░░░░░░░░░░░░█░░░░░░██░░░░░░░░░░█')
print('█████████████████████████████████████████████████████████████████████████████████████████████████████████████████')
print('')
print(Fore.CYAN + "1) Profile Details 2) Bio Email Finder 3) Top Search Result Finder 4) Post Download 5) Follower and Following Data Extracter 6) Main Menu")
#print(Fore.CYAN + "")
print('')
choice = int(input(Fore.WHITE + 'What program is being run? >>> '))
if((choice == 1)):
Profile()
elif((choice == 2)):
Email()
elif((choice == 3)):
TopSearch()
elif((choice == 4)):
PostDownload()
elif((choice == 5)):
FFExtracter()
elif((choice == 6)):
os.system('sudo python RAVAGE.py')
else:
Start()