-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAccountModifier.py
81 lines (65 loc) · 2.33 KB
/
AccountModifier.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
# modifys telegram accounts profile and name from sessions
from scrapers.clients import TGClient
from config import api_hash,api_id
from telethon.sessions import StringSession
import requests
import csv
import json
from random import randint
import urllib.request
def get_sessions(filename):
'''
returns -> list of string_sessions stored in session_ids.csv
'''
session_strs = list()
with open(filename,'r',encoding='utf8',newline="") as file:
reader = csv.reader(file)
for row in reader:
session_strs.append(row[-1])
return session_strs[1:len(session_strs)]
def get_client(str_session):
'''
returns -> telethon client
'''
return TGClient(StringSession(str_session),api_id=api_id,api_hash=api_hash)
def get_new_face()->list:
'''
return filtered list of urls of all the faces
'''
api_key = "cX_tKbeWJZ2B-w0Krl3gKA"
page_counter = 0 #page number to retrive, since output is not random , to make it ranadom changing the page number
face_urls = list()
r = requests.get(f"https://api.generated.photos/api/v1/faces?gender=female",headers={"Authorization":f"API-Key {api_key}"})
data = json.loads((r.content).decode("utf-8"))
for faces in data["faces"]:
url = faces["urls"][-1]["512"]
face_urls.append(url)
return face_urls
def generate_name():
names = ["Alisha","Melyna","Maria","Camille","Leanne","Annetta"]
i = 0
while True:
if(i>=len(names)):
i=0
yield(names[i])
i+=1
if __name__=='__main__':
name_gen = generate_name()
sessions = get_sessions('session_ids.csv')
faces = get_new_face()
image_counter = 1
for session in sessions:
print(session)
client = get_client(session)
try:
name = name_gen.__next__()
image = f"/images/{image_counter+1}.jpg"
client.update_picture(image)
client.update_profile(f"{name[0]} | WealthMonks","(VSCALE)","SENIOR CONSULTANT 👉🏻 @vscaleconsulting 👈🏻")
image_counter+=1
if(image_counter==6):
image_counter = 1
client.join("salesreps")
client.send_message('@vaishavdhepe', "Account Generated")
except:
continue