1
0
Fork 0
mirror of https://github.com/SlavikMIPT/tgcloud.git synced 2025-02-12 11:12:09 +00:00

telethon==0.19.1

This commit is contained in:
Вячеслав Баженов 2019-06-16 18:38:44 +03:00
parent b7028e786c
commit 1d93c7db68
3 changed files with 11 additions and 8 deletions

View file

@ -13,6 +13,7 @@ from telethon.tl.types import Document
from telethon.utils import get_input_media
from telethon.errors.rpc_error_list import LocationInvalidError
from telegram_client_x import TelegramClientX
# from telethon.telegram_client import TelegramClient
from telethon.tl.types import Message
from tg_access import *
from io import BytesIO
@ -61,7 +62,8 @@ client.set_upload_threads_count(24)#24
client.set_download_threads_count(8)#8
last_call_time_sent = time.time()
last_call_time_receive = time.time()
if not client.is_connected():
client.start()
def on_download_progress(recv_bytes, total_bytes):
global last_call_time_receive
@ -79,7 +81,7 @@ def on_upload_progress(send_bytes, total_bytes):
# print(f"sent {send_bytes}/{total_bytes}", end="\r")
return 0
#
def download_block(chat_id, hash_uid):
try:
hash_uid = str(hash_uid)
@ -89,7 +91,7 @@ def download_block(chat_id, hash_uid):
client.start()
chat_id = int(chat_id) if chat_id.isdigit() else chat_id
entity = client.get_entity(chat_id)
messages = client.get_messages(entity, limit=40)
messages = client.get_messages(entity, limit=40,search=hash_uid)
for i in range(len(messages)):
msg = messages[i]
if msg.message == hash_uid:
@ -158,4 +160,4 @@ if __name__ == '__main__':
main(sys.argv[0:])
# download_block("slavikmr","660f320161344649cd5447986a9f68fb60eb9734")
# download_block("slavikmr","d46610254a0afb93228832bdb6122d27e4bcb6c8")

View file

@ -1,2 +1,2 @@
Telethon==0.18.3
Telethon==0.19.1
cryptg

View file

@ -33,13 +33,13 @@ from threading import Thread
import random
import time
from queue import Queue
from telethon.network import ConnectionMode
from telethon.network import ConnectionTcpFull
from datetime import timedelta
class TelegramClientX(TelegramClient):
def __init__(self, session, api_id, api_hash,
connection_mode=ConnectionMode.TCP_FULL,
connection=ConnectionTcpFull,
use_ipv6=False,
proxy=None,
update_workers=None,
@ -49,7 +49,7 @@ class TelegramClientX(TelegramClient):
**kwargs):
super().__init__(
session, api_id, api_hash,
connection_mode=connection_mode,
connection=connection,
use_ipv6=use_ipv6,
proxy=proxy,
update_workers=update_workers,
@ -347,6 +347,7 @@ class TelegramClientX(TelegramClient):
# The used client will change if FileMigrateError occurs
client = self
cdn_decrypter = None
input_location = utils.get_input_loction(input_location)
download_thread = []
q_request = []