2022-09-23 08:21:27 +08:00
|
|
|
# coding=utf-8
|
|
|
|
# !/usr/bin/python
|
|
|
|
import sys
|
|
|
|
sys.path.append('..')
|
|
|
|
from base.spider import Spider
|
|
|
|
import json
|
2022-09-23 23:49:18 +00:00
|
|
|
import re
|
|
|
|
import difflib
|
|
|
|
import urllib
|
2022-09-23 08:21:27 +08:00
|
|
|
|
|
|
|
class Spider(Spider): # 元类 默认的元类 type
|
|
|
|
def getName(self):
|
|
|
|
return "Alist"
|
|
|
|
|
|
|
|
def init(self, extend=""):
|
|
|
|
print("============{0}============".format(extend))
|
|
|
|
pass
|
|
|
|
|
|
|
|
def isVideoFormat(self, url):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def manualVideoCheck(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def homeContent(self, filter):
|
|
|
|
result = {}
|
|
|
|
cateManual = {
|
2022-09-24 02:32:18 +00:00
|
|
|
"🔮嗨翻":"https://pan.hikerfans.com",
|
|
|
|
"🦀9T(Adult)":"https://drive.9t.ee",
|
|
|
|
"🐱梓澪の妙妙屋":"https://xn--i0v44m.xyz",
|
|
|
|
"🚆资源小站":"https://pan.142856.xyz",
|
|
|
|
"🌤晴园的宝藏库":"https://alist.52qy.repl.co",
|
|
|
|
"🐭米奇妙妙屋":"https://anime.mqmmw.ga",
|
|
|
|
"💂小兵组网盘影视":"https://6vv.app",
|
|
|
|
"📀小光盘":"https://alist.xiaoguanxiaocheng.life",
|
|
|
|
"🐋一只鱼":"https://alist.youte.ml",
|
|
|
|
"🌊七米蓝":"https://al.chirmyram.com",
|
|
|
|
"🌴非盘":"http://www.feifwp.top",
|
|
|
|
"🥼帅盘":"https://hi.shuaipeng.wang",
|
|
|
|
"🐉神族九帝":"https://alist.shenzjd.com",
|
|
|
|
"☃姬路白雪":"https://pan.jlbx.xyz",
|
|
|
|
"🎧听闻网盘":"https://wangpan.sangxuesheng.com",
|
|
|
|
"💾DISK":"http://124.222.140.243:8080",
|
|
|
|
"🌨云播放":"https://quanzi.laoxianghuijia.cn",
|
|
|
|
"✨星梦":"https://pan.bashroot.top",
|
|
|
|
"🌊小江":"https://dyj.me",
|
|
|
|
"💫触光":"https://pan.ichuguang.com",
|
|
|
|
"🕵好汉吧":"https://8023.haohanba.cn",
|
|
|
|
"🥗AUNEY":"http://121.227.25.116:8008",
|
|
|
|
"🎡资源小站":"https://960303.xyz/",
|
|
|
|
"🐝神器云": "https://quanzi.laoxianghuijia.cn",
|
|
|
|
"🏝fenwe":"http://www.fenwe.tk:5244",
|
|
|
|
"🎢轻弹浅唱":"https://g.xiang.lol"
|
2022-09-23 08:21:27 +08:00
|
|
|
}
|
|
|
|
classes = []
|
|
|
|
for k in cateManual:
|
|
|
|
classes.append({
|
|
|
|
'type_name': k,
|
|
|
|
"type_flag": "1",
|
|
|
|
'type_id': cateManual[k]
|
|
|
|
})
|
|
|
|
result['class'] = classes
|
|
|
|
if (filter):
|
|
|
|
result['filters'] = self.config['filter']
|
|
|
|
return result
|
|
|
|
|
|
|
|
def homeVideoContent(self):
|
|
|
|
result = {
|
|
|
|
'list': []
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
|
2022-09-23 23:49:18 +00:00
|
|
|
ver = ''
|
|
|
|
baseurl = ''
|
|
|
|
def getVersion(self, gtid):
|
|
|
|
param = {
|
|
|
|
"path": '/'
|
|
|
|
}
|
|
|
|
if gtid.count('/') == 2:
|
|
|
|
gtid = gtid + '/'
|
|
|
|
baseurl = re.findall(r"http.*://.*?/", gtid)[0]
|
|
|
|
ver = self.fetch(baseurl + 'api/public/settings', param)
|
|
|
|
vjo = json.loads(ver.text)['data']
|
|
|
|
if type(vjo) is dict:
|
|
|
|
ver = 3
|
|
|
|
else:
|
|
|
|
ver = 2
|
|
|
|
self.ver = ver
|
|
|
|
self.baseurl = baseurl
|
|
|
|
|
2022-09-23 08:21:27 +08:00
|
|
|
def categoryContent(self, tid, pg, filter, extend):
|
|
|
|
result = {}
|
2022-09-23 23:49:18 +00:00
|
|
|
if tid.count('/') == 2:
|
|
|
|
tid = tid + '/'
|
|
|
|
nurl = re.findall(r"http.*://.*?/", tid)[0]
|
|
|
|
if self.ver == '' or self.baseurl != nurl:
|
|
|
|
self.getVersion(tid)
|
|
|
|
ver = self.ver
|
|
|
|
baseurl = self.baseurl
|
|
|
|
if tid.count('/') == 2:
|
|
|
|
tid = tid + '/'
|
|
|
|
pat = tid.replace(baseurl,"")
|
2022-09-23 08:21:27 +08:00
|
|
|
param = {
|
2022-09-23 23:49:18 +00:00
|
|
|
"path": '/' + pat
|
2022-09-23 08:21:27 +08:00
|
|
|
}
|
2022-09-23 23:49:18 +00:00
|
|
|
if ver == 2:
|
|
|
|
rsp = self.postJson(baseurl + 'api/public/path', param)
|
|
|
|
jo = json.loads(rsp.text)
|
|
|
|
vodList = jo['data']['files']
|
|
|
|
elif ver == 3:
|
|
|
|
rsp = self.postJson(baseurl + 'api/fs/list', param)
|
|
|
|
jo = json.loads(rsp.text)
|
|
|
|
vodList = jo['data']['content']
|
2022-09-23 08:21:27 +08:00
|
|
|
videos = []
|
|
|
|
for vod in vodList:
|
2022-09-23 23:49:18 +00:00
|
|
|
if ver == 2:
|
|
|
|
img = vod['thumbnail']
|
|
|
|
elif ver == 3:
|
|
|
|
img = vod['thumb']
|
2022-09-23 08:21:27 +08:00
|
|
|
if len(img) == 0:
|
|
|
|
if vod['type'] == 1:
|
|
|
|
img = "http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png"
|
2022-09-23 23:49:18 +00:00
|
|
|
if pat != '':
|
|
|
|
aid = pat + '/'
|
|
|
|
else:
|
|
|
|
aid = pat
|
2022-09-23 08:21:27 +08:00
|
|
|
if vod['type'] == 1:
|
|
|
|
tag = "folder"
|
|
|
|
remark = "文件夹"
|
|
|
|
else:
|
2022-09-23 23:49:18 +00:00
|
|
|
size = vod['size']
|
|
|
|
if size > 1024 * 1024 * 1024 * 1024.0:
|
|
|
|
fs = "TB"
|
|
|
|
sz = round(size / (1024 * 1024 * 1024 * 1024.0), 2)
|
|
|
|
elif size > 1024 * 1024 * 1024.0:
|
|
|
|
fs = "GB"
|
|
|
|
sz = round(size / (1024 * 1024 * 1024.0), 2)
|
|
|
|
elif size > 1024 * 1024.0:
|
|
|
|
fs = "MB"
|
|
|
|
sz = round(size / (1024 * 1024.0), 2)
|
|
|
|
elif size > 1024.0:
|
|
|
|
fs = "KB"
|
|
|
|
sz = round(size / (1024.0), 2)
|
|
|
|
else:
|
|
|
|
fs = "KB"
|
|
|
|
sz = round(size / (1024.0), 2)
|
|
|
|
tag = "file"
|
|
|
|
remark = str(sz) + fs
|
|
|
|
aid = baseurl + aid + vod['name']
|
2022-09-23 08:21:27 +08:00
|
|
|
videos.append({
|
|
|
|
"vod_id": aid,
|
|
|
|
"vod_name": vod['name'],
|
|
|
|
"vod_pic": img,
|
|
|
|
"vod_tag": tag,
|
|
|
|
"vod_remarks": remark
|
|
|
|
})
|
|
|
|
result['list'] = videos
|
|
|
|
result['page'] = 1
|
|
|
|
result['pagecount'] = 1
|
|
|
|
result['limit'] = 999
|
|
|
|
result['total'] = 999999
|
|
|
|
return result
|
|
|
|
|
|
|
|
def detailContent(self, array):
|
2022-09-23 23:49:18 +00:00
|
|
|
id = array[0]
|
|
|
|
if self.ver == '' or self.baseurl == '':
|
|
|
|
self.getVersion(id)
|
|
|
|
ver = self.ver
|
|
|
|
baseurl = self.baseurl
|
|
|
|
fileName = id.replace(baseurl, "")
|
|
|
|
dir = re.findall(r"(.*)/", fileName)[0].replace(baseurl, "")
|
|
|
|
dirparam = {
|
|
|
|
"path": '/' + dir,
|
2022-09-23 08:21:27 +08:00
|
|
|
"password": "",
|
|
|
|
"page_num": 1,
|
|
|
|
"page_size": 100
|
|
|
|
}
|
|
|
|
vod = {
|
2022-09-23 23:49:18 +00:00
|
|
|
"vod_id": fileName,
|
|
|
|
"vod_name": dir,
|
|
|
|
"vod_pic": '',
|
|
|
|
"vod_tag": '',
|
2022-09-23 08:21:27 +08:00
|
|
|
"vod_play_from": "播放",
|
|
|
|
}
|
2022-09-23 23:49:18 +00:00
|
|
|
if ver == 2:
|
|
|
|
drsp = self.postJson(baseurl + 'api/public/path', dirparam)
|
|
|
|
djo = json.loads(drsp.text)
|
|
|
|
dList = djo['data']['files']
|
|
|
|
elif ver == 3:
|
|
|
|
drsp = self.postJson(baseurl + 'api/fs/list', dirparam)
|
|
|
|
djo = json.loads(drsp.text)
|
|
|
|
dList = djo['data']['content']
|
|
|
|
playUrl = ''
|
|
|
|
for tempd in dList:
|
|
|
|
if 'mp4' in tempd['name'] or 'mkv' in tempd['name'] or 'TS' in tempd['name'] or 'flv' in tempd['name'] or 'rmvb' in tempd['name'] or 'mp3' in tempd['name'] or 'flac' in tempd['name'] or 'wav' in tempd['name']:
|
|
|
|
# 开始匹配视频
|
|
|
|
# 视频名称 name
|
|
|
|
name = tempd['name']
|
|
|
|
# 视频链接 url
|
|
|
|
fname = re.findall(r"(.*)/", fileName)[0] + '/' + name
|
|
|
|
url = baseurl + fname
|
|
|
|
# 开始找字幕 subt
|
|
|
|
vname = re.findall(r"(.*)\.", tempd['name'])[0]
|
|
|
|
vstr = re.findall(r"\'name\': \'(.*?)\'", str(dList))
|
|
|
|
if len(vstr) == 2:
|
|
|
|
suball = vstr
|
|
|
|
else:
|
|
|
|
suball = difflib.get_close_matches(vname, vstr, len(dList), cutoff=0.8)
|
|
|
|
for sub in suball:
|
|
|
|
if sub.endswith(".ass") or sub.endswith(".srt"):
|
|
|
|
subt = '@@@' + baseurl + dir + '/' +sub
|
|
|
|
ifsubt = 'subt' in locals().keys()
|
|
|
|
if ifsubt is False:
|
|
|
|
playUrl = playUrl + '{0}${1}#'.format(name, url)
|
|
|
|
else:
|
|
|
|
playUrl = playUrl + '{0}${1}{2}#'.format(name, url, subt)
|
|
|
|
vod['vod_play_url'] = playUrl
|
2022-09-23 08:21:27 +08:00
|
|
|
result = {
|
|
|
|
'list': [
|
|
|
|
vod
|
|
|
|
]
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
|
|
|
|
def searchContent(self, key, quick):
|
|
|
|
result = {
|
|
|
|
'list': []
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
|
|
|
|
def playerContent(self, flag, id, vipFlags):
|
|
|
|
result = {}
|
2022-09-23 23:49:18 +00:00
|
|
|
ifsub = '@@@' in id
|
|
|
|
if ifsub is True:
|
|
|
|
ids = id.split('@@@')
|
|
|
|
if self.ver == '' or self.baseurl == '':
|
|
|
|
self.getVersion(ids[1])
|
|
|
|
ver = self.ver
|
|
|
|
baseurl = self.baseurl
|
|
|
|
fileName = ids[1].replace(baseurl, "")
|
|
|
|
vfileName = ids[0].replace(baseurl, "")
|
|
|
|
param = {
|
|
|
|
"path": '/' + fileName,
|
|
|
|
"password": "",
|
|
|
|
"page_num": 1,
|
|
|
|
"page_size": 100
|
|
|
|
}
|
|
|
|
vparam = {
|
|
|
|
"path": '/' + vfileName,
|
|
|
|
"password": "",
|
|
|
|
"page_num": 1,
|
|
|
|
"page_size": 100
|
|
|
|
}
|
|
|
|
if ver == 2:
|
|
|
|
rsp = self.postJson(baseurl + 'api/public/path', param)
|
|
|
|
jo = json.loads(rsp.text)
|
|
|
|
vodList = jo['data']['files'][0]
|
|
|
|
subturl = vodList['url']
|
|
|
|
vrsp = self.postJson(baseurl + 'api/public/path', vparam)
|
|
|
|
vjo = json.loads(vrsp.text)
|
|
|
|
vList = vjo['data']['files'][0]
|
|
|
|
url = vList['url']
|
|
|
|
elif ver == 3:
|
|
|
|
rsp = self.postJson(baseurl + 'api/fs/get', param)
|
|
|
|
jo = json.loads(rsp.text)
|
|
|
|
vodList = jo['data']
|
|
|
|
subturl = vodList['raw_url']
|
|
|
|
vrsp = self.postJson(baseurl + 'api/fs/get', vparam)
|
|
|
|
vjo = json.loads(vrsp.text)
|
|
|
|
vList = vjo['data']
|
|
|
|
url = vList['raw_url']
|
|
|
|
if subturl.startswith('http') is False:
|
|
|
|
head = re.findall(r"h.*?:", baseurl)[0]
|
|
|
|
subturl = head + subturl
|
|
|
|
if url.startswith('http') is False:
|
|
|
|
head = re.findall(r"h.*?:", baseurl)[0]
|
|
|
|
url = head + url
|
|
|
|
urlfileName = urllib.parse.quote(fileName)
|
|
|
|
subturl = subturl.replace(fileName, urlfileName)
|
|
|
|
urlvfileName = urllib.parse.quote(vfileName)
|
|
|
|
url = url.replace(vfileName, urlvfileName)
|
|
|
|
result['subt'] = subturl
|
|
|
|
else:
|
|
|
|
if self.ver == '' or self.baseurl == '':
|
|
|
|
self.getVersion(id)
|
|
|
|
ver = self.ver
|
|
|
|
baseurl = self.baseurl
|
|
|
|
vfileName = id.replace(baseurl, "")
|
|
|
|
vparam = {
|
|
|
|
"path": '/' + vfileName,
|
|
|
|
"password": "",
|
|
|
|
"page_num": 1,
|
|
|
|
"page_size": 100
|
|
|
|
}
|
|
|
|
if ver == 2:
|
|
|
|
vrsp = self.postJson(baseurl + 'api/public/path', vparam)
|
|
|
|
vjo = json.loads(vrsp.text)
|
|
|
|
vList = vjo['data']['files'][0]
|
|
|
|
url = vList['url']
|
|
|
|
elif ver == 3:
|
|
|
|
vrsp = self.postJson(baseurl + 'api/fs/get', vparam)
|
|
|
|
vjo = json.loads(vrsp.text)
|
|
|
|
vList = vjo['data']
|
|
|
|
url = vList['raw_url']
|
|
|
|
if url.startswith('http') is False:
|
|
|
|
head = re.findall(r"h.*?:", baseurl)[0]
|
|
|
|
url = head + url
|
|
|
|
urlvfileName = urllib.parse.quote(vfileName)
|
|
|
|
url = url.replace(vfileName, urlvfileName)
|
2022-09-23 08:21:27 +08:00
|
|
|
result["parse"] = 0
|
|
|
|
result["playUrl"] = ''
|
|
|
|
result["url"] = url
|
2022-09-23 23:49:18 +00:00
|
|
|
result["header"] = {
|
|
|
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
|
|
|
|
}
|
2022-09-23 08:21:27 +08:00
|
|
|
return result
|
|
|
|
|
|
|
|
config = {
|
|
|
|
"player": {},
|
2022-09-23 23:49:18 +00:00
|
|
|
"filter": {}
|
2022-09-23 08:21:27 +08:00
|
|
|
}
|
|
|
|
header = {}
|
|
|
|
|
|
|
|
def localProxy(self, param):
|
2022-09-23 23:49:18 +00:00
|
|
|
return [200, "video/MP2T", action, ""]
|