From 2f05f8dc4d5e36fdb829767e877e0909ab4a1b9a Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 23 Mar 2024 09:50:03 +0800 Subject: [PATCH] fix mtorrent --- app/modules/indexer/mtorrent.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/modules/indexer/mtorrent.py b/app/modules/indexer/mtorrent.py index 876ae974..bacf85e6 100644 --- a/app/modules/indexer/mtorrent.py +++ b/app/modules/indexer/mtorrent.py @@ -47,6 +47,9 @@ class MTorrentSpider: self._ua = indexer.get('ua') def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]: + """ + 搜索 + """ if not mtype: categories = [] elif mtype == MediaType.TV: @@ -110,6 +113,9 @@ class MTorrentSpider: @staticmethod def __find_imdbid(imdb: str) -> str: + """ + 从imdb链接中提取imdbid + """ if imdb: m = re.search(r"tt\d+", imdb) if m: @@ -118,6 +124,9 @@ class MTorrentSpider: @staticmethod def __get_downloadvolumefactor(discount: str) -> float: + """ + 获取下载系数 + """ discount_dict = { "FREE": 0, "PERCENT_50": 0.5, @@ -131,6 +140,9 @@ class MTorrentSpider: @staticmethod def __get_uploadvolumefactor(discount: str) -> float: + """ + 获取上传系数 + """ uploadvolumefactor_dict = { "_2X": 2.0, "_2X_FREE": 2.0, @@ -141,6 +153,9 @@ class MTorrentSpider: return 1 def __get_download_url(self, torrent_id: str) -> str: + """ + 获取下载链接,返回base64编码的json字符串及URL + """ url = self._downloadurl % self._domain params = { 'method': 'post',