fix mtorrent

This commit is contained in:
jxxghp 2024-03-23 09:42:11 +08:00
parent ef67b76453
commit 23c678e71e
2 changed files with 16 additions and 5 deletions

View File

@ -45,7 +45,8 @@ class SiteChain(ChainBase):
# 特殊站点登录验证 # 特殊站点登录验证
self.special_site_test = { self.special_site_test = {
"zhuque.in": self.__zhuque_test, "zhuque.in": self.__zhuque_test,
# "m-team.io": self.__mteam_test, "m-team.io": self.__mteam_test,
"m-team.cc": self.__mteam_test,
} }
@staticmethod @staticmethod

View File

@ -30,9 +30,9 @@ class MTorrentSpider:
# 标签 # 标签
_labels = { _labels = {
0: "", "0": "",
4: "中字", "4": "中字",
6: "国配", "6": "国配",
} }
def __init__(self, indexer: CommentedMap): def __init__(self, indexer: CommentedMap):
@ -74,6 +74,14 @@ class MTorrentSpider:
if res and res.status_code == 200: if res and res.status_code == 200:
results = res.json().get('data', {}).get("data") or [] results = res.json().get('data', {}).get("data") or []
for result in results: for result in results:
category_value = result.get('category')
if category_value in self._tv_category \
and category_value not in self._movie_category:
category = MediaType.TV.value
elif category_value in self._movie_category:
category = MediaType.MOVIE.value
else:
category = MediaType.UNKNOWN.value
torrent = { torrent = {
'title': result.get('name'), 'title': result.get('name'),
'description': result.get('smallDescr'), 'description': result.get('smallDescr'),
@ -87,7 +95,9 @@ class MTorrentSpider:
'uploadvolumefactor': self.__get_uploadvolumefactor(result.get('status', {}).get("discount")), 'uploadvolumefactor': self.__get_uploadvolumefactor(result.get('status', {}).get("discount")),
'page_url': self._pageurl % (self._domain, result.get('id')), 'page_url': self._pageurl % (self._domain, result.get('id')),
'imdbid': self.__find_imdbid(result.get('imdb')), 'imdbid': self.__find_imdbid(result.get('imdb')),
'labels': [self._labels.get(result.get('labels') or 0)] if result.get('labels') else [] 'labels': [self._labels.get(result.get('labels'))] if result.get('labels') and result.get(
'labels') != "0" else [],
'category': category
} }
torrents.append(torrent) torrents.append(torrent)
elif res is not None: elif res is not None: