fix: align butailing player payload
This commit is contained in:
@@ -164,14 +164,20 @@ class TestBuTaiLingSpider(unittest.TestCase):
|
||||
self.assertEqual(vod["vod_play_from"], "aliyun#1")
|
||||
self.assertEqual(vod["vod_play_url"], "aliyun#1$https://www.alipan.com/s/ali1")
|
||||
|
||||
def test_player_content_passthroughs_share_links(self):
|
||||
def test_player_content_passthroughs_share_links_with_tvbox_shape(self):
|
||||
self.assertEqual(
|
||||
self.spider.playerContent("quark#1", "https://pan.quark.cn/s/q1", {}),
|
||||
{"parse": 0, "url": "https://pan.quark.cn/s/q1"},
|
||||
{"parse": 0, "playUrl": "", "url": "https://pan.quark.cn/s/q1"},
|
||||
)
|
||||
self.assertEqual(
|
||||
self.spider.playerContent("quark#1", "push://https://pan.quark.cn/s/q1", {}),
|
||||
{"parse": 0, "url": "https://pan.quark.cn/s/q1"},
|
||||
{"parse": 0, "playUrl": "", "url": "https://pan.quark.cn/s/q1"},
|
||||
)
|
||||
|
||||
def test_player_content_returns_empty_url_for_non_pan_links(self):
|
||||
self.assertEqual(
|
||||
self.spider.playerContent("other#1", "https://example.com/file", {}),
|
||||
{"parse": 0, "playUrl": "", "url": ""},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -207,6 +207,23 @@ class Spider(BaseSpider):
|
||||
return "a123"
|
||||
return "other"
|
||||
|
||||
def _is_supported_pan_url(self, url):
|
||||
text = str(url or "").strip().lower()
|
||||
return any(
|
||||
token in text
|
||||
for token in [
|
||||
"pan.quark.cn",
|
||||
"pan.baidu.com",
|
||||
"pan.xunlei.com",
|
||||
"alipan.com",
|
||||
"aliyundrive.com",
|
||||
"123865.com",
|
||||
"123684.com",
|
||||
"123pan.com",
|
||||
"drive.uc.cn",
|
||||
]
|
||||
)
|
||||
|
||||
def _extract_pan_sources(self, detail):
|
||||
groups = (detail or {}).get("movies_online_seed")
|
||||
if not isinstance(groups, dict):
|
||||
@@ -285,4 +302,7 @@ class Spider(BaseSpider):
|
||||
|
||||
def playerContent(self, flag, id, vipFlags):
|
||||
raw = str(id or "").strip()
|
||||
return {"parse": 0, "url": raw[7:] if raw.startswith("push://") else raw}
|
||||
url = raw[7:] if raw.startswith("push://") else raw
|
||||
if self._is_supported_pan_url(url):
|
||||
return {"parse": 0, "playUrl": "", "url": url}
|
||||
return {"parse": 0, "playUrl": "", "url": ""}
|
||||
|
||||
Reference in New Issue
Block a user