wip telegram test
This commit is contained in:
parent
c006f68dde
commit
b4a174540d
@ -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