fix mtorrent
This commit is contained in:
@ -47,6 +47,9 @@ class MTorrentSpider:
|
|||||||
self._ua = indexer.get('ua')
|
self._ua = indexer.get('ua')
|
||||||
|
|
||||||
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
|
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
|
||||||
|
"""
|
||||||
|
搜索
|
||||||
|
"""
|
||||||
if not mtype:
|
if not mtype:
|
||||||
categories = []
|
categories = []
|
||||||
elif mtype == MediaType.TV:
|
elif mtype == MediaType.TV:
|
||||||
@ -110,6 +113,9 @@ class MTorrentSpider:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __find_imdbid(imdb: str) -> str:
|
def __find_imdbid(imdb: str) -> str:
|
||||||
|
"""
|
||||||
|
从imdb链接中提取imdbid
|
||||||
|
"""
|
||||||
if imdb:
|
if imdb:
|
||||||
m = re.search(r"tt\d+", imdb)
|
m = re.search(r"tt\d+", imdb)
|
||||||
if m:
|
if m:
|
||||||
@ -118,6 +124,9 @@ class MTorrentSpider:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __get_downloadvolumefactor(discount: str) -> float:
|
def __get_downloadvolumefactor(discount: str) -> float:
|
||||||
|
"""
|
||||||
|
获取下载系数
|
||||||
|
"""
|
||||||
discount_dict = {
|
discount_dict = {
|
||||||
"FREE": 0,
|
"FREE": 0,
|
||||||
"PERCENT_50": 0.5,
|
"PERCENT_50": 0.5,
|
||||||
@ -131,6 +140,9 @@ class MTorrentSpider:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __get_uploadvolumefactor(discount: str) -> float:
|
def __get_uploadvolumefactor(discount: str) -> float:
|
||||||
|
"""
|
||||||
|
获取上传系数
|
||||||
|
"""
|
||||||
uploadvolumefactor_dict = {
|
uploadvolumefactor_dict = {
|
||||||
"_2X": 2.0,
|
"_2X": 2.0,
|
||||||
"_2X_FREE": 2.0,
|
"_2X_FREE": 2.0,
|
||||||
@ -141,6 +153,9 @@ class MTorrentSpider:
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def __get_download_url(self, torrent_id: str) -> str:
|
def __get_download_url(self, torrent_id: str) -> str:
|
||||||
|
"""
|
||||||
|
获取下载链接,返回base64编码的json字符串及URL
|
||||||
|
"""
|
||||||
url = self._downloadurl % self._domain
|
url = self._downloadurl % self._domain
|
||||||
params = {
|
params = {
|
||||||
'method': 'post',
|
'method': 'post',
|
||||||
|
Reference in New Issue
Block a user