Изменена структура из-за ограничений телеги
This commit is contained in:
parent
b4449eeda2
commit
11c8a1bd57
51
data/main.py
51
data/main.py
|
@ -1,7 +1,6 @@
|
||||||
import json
|
import json
|
||||||
from xlwt import Workbook
|
from xlwt import Workbook
|
||||||
import xlwt
|
import xlwt
|
||||||
import config
|
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio
|
||||||
from my_functions import *
|
from my_functions import *
|
||||||
|
@ -12,11 +11,9 @@ api_hash = config.api_hash
|
||||||
session = 'session.session'
|
session = 'session.session'
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
try:
|
|
||||||
# Получаем чат пользователя, проверяем, что за ссылку он отправил и ожидаем правильной ссылки
|
# Получаем чат пользователя, проверяем, что за ссылку он отправил и ожидаем правильной ссылки
|
||||||
while True:
|
while True:
|
||||||
link = input('Введите ссылку на чат: ')
|
link = input('Введите ссылку на чат: ')
|
||||||
# link = ('osint_flood')
|
|
||||||
res = check_link(link)
|
res = check_link(link)
|
||||||
if not res:
|
if not res:
|
||||||
print('Неверная ссылка. Попробуйте другую.')
|
print('Неверная ссылка. Попробуйте другую.')
|
||||||
|
@ -25,35 +22,45 @@ try:
|
||||||
res = loop.run_until_complete(check_chat(link, 'id'))
|
res = loop.run_until_complete(check_chat(link, 'id'))
|
||||||
else:
|
else:
|
||||||
res = loop.run_until_complete(check_chat(link, 'url'))
|
res = loop.run_until_complete(check_chat(link, 'url'))
|
||||||
if res is not False:
|
if res is not False and res['status'] == 'ok':
|
||||||
members = res[0]
|
members = res['members']
|
||||||
admins = res[1]
|
admins = res['admins']
|
||||||
chat = res[2]
|
chat = res['ch']
|
||||||
users = res[3]
|
users = res['users']
|
||||||
channel_type = res[4]
|
channel_type = res['channel_type']
|
||||||
channel_title = res[5]
|
channel_title = res['channel_title']
|
||||||
|
break
|
||||||
|
elif res is not False and res['status'] == 'error' and res['error_type'] == 'too_many_users':
|
||||||
|
chat = res['ch']
|
||||||
|
channel_type = res['channel_type']
|
||||||
|
channel_title = res['channel_title']
|
||||||
break
|
break
|
||||||
elif res == 'close':
|
elif res == 'close':
|
||||||
chat = loop.run_until_complete(inv_chat(link))
|
chat = loop.run_until_complete(inv_chat(link))
|
||||||
res = loop.run_until_complete(check_chat(chat, 'url'))
|
res = loop.run_until_complete(check_chat(chat, 'url'))
|
||||||
if res is not False:
|
if res is not False and res['status'] == 'ok':
|
||||||
members = res[0]
|
members = res['members']
|
||||||
admins = res[1]
|
admins = res['admins']
|
||||||
chat = res[2]
|
chat = res['ch']
|
||||||
users = res[3]
|
users = res['users']
|
||||||
|
channel_type = 'Чаты'
|
||||||
|
channel_title = chat.title
|
||||||
|
break
|
||||||
|
elif res is not False and res['status'] == 'error' and res['error_type'] == 'too_many_users':
|
||||||
|
chat = res['ch']
|
||||||
channel_type = 'Чаты'
|
channel_type = 'Чаты'
|
||||||
channel_title = chat.title
|
channel_title = chat.title
|
||||||
break
|
break
|
||||||
title = channel_title
|
|
||||||
for x in ['\\', '|', '"', '/', ':',
|
for x in ['\\', '|', '"', '/', ':',
|
||||||
'?', '*', '<', '>']:
|
'?', '*', '<', '>']:
|
||||||
title = title.replace(x, ' ')
|
title = channel_title.replace(x, ' ')
|
||||||
if os.path.exists(f'../Чаты') is False:
|
if os.path.exists(f'../Чаты') is False:
|
||||||
os.mkdir(f'../Чаты')
|
os.mkdir(f'../Чаты')
|
||||||
if os.path.exists(f'../Каналы') is False:
|
if os.path.exists(f'../Каналы') is False:
|
||||||
os.mkdir(f'../Каналы')
|
os.mkdir(f'../Каналы')
|
||||||
if os.path.exists(f'../{channel_type}/{title}') is False:
|
if os.path.exists(f'../{channel_type}/{title}') is False:
|
||||||
os.mkdir(f'../{channel_type}/{title}')
|
os.mkdir(f'../{channel_type}/{title}')
|
||||||
|
if res['status'] == 'ok':
|
||||||
with open(f'../{channel_type}/{title}/Участники {title}.json', 'w', encoding='utf8') as f:
|
with open(f'../{channel_type}/{title}/Участники {title}.json', 'w', encoding='utf8') as f:
|
||||||
with open(f'../{channel_type}/{title}/Участники {title}.txt', 'w', encoding='utf8') as file:
|
with open(f'../{channel_type}/{title}/Участники {title}.txt', 'w', encoding='utf8') as file:
|
||||||
all_users = {
|
all_users = {
|
||||||
|
@ -123,13 +130,3 @@ try:
|
||||||
if str(otvet) == '1':
|
if str(otvet) == '1':
|
||||||
loop.run_until_complete(dump_messages(chat, title))
|
loop.run_until_complete(dump_messages(chat, title))
|
||||||
input('\nСканирование закончено. Можете нажать "Enter", чтобы закрыть окно.')
|
input('\nСканирование закончено. Можете нажать "Enter", чтобы закрыть окно.')
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f'''Упс... Возникла ошибка
|
|
||||||
Текст ошибки:
|
|
||||||
|
|
||||||
{e}
|
|
||||||
|
|
||||||
Отправьте скриншот разработчику.''')
|
|
||||||
raise e
|
|
||||||
input('\nНажмите "Enter", чтобы закрыть окно.')
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user