wip telegram test
This commit is contained in:
parent
e202f9a1f0
commit
4b4f288919
@ -81,7 +81,9 @@ class MasterService:
|
||||
app.pre_run()
|
||||
app.is_running = True
|
||||
tg_client.start()
|
||||
result = downloader.video_download(client=tg_client)
|
||||
loop = asyncio.get_running_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_until_complete(downloader.video_download(client=tg_client))
|
||||
return result
|
||||
case _:
|
||||
result = downloader.video_download()
|
||||
|
@ -51,7 +51,7 @@ def asyncio_gather(*futures, return_exceptions=False) -> list:
|
||||
|
||||
|
||||
class TelegramParser(BaseParser):
|
||||
def video_download(self, client: Client = None):
|
||||
async def video_download(self, client: Client = None):
|
||||
url_parse_result = urlparse(self.params["link"])
|
||||
channel, message_id = url_parse_result.path[1:].split('/') if "/c/" not in url_parse_result.path else \
|
||||
url_parse_result.path[3:].split('/')
|
||||
@ -68,8 +68,8 @@ class TelegramParser(BaseParser):
|
||||
mode="w+", encoding="utf-8") as f:
|
||||
YAML().dump(config, f)
|
||||
if _check_config():
|
||||
a = asyncio_run(download_all_chat(client))
|
||||
b = asyncio_run(worker(client))
|
||||
await download_all_chat(client)
|
||||
await worker(client)
|
||||
client.stop()
|
||||
app.is_running = False
|
||||
logger.info("Stopped!")
|
||||
|
Loading…
Reference in New Issue
Block a user