Я пытался использовать Telethon, но оказалось, что он работает очень медленно
Поэтому я попробовал использовать эту суть, как предложено в
этом посте
У меня возникли следующие ошибки. Может ли кто-нибудь мне помочь?
Вот мой код:
[gtxtreme@archlinux ~]$ python PycharmProjects/python_gtxtreme/tgBotrev1.py
PycharmProjects/python_gtxtreme/tgBotrev1.py:13: RuntimeWarning: coroutine 'AuthMethods._start' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "PycharmProjects/python_gtxtreme/tgBotrev1.py", line 31, in
loop.run_until_complete(getAllMediaFromchannel())
File "/usr/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
return future.result()
File "PycharmProjects/python_gtxtreme/tgBotrev1.py", line 14, in getAllMediaFromchannel
ch_entity = await client.get_entity("telegram.me/joinchat/AAAAAEXnb4jK7xyU1SfAsw")
File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 310, in get_entity
result.append(await self._get_entity_from_string(x))
File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 512, in _get_entity_from_string
invite = await self(
File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 56, in _call
future = sender.send(request, ordered=ordered)
File "/usr/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 170, in send
raise ConnectionError('Cannot send requests while disconnected')
ConnectionError: Cannot send requests while disconnected
[gtxtreme@archlinux ~]$
Кроме того, любой другой подходящий способ сделать это будет предпочтительнее
Я пытался использовать Telethon, но оказалось, что он работает очень медленно Поэтому я попробовал использовать эту суть, как предложено в этом посте У меня возникли следующие ошибки. Может ли кто-нибудь мне помочь? Вот мой код: [code]from telethon.sync import TelegramClient from FastTelethon import download_file import os import asyncio
async for msg in messages: result = await download_file(client, msg.document, "/home/gtxtreme/Documents/McHumour", progress_callback=progress_cb) print("*************************\nFile named {0} saved to {1} successfully\n********************".format( msg.message, result))
if __name__ == '__main__': loop = asyncio.get_event_loop() loop.run_until_complete(getAllMediaFromchannel())
[/code] Вот моя ошибка [code][gtxtreme@archlinux ~]$ python PycharmProjects/python_gtxtreme/tgBotrev1.py
PycharmProjects/python_gtxtreme/tgBotrev1.py:13: RuntimeWarning: coroutine 'AuthMethods._start' was never awaited RuntimeWarning: Enable tracemalloc to get the object allocation traceback Traceback (most recent call last): File "PycharmProjects/python_gtxtreme/tgBotrev1.py", line 31, in loop.run_until_complete(getAllMediaFromchannel()) File "/usr/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete return future.result() File "PycharmProjects/python_gtxtreme/tgBotrev1.py", line 14, in getAllMediaFromchannel ch_entity = await client.get_entity("telegram.me/joinchat/AAAAAEXnb4jK7xyU1SfAsw") File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 310, in get_entity result.append(await self._get_entity_from_string(x)) File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 512, in _get_entity_from_string invite = await self( File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 30, in __call__ return await self._call(self._sender, request, ordered=ordered) File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 56, in _call future = sender.send(request, ordered=ordered) File "/usr/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 170, in send raise ConnectionError('Cannot send requests while disconnected') ConnectionError: Cannot send requests while disconnected
[gtxtreme@archlinux ~]$
[/code] Кроме того, любой другой подходящий способ сделать это будет предпочтительнее