mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-13 17:52:28 +08:00
fix hddolby
This commit is contained in:
@@ -55,6 +55,7 @@ class HDDolbySiteUserInfo(SiteParserBase):
|
||||
self._user_mail_unread_page = None
|
||||
self._mail_unread_params = {}
|
||||
self._torrent_seeding_page = "api/v1/user/peers"
|
||||
self._torrent_seeding_params = {}
|
||||
self._torrent_seeding_headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json, text/plain, */*"
|
||||
@@ -91,7 +92,8 @@ class HDDolbySiteUserInfo(SiteParserBase):
|
||||
"uploaded": "852071699418375",
|
||||
"downloaded": "1885536536176",
|
||||
"seedbonus": "99774808.0",
|
||||
"sebonus": "3739023.7"
|
||||
"sebonus": "3739023.7",
|
||||
"unread_messages": "0",
|
||||
}
|
||||
"""
|
||||
self.userid = user_info.get("id")
|
||||
@@ -102,8 +104,7 @@ class HDDolbySiteUserInfo(SiteParserBase):
|
||||
self.download = int(user_info.get("downloaded") or '0')
|
||||
self.ratio = round(self.upload / self.download, 2) if self.download else 0
|
||||
self.bonus = float(user_info.get("seedbonus") or "0")
|
||||
self.message_read_force = True
|
||||
self._torrent_seeding_params = {}
|
||||
self.message_unread = int(user_info.get("unread_messages") or '0')
|
||||
|
||||
def _parse_user_traffic_info(self, html_text: str):
|
||||
"""
|
||||
|
||||
@@ -7,6 +7,7 @@ from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.log import logger
|
||||
from app.schemas import MediaType
|
||||
from app.utils.http import RequestUtils
|
||||
from app.utils.string import StringUtils
|
||||
|
||||
|
||||
class HddolbySpider:
|
||||
@@ -15,16 +16,17 @@ class HddolbySpider:
|
||||
"""
|
||||
_indexerid = None
|
||||
_domain = None
|
||||
_domain_host = None
|
||||
_name = ""
|
||||
_proxy = None
|
||||
_cookie = None
|
||||
_ua = None
|
||||
_apikey = None
|
||||
_size = 40
|
||||
_searchurl = "https://api.hddolby.com/api/v1/torrent/search"
|
||||
_downloadurl = "https://api.hddolby.com/api/v1/torrent/download?id=%s"
|
||||
_pageurl = "%sdetails.php?id=%s&hit=1"
|
||||
_timeout = 15
|
||||
_searchurl = None
|
||||
_downloadurl = None
|
||||
|
||||
# 分类
|
||||
_movie_category = [401, 405]
|
||||
@@ -63,6 +65,7 @@ class HddolbySpider:
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
self._domain = indexer.get('domain')
|
||||
self._domain_host = StringUtils.get_url_domain(self._domain)
|
||||
self._name = indexer.get('name')
|
||||
if indexer.get('proxy'):
|
||||
self._proxy = settings.PROXY
|
||||
@@ -70,6 +73,8 @@ class HddolbySpider:
|
||||
self._ua = indexer.get('ua')
|
||||
self._apikey = indexer.get('apikey')
|
||||
self._timeout = indexer.get('timeout') or 15
|
||||
self._searchurl = f"https://api.{self._domain_host}/api/v1/torrent/search"
|
||||
self._downloadurl = f"https://api.{self._domain_host}/api/v1/torrent/download?id=%s"
|
||||
|
||||
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
|
||||
"""
|
||||
@@ -151,7 +156,7 @@ class HddolbySpider:
|
||||
torrent = {
|
||||
'title': result.get('name'),
|
||||
'description': result.get('small_descr'),
|
||||
'enclosure': self.__get_download_url(result.get('id')),
|
||||
'enclosure': self.__get_download_url(result.get('id'), result.get('downhash')),
|
||||
'pubdate': result.get('added'),
|
||||
'size': result.get('size'),
|
||||
'seeders': result.get('seeders'),
|
||||
@@ -202,25 +207,9 @@ class HddolbySpider:
|
||||
return discount_dict.get(discount, 1)
|
||||
return 1
|
||||
|
||||
def __get_download_url(self, torrent_id: str) -> str:
|
||||
def __get_download_url(self, torrent_id: int, downhash: str) -> str:
|
||||
"""
|
||||
获取下载链接,返回base64编码的json字符串及URL
|
||||
"""
|
||||
url = self._downloadurl % torrent_id
|
||||
params = {
|
||||
'method': 'post',
|
||||
'cookie': False,
|
||||
'params': {
|
||||
'id': torrent_id
|
||||
},
|
||||
'header': {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'x-api-key': self._apikey
|
||||
},
|
||||
'result': 'data'
|
||||
}
|
||||
# base64编码
|
||||
base64_str = base64.b64encode(json.dumps(params).encode('utf-8')).decode('utf-8')
|
||||
return f"[{base64_str}]{url}"
|
||||
return f"{self._domain}download.php?id={torrent_id}&downhash={downhash}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user