L

ttcpr5

public
lamdayne1 Aug 07, 2024 Never 31
Clone
Python ttcpr5 353 lines (328 loc) | 17.62 KB
1
import requests,json
2
import uuid
3
import os
4
from time import sleep
5
from datetime import datetime
6
from datetime import date
7
from pystyle import Write,Colors
8
listuid = []
9
listcookie = []
10
class ApiPro5:
11
def __init__(self, cookies,fb_dtsg,jazoet,id_page) -> None:
12
self.headers = {
13
'authority': 'www.facebook.com',
14
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
15
'accept-language': 'vi',
16
'cookie': cookies,
17
'sec-ch-prefers-color-scheme': 'light',
18
'sec-ch-ua': '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"',
19
'sec-ch-ua-mobile': '?0',
20
'sec-ch-ua-platform': '"Windows"',
21
'sec-fetch-dest': 'document',
22
'sec-fetch-mode': 'navigate',
23
'sec-fetch-site': 'none',
24
'sec-fetch-user': '?1',
25
'upgrade-insecure-requests': '1',
26
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36',
27
'viewport-width': '1366',
28
}
29
url_profile = requests.get('https://www.facebook.com/me', headers=self.headers).url
30
profile = requests.get(url_profile, headers=self.headers).text
31
self.fb_dtsg = fb_dtsg
32
self.jazoet = jazoet
33
self.user_id = id_page
34
def join(self, group_id):
35
data = {
36
'fb_dtsg': self.fb_dtsg,
37
'jazoest': self.jazoet,
38
'fb_api_caller_class': 'RelayModern',
39
'fb_api_req_friendly_name': 'GroupCometJoinForumMutation',
40
'variables': '{"feedType":"DISCUSSION","groupID":"'+group_id+'","imageMediaType":"image/x-auto","input":{"action_source":"GROUPS_ENGAGE_TAB","attribution_id_v2":"GroupsCometCrossGroupFeedRoot.react,comet.groups.feed,tap_tabbar,1667116100089,433821,2361831622,","group_id":"'+group_id+'","group_share_tracking_params":null,"actor_id":"'+self.user_id+'","client_mutation_id":"2"},"inviteShortLinkKey":null,"isChainingRecommendationUnit":false,"isEntityMenu":false,"scale":1,"source":"GROUPS_ENGAGE_TAB","renderLocation":"group_mall","__relay_internal__pv__GlobalPanelEnabledrelayprovider":false,"__relay_internal__pv__GroupsCometEntityMenuEmbeddedrelayprovider":true}',
41
'server_timestamps': 'true',
42
'doc_id': '5915153095183264',
43
}
44
45
response = requests.post('https://www.facebook.com/api/graphql/', headers=self.headers, data=data).text
46
return response
47
def reaction(self, id_post, reaction):
48
try:
49
url = requests.get('https://www.facebook.com/'+id_post, headers=self.headers).url
50
home = requests.get(url, headers=self.headers).text
51
feedback_id = home.split('{"__typename":"CommentComposerLiveTypingBroadcastPlugin","feedback_id":"')[1].split('","')[0]
52
data = {
53
'fb_dtsg': self.fb_dtsg,
54
'jazoest': self.jazoet,
55
'fb_api_caller_class': 'RelayModern',
56
'fb_api_req_friendly_name': 'CometUFIFeedbackReactMutation',
57
'variables': '{"input":{"attribution_id_v2":"ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,via_cold_start,1667106623951,429237,190055527696468,","feedback_id":"'+feedback_id+'","feedback_reaction_id":"'+reaction+'","feedback_source":"PROFILE","is_tracking_encrypted":true,"tracking":["AZXg8_yM_zhwrTY7oSTw1K93G-sycXrSreRnRk66aBJ9mWkbSuyIgNqL0zHEY_XgxepV1XWYkuv2C5PuM14WXUB9NGsSO8pPe8qDZbqCw5FLQlsGTnh5w9IyC_JmDiRKOVh4gWEJKaTdTOYlGT7k5vUcSrvUk7lJ-DXs3YZsw994NV2tRrv_zq1SuYfVKqDboaAFSD0a9FKPiFbJLSfhJbi6ti2CaCYLBWc_UgRsK1iRcLTZQhV3QLYfYOLxcKw4s2b1GeSr-JWpxu1acVX_G8d_lGbvkYimd3_kdh1waZzVW333356_JAEiUMU_nmg7gd7RxDv72EkiAxPM6BA-ClqDcJ_krJ_Cg-qdhGiPa_oFTkGMzSh8VnMaeMPmLh6lULnJwvpJL_4E3PBTHk3tIcMXbSPo05m4q_Xn9ijOuB5-KB5_9ftPLc3RS3C24_7Z2bg4DfhaM4fHYC1sg3oFFsRfPVf-0k27EDJM0HZ5tszMHQ"],"session_id":"'+str(uuid.uuid4())+'","actor_id":"'+self.user_id+'","client_mutation_id":"1"},"useDefaultActor":false,"scale":1}',
58
'server_timestamps': 'true',
59
'doc_id': '5703418209680126',
60
}
61
62
reaction = requests.post('https://www.facebook.com/api/graphql/', headers=self.headers, data=data).text
63
return {'status': True, 'url': url}
64
except:
65
return {'status': False, 'url': url}
66
def subscribe(self, uid):
67
data = {
68
'fb_dtsg': self.fb_dtsg,
69
'jazoest': self.jazoet,
70
'fb_api_caller_class': 'RelayModern',
71
'fb_api_req_friendly_name': 'CometUserFollowMutation',
72
'variables': '{"input":{"attribution_id_v2":"ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,via_cold_start,1667114418950,431532,190055527696468,","subscribe_location":"PROFILE","subscribee_id":"'+uid+'","actor_id":"'+self.user_id+'","client_mutation_id":"1"},"scale":1}',
73
'server_timestamps': 'true',
74
'doc_id': '5032256523527306',
75
}
76
subscribe = requests.post('https://www.facebook.com/api/graphql/', headers=self.headers, data=data).text
77
return subscribe
78
79
80
def get_page(cookie):
81
headers = {
82
'authority': 'mbasic.facebook.com',
83
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
84
'accept-language': 'vi,en;q=0.9,vi-VN;q=0.8,fr-FR;q=0.7,fr;q=0.6,en-US;q=0.5',
85
'cache-control': 'max-age=0',
86
'cookie': cookie,
87
'origin': 'https://www.facebook.com',
88
'referer': 'https://www.facebook.com',
89
'sec-ch-ua': '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
90
'sec-ch-ua-mobile': '?0',
91
'sec-ch-ua-platform': '"Windows"',
92
'sec-fetch-dest': 'document',
93
'sec-fetch-mode': 'navigate',
94
'sec-fetch-site': 'none',
95
'sec-fetch-user': '?1',
96
'upgrade-insecure-requests': '1',
97
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
98
}
99
response = requests.get('https://mbasic.facebook.com/',headers=headers).text
100
fb_dtsg = response.split('<input type="hidden" name="fb_dtsg" value="')[1].split('"')[0]
101
jazoest = response.split('<input type="hidden" name="jazoest" value="')[1].split('"')[0]
102
idpef = requests.post('https://www.facebook.com/api/graphql/', headers=headers, data={'fb_dtsg': fb_dtsg,'jazoest': jazoest,'variables': '{"showUpdatedLaunchpointRedesign":true,"useAdminedPagesForActingAccount":false,"useNewPagesYouManage":true}','doc_id': '5300338636681652'}).json()
103
a = idpef['data']['viewer']['actor']['profile_switcher_eligible_profiles']['nodes']
104
sl = 0
105
for b in a:
106
sl +=1
107
uid = b['profile']['id']
108
name = b['profile']['name']
109
delegate_page_id = b['profile']['delegate_page_id']
110
Write.Print(f" PAGE : {sl} | ID : {uid} | Name : {name}\n",Colors.green_to_yellow,interval=0.0001)
111
return a
112
113
def cauhinh(id, cookie,name):
114
url = 'https://tuongtaccheo.com/cauhinh/datnick.php'
115
data = f'iddat%5B%5D={id}&loai=fb'
116
head ={
117
'Host':'tuongtaccheo.com',
118
'accept':'*/*',
119
'user-agent':'Mozilla/5.0 (Linux; Android 8.1.0; CPH1912 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.91 Mobile Safari/537.36',
120
'content-type':'application/x-www-form-urlencoded; charset=UTF-8',
121
'cookie':f'{cookie}'
122
}
123
ve = requests.post(url= url, headers= head , data= data).text
124
if ve == '1' :
125
Write.Print(f'Cấu Hình | ID : {id} | Name : {name}\n',Colors.green_to_yellow,interval=0.0001)
126
else :
127
Write.Print(f'Bạn Chưa Thêm {id} Vào Cấu Hình\n',Colors.green_to_red,interval=0.0001)
128
exit()
129
def get_job(loai,cookie):
130
head = {
131
'Host':'tuongtaccheo.com',
132
'accept':'application/json, text/javascript, */*; q=0.01',
133
'user-agent':'Mozilla/5.0 (Linux; Android 8.1.0; CPH1912 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.91 Mobile Safari/537.36',
134
'cookie':f'{cookie}',
135
'x-requested-with':'XMLHttpRequest'
136
}
137
get_nv = requests.get(f'https://tuongtaccheo.com/kiemtien{loai}getpost.php',headers=head)
138
return get_nv
139
140
def nhanxu(cookie,loai,data) :
141
url = f'https://tuongtaccheo.com/kiemtien{loai}nhantien.php'
142
143
head = {
144
'Host':'tuongtaccheo.com',
145
'accept':'*/*',
146
'x-requested-with':'XMLHttpRequest',
147
'user-agent':'Mozilla/5.0 (Linux; Android 8.1.0; CPH1912 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.91 Mobile Safari/537.36',
148
'content-type':'application/x-www-form-urlencoded; charset=UTF-8',
149
'referer':f'https://tuongtaccheo.com/kiemtien{loai}',
150
'cookie':f'{cookie}'
151
}
152
153
nhan = requests.post(url= url, headers= head , data= data)
154
return nhan
155
156
def get_cookie_ttc(token) :
157
data = {
158
'access_token': token
159
}
160
text_1 = requests.post("https://tuongtaccheo.com/logintoken.php", data= data)
161
log = text_1.json()["status"]
162
if log == "success" :
163
xu = text_1.json()["data"]["sodu"]
164
name = text_1.json()["data"]["user"]
165
Write.Print('Đăng Nhập Thành Công ',Colors.green_to_yellow,interval=0.0001,end='\r')
166
Write.Print(f'Account TTC: {name} | Coin: {xu}\n',Colors.green_to_yellow,interval=0.0001)
167
cookie = text_1.headers["Set-Cookie"]
168
169
else :
170
Write.Print('Đăng Nhập Thất Bại\n',Colors.green_to_red,interval=0.0001)
171
exit()
172
return cookie
173
174
def get_data(cookie):
175
headers = {
176
'authority': 'mbasic.facebook.com',
177
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
178
'accept-language': 'en-US,en;q=0.9',
179
'cache-control': 'max-age=0',
180
'cookie': cookie,
181
'sec-ch-ua': '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
182
'sec-ch-ua-mobile': '?0',
183
'sec-ch-ua-platform': '"Windows"',
184
'sec-fetch-dest': 'document',
185
'sec-fetch-mode': 'navigate',
186
'sec-fetch-site': 'none',
187
'sec-fetch-user': '?1',
188
'upgrade-insecure-requests': '1',
189
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
190
}
191
192
response = requests.get('https://mbasic.facebook.com/',headers=headers).text
193
fb_dtsg = response.split('<input type="hidden" name="fb_dtsg" value="')[1].split('"')[0]
194
jazoet = response.split('<input type="hidden" name="jazoest" value="')[1].split('"')[0]
195
return json.dumps({'fb_dtsg':fb_dtsg,'jazoet':jazoet})
196
197
def xu_tt(cookie) :
198
head = {
199
'Host':'tuongtaccheo.com',
200
'user-agent':'Mozilla/5.0 (Linux; Android 8.1.0; CPH1912 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.91 Mobile Safari/537.36',
201
'content-type':'application/x-www-form-urlencoded; charset=UTF-8',
202
'cookie':cookie
203
}
204
response = requests.get('https://tuongtaccheo.com/home.php',headers=head).text
205
xu = response.split('<li><a>Số dư: <strong style="color: red;" id="soduchinh">')[1].split('<')[0]
206
return xu
207
208
def chon_job(so,ttt) :
209
if ttt == 3 :
210
ttt -= 3
211
212
if so == 1 :
213
loai = "/subcheo/"
214
elif so == 2 :
215
loai = "/camxuccheo/"
216
elif so == 3 :
217
loai = "/thamgianhomcheo/"
218
else :
219
type_5 = ['/subcheo/','/camxuccheo/','/thamgianhomcheo/']
220
loai = type_5[ttt]
221
return loai
222
223
224
def type_cx(type_1) :
225
if type_1 == "LOVE" :
226
type_2 = '1678524932434102'
227
elif type_1 == "CARE" :
228
type_2 = '613557422527858'
229
elif type_1 == "WOW" :
230
type_2 = '478547315650144'
231
elif type_1 == "HAHA" :
232
type_2 = '115940658764963'
233
elif type_1 == "SAD" :
234
type_2 = '908563459236466'
235
elif type_1 == "ANGRY" :
236
type_2 = '444813342392137'
237
return type_2
238
239
240
os.system("cls" if os.name == "nt" else "clear")
241
token = Write.Input('Nhập Access_Token TTC: ',Colors.green_to_yellow,interval=0.0001)
242
cookie_ttc = get_cookie_ttc(token)
243
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
244
cookie = str(Write.Input('Nhập Cookie Facebook: ',Colors.green_to_yellow,interval=0.0002))
245
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
246
#### vào việc
247
get_tt_page = get_page(cookie)
248
a = int(Write.Input('Chạy Page Thứ: ',Colors.green_to_yellow,interval=0.0001))
249
chon = a-1
250
dl = int(Write.Input('Nhập Delay: ',Colors.green_to_yellow,interval=0.0002))
251
252
id_page = get_tt_page[chon]['profile']['id']
253
name = get_tt_page[chon]['profile']['name']
254
ck_pro5 = 'sb={}; datr={}; c_user={}; wd={}; xs={}; fr={}; i_user={};'.format(cookie.split('sb=')[1].split(';')[0], cookie.split('datr=')[1].split(';')[0], cookie.split('c_user=')[1].split(';')[0],cookie.split('wd=')[1].split(';')[0], cookie.split('xs=')[1].split(';')[0],cookie.split('fr=')[1].split(';')[0],id_page)
255
##chọn job
256
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
257
Write.Print('[1 : FOLLOW — 2 : REACTION — 3 : PAGE]\n',Colors.green_to_white,interval=0.0001)
258
Write.Print('Có Thể Chọn Nhiều Nhiệm Vụ (Ví Dụ 123...)\n',Colors.green_to_white,interval=0.0001)
259
so = int(Write.Input('Chọn Job : ',Colors.green_to_white,interval=0.0001))
260
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
261
os.system("cls" if os.name == "nt" else "clear")
262
get_cookie_ttc(token)
263
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
264
cauhinh(id_page, cookie_ttc, name)
265
Write.Print("────────────────────────────────────────────────────────────\n",Colors.green_to_yellow,interval=0.0001)
266
tt = 0
267
data = get_data(cookie)
268
fb_dtsg = json.loads(data)['fb_dtsg']
269
jazoet = json.loads(data)['jazoet']
270
fb = ApiPro5(cookies=ck_pro5, fb_dtsg=fb_dtsg, jazoet=jazoet,id_page=id_page)
271
ttt = 0
272
while True :
273
loai = chon_job(so,ttt)
274
ttt+= 1
275
Write.Print("Đang Get Job\n",Colors.green_to_blue,interval=0.0001,end="\r")
276
if loai == "/subcheo/" :
277
list_job = get_job(loai,cookie_ttc)
278
b = list_job.text
279
a = list_job.json()
280
if b == "[]" :
281
Write.Print(" Hết Job Follow\n",Colors.green_to_red,interval=0.0001,end="\r")
282
else :
283
for list_job_ in a :
284
id_job = list_job_["idpost"]
285
286
fb.subscribe(id_job)
287
data = f'id={id_job}'
288
nhan = nhanxu(cookie_ttc,loai,data).json()
289
xu_1 = xu_tt(cookie_ttc)
290
try :
291
a = nhan["error"]
292
Write.Print(f"[X] {subscribe} | ERROR | {id_job}\n",Colors.green_to_red,interval=0.0001,end="\r")
293
except :
294
gio = datetime.now().strftime("%H:%M:%S")
295
tt += 1
296
Write.Print (f'{tt} | {gio} | Follow | {id_job} | +600 | {xu_1} Xu\n',Colors.green_to_yellow,interval=0.0001)
297
for i in range(dl,-1,-1):
298
Write.Print(f'[ASCII] [{i}]',Colors.green_to_yellow,interval=0.0001,end='\r')
299
sleep(1)
300
301
elif loai == "/thamgianhomcheo/" :
302
list_job = get_job(loai,cookie_ttc)
303
b = list_job.text
304
a = list_job.json()
305
if b == "[]" :
306
Write.Print("Hết Job Group\n",Colors.green_to_red,interval=0.0001,end="\r")
307
else :
308
for list_job_ in a :
309
id_job = list_job_["idpost"]
310
lam = fb.join(id_job)
311
data = f"id={id_job}"
312
nhan = nhanxu(cookie_ttc,loai,data)
313
nhan_2 = nhan.json()
314
xu_1 = xu_tt(cookie_ttc)
315
316
try :
317
a = nhan_2["error"]
318
Write.Print(f'[X] | {GROUP} | ERROR | {id_job} \n',Colors.green_to_red,interval=0.0001,end="\r")
319
except :
320
tt += 1
321
gio = datetime.now().strftime("%H:%M:%S")
322
Write.Print(f'{tt} | {gio} | GROUP | {id_job} | +1200 | {xu_1} Xu\n',Colors.green_to_yellow,interval=0.0001)
323
for i in range(dl,-1,-1):
324
Write.Print(f'[ASCII] [{i}]',Colors.green_to_yellow,interval=0.0001,end='\r')
325
sleep(1)
326
elif loai == "/camxuccheo/" :
327
list_job = get_job(loai,cookie_ttc)
328
b = list_job.text
329
a = list_job.json()
330
if b == "[]" :
331
Write.Print("Hết Job Cảm Xúc\n",Colors.green_to_red,interval=0.0001,end="\r")
332
else :
333
for list_job_ in a :
334
id_job = list_job_["idpost"]
335
336
type_1 = list_job_["loaicx"]
337
type_2 = type_cx(type_1)
338
lam = fb.reaction(id_job, type_2)
339
data = f"id={id_job}&loaicx={type_1}"
340
nhan = nhanxu(cookie_ttc,loai,data)
341
nhan_2 = nhan.json()
342
xu_1 = xu_tt(cookie_ttc)
343
344
try :
345
a = nhan_2["error"]
346
Write.Print(f'[X] | {type_1} | ERROR | {id_job} \n',Colors.green_to_red,interval=0.0001,end="\r")
347
except :
348
tt += 1
349
gio = datetime.now().strftime("%H:%M:%S")
350
Write.Print(f'{tt} | {gio} | {type_1} | {id_job} | +400 | {xu_1} Xu\n',Colors.green_to_yellow,interval=0.0001)
351
for i in range(dl,-1,-1):
352
Write.Print(f'[ASCII] [{i}]',Colors.green_to_yellow,interval=0.0001,end='\r')
353
sleep(1)