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