minor fixes

This commit is contained in:
garickbadalov 2023-10-18 01:44:24 +03:00
parent fff27fee0a
commit f85a3a7600
4 changed files with 1 additions and 22 deletions

View File

@ -1,7 +1,6 @@
import asyncio
import concurrent.futures as pool
import subprocess
import pyrogram
import traceback
from functools import partial
@ -14,7 +13,6 @@ from src.core.redis_client import RedisClient
from src.core.result import Result, ResultTypeEnum
from src.exceptions.download_exceptions import FileAlreadyExistException, SiteNotImplementedException
from src.parsers.MyMail.my_mail_parser import MyMailParser
from src.parsers.Telegram.telegram_media_downloader.media_downloader import app, _check_config
from src.parsers.Yappy.yappy_parser import YappyParser
from src.parsers.base_parser import BaseParser
from src.parsers.parser_mapping import get_parser
@ -73,8 +71,6 @@ class MasterService:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(downloader.video_download())
# r = f.result(600)
# loop.close()
return result
case _:
result = downloader.video_download()
@ -86,19 +82,6 @@ class MasterService:
url_parse_result = urlparse(params["link"])
uri = f"{url_parse_result.netloc}{url_parse_result.path}"
logger.info(uri)
# # TODO: похоже нужно переделать на регулярки, т.к. добавлять каждую вариацию домена моветон, вероятно я сделаюне-
# parser_mapping = {
# "my.mail.ru": MyMailParser(params),
# "www.youtube.com": BaseParser(params),
# "youtube.com": BaseParser(params),
# "youtu.be": BaseParser(params),
# "vk.com": BaseParser(params),
# "ok.ru": BaseParser(params) if "topic" not in params["link"] else OkParser(params),
# "likee.video": BaseParser(params),
# "dzen.ru": BaseParser(params),
# "yappy.media": YappyParser(params),
# "yandex.ru": BaseParser(params),
# }
return get_parser(uri)(params)
except KeyError:
raise SiteNotImplementedException

View File

@ -36,4 +36,4 @@ class DzenParser(BaseParser):
self.params["outtmpl"] = f"downloads/ZenYandex/{title}_%(resolution)s.%(ext)s"
file_path = super().video_download()
self.params["link"] = base_link
return file_path
return file_path.replace("master", title) if "master" in file_path else file_path

View File

@ -2,7 +2,6 @@ import os
from urllib.parse import urlparse
from loguru import logger
from pyrogram import Client
import pyrogram
from ruamel.yaml import YAML
@ -11,8 +10,6 @@ from src.parsers.Telegram.telegram_media_downloader.media_downloader import _che
worker
from src.parsers.base_parser import BaseParser
import asyncio
import threading
class TelegramParser(BaseParser):
async def video_download(self):

View File

@ -40,7 +40,6 @@ class BaseParser:
if os.path.exists(os.path.join(os.getcwd() + "/downloads/" + path_to_video)):
raise FileAlreadyExistException(message=path_to_video)
downloader.ydl_opts["quiet"] = False
downloader.ydl_opts["quiet"] = False
downloader.download()
return path_to_video