156 lines
14 KiB
Python
156 lines
14 KiB
Python
|
import sys
|
||
|
sys.path.append('..')
|
||
|
from base.spider import Spider
|
||
|
import json
|
||
|
|
||
|
class Spider(Spider): # 元类 默认的元类 type
|
||
|
def getName(self):
|
||
|
return "星光影视"
|
||
|
def init(self,extend=""):
|
||
|
print("============{0}============".format(extend))
|
||
|
pass
|
||
|
def homeContent(self,filter):
|
||
|
result = {}
|
||
|
cateManual = {
|
||
|
"电影":"电影",
|
||
|
"电视剧":"电视剧",
|
||
|
"动漫":"动漫",
|
||
|
"综艺":"综艺"
|
||
|
}
|
||
|
classes = []
|
||
|
for k in cateManual:
|
||
|
classes.append({
|
||
|
'type_name':k,
|
||
|
'type_id':cateManual[k]
|
||
|
})
|
||
|
|
||
|
result['class'] = classes
|
||
|
if(filter):
|
||
|
result['filters'] = self.config['filter']
|
||
|
return result
|
||
|
def homeVideoContent(self):
|
||
|
rsp = self.fetch("http://43.155.75.36:1069/api.php?do=index_list")
|
||
|
alist = json.loads(rsp.text)
|
||
|
alist = alist['list']
|
||
|
videos = []
|
||
|
|
||
|
for a in alist:
|
||
|
videos.append({
|
||
|
"vod_id":a['id'],
|
||
|
"vod_name":a['name'],
|
||
|
"vod_pic":a['pic'],
|
||
|
"vod_remarks":a['text']
|
||
|
})
|
||
|
result = {
|
||
|
'list':videos
|
||
|
}
|
||
|
return result
|
||
|
def categoryContent(self,tid,pg,filter,extend):
|
||
|
result = {}
|
||
|
if 'name' not in extend.keys():
|
||
|
extend['name'] = tid
|
||
|
extend['page'] = pg
|
||
|
filterParams = ["name", "area", "by", "n", "lang", "", "", "", "p", "", "", "year"]
|
||
|
params = []
|
||
|
for idx in range(len(filterParams)):
|
||
|
fp = filterParams[idx]
|
||
|
if fp in extend.keys():
|
||
|
|
||
|
params.append(fp + '=' + extend[fp])
|
||
|
suffix = '&'.join(params)
|
||
|
url = 'http://43.155.75.36:1069/api.php?do=class_list&{0}'.format(suffix)
|
||
|
rsp = self.fetch(url)
|
||
|
alists = json.loads(rsp.text)
|
||
|
alist = alists['list']
|
||
|
videos = []
|
||
|
for a in alist:
|
||
|
videos.append({
|
||
|
"vod_id":a['id'],
|
||
|
"vod_name":a['name'],
|
||
|
"vod_pic":a['pic'],
|
||
|
"vod_remarks":a['progress']
|
||
|
})
|
||
|
|
||
|
result['list'] = videos
|
||
|
result['page'] = pg
|
||
|
result['pagecount'] = 9999
|
||
|
result['limit'] = 90
|
||
|
result['total'] = 999999
|
||
|
return result
|
||
|
def detailContent(self,array):
|
||
|
tid = array[0]
|
||
|
url = 'http://43.155.75.36:1069/api.php?do=detail_info&id={0}'.format(tid)
|
||
|
rsp = self.fetch(url)
|
||
|
alists = json.loads(rsp.text)
|
||
|
alist = alists['info']
|
||
|
vod = {
|
||
|
"vod_id": alist['id'],
|
||
|
"vod_name": alist['name'],
|
||
|
"vod_pic": alist['pic'],
|
||
|
"type_name": alist['vclass'],
|
||
|
"vod_year": alist['year'],
|
||
|
"vod_area": alist['area'],
|
||
|
"vod_remarks": alist['progress'],
|
||
|
"vod_actor": "",
|
||
|
"vod_director": "",
|
||
|
"vod_play_from":alist['form'],
|
||
|
"vod_play_url":alist['playurl'],
|
||
|
"vod_content": alist['introduce']
|
||
|
}
|
||
|
|
||
|
result = {
|
||
|
'list':[
|
||
|
vod
|
||
|
]
|
||
|
}
|
||
|
return result
|
||
|
|
||
|
def searchContent(self,key,quick):
|
||
|
url = 'http://43.155.75.36:1069/api.php?do=search&wd={0}'.format(key)
|
||
|
# getHeader()
|
||
|
rsp = self.fetch(url)
|
||
|
jo = json.loads(rsp.text)
|
||
|
result = {}
|
||
|
jArray = []
|
||
|
if int(jo['count']) > 0:
|
||
|
for a in jo['list']:
|
||
|
jArray.append({
|
||
|
"vod_id": a['id'],
|
||
|
"vod_name": a['name'],
|
||
|
"vod_pic": a['pic'],
|
||
|
"vod_remarks": a['text']
|
||
|
})
|
||
|
result = {
|
||
|
'list':jArray
|
||
|
}
|
||
|
return result
|
||
|
cookie = {}
|
||
|
config = {
|
||
|
"filter":{"电视剧":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"剧情","v":"剧情"},{"n":"古装","v":"古装"},{"n":"武侠","v":"武侠"},{"n":"奇幻","v":"奇幻"},{"n":"科幻","v":"科幻"},{"n":"动作","v":"动作"},{"n":"喜剧","v":"喜剧"},{"n":"爱情","v":"爱情"},{"n":"励志","v":"励志"},{"n":"冒险","v":"冒险"},{"n":"歌舞","v":"歌舞"},{"n":"音乐","v":"音乐"},{"n":"恐怖","v":"恐怖"},{"n":"惊悚","v":"惊悚"},{"n":"丧尸","v":"丧尸"},{"n":"战争","v":"战争"},{"n":"传记","v":"传记"},{"n":"纪录","v":"纪录"},{"n":"犯罪","v":"犯罪"},{"n":"悬疑","v":"悬疑"},{"n":"西部","v":"西部"},{"n":"灾难","v":"灾难"},{"n":"家庭","v":"家庭"},{"n":"短片","v":"短片"},{"n":"校园","v":"校园"},{"n":"文艺","v":"文艺"},{"n":"运动","v":"运动"},{"n":"青春","v":"青春"},{"n":"同性","v":"同性"},{"n":"人性","v":"人性"},{"n":"美食","v":"美食"},{"n":"女性","v":"女性"},{"n":"治愈","v":"治愈"},{"n":"历史","v":"历史"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"大陆"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"},{"n":"欧美","v":"欧美"},{"n":"韩国","v":"韩国"},{"n":"日本","v":"日本"},{"n":"泰国","v":"泰国"},{"n":"印度","v":"印度"},{"n":"俄罗斯","v":"俄罗斯"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"},{"n":"2007","v":"2007"},{"n":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004","v":"2004"},{"n":"2003","v":"2003"},{"n":"2002","v":"2002"},{"n":"2001","v":"2001"},{"n":"2000","v":"2000"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"英语","v":"英语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"泰语","v":"泰语"},{"n":"德语","v":"德语"},{"n":"印度语","v":"印度语"},{"n":"国语","v":"国语"},{"n":"粤 语","v":"粤语"},{"n":"俄语","v":"俄语"},{"n":"西班牙语","v":"西班牙语"},{"n":"意大利语","v":"意大利语"},{"n":"其它","v":"其它"}]},{"key":"by","name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"电影":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"剧情","v":"剧情"},{"n":"古装","v":"古装"},{"n":"武侠","v":"武侠"},{"n":"奇幻","v":"奇幻"},{"n":"科幻","v":"科幻"},{"n":"动作","v":"动作"},{"n":"喜剧","v":"喜剧"},{"n":"爱情","v":"爱情"},{"n":"励志","v":"励志"},{"n":"冒险","v":"冒险"},{"n":"歌舞","v":"歌舞"},{"n":"音乐","v":"音乐"},{"n":"恐怖","v":"恐怖"},{"n":"惊悚","v":"惊悚"},{"n":"丧尸","v":"丧尸"},{"n":"战争","v":"战争"},{"n":"传记","v":"传记"},{"n":"纪录","v":"纪录"},{"n":"犯罪","v":"犯罪"},{"n":"悬疑","v":"悬疑"},{"n":"西部","v":"西部"},{"n":"灾难","v":"灾难"},{"n":"家庭","v":"家庭"},{"n":"短片","v":"短片"},{"n":"校园","v":"校园"},{"n":"文艺","v":"文艺"},{"n":"运动","v":"运动"},{"n":"青春","v":"青春"},{"n":"同性","v":"同性"},{"n":"人性","v":"人性"},{"n":"美食","v":"美食"},{"n":"女性","v":"女性"},{"n":"治愈","v":"治愈"},{"n":"历史","v":"历史"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"},{"n":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004",
|
||
|
}
|
||
|
def playerContent(self,flag,id,vipFlags):
|
||
|
if "STAR@" in id:
|
||
|
id = id.split('@')
|
||
|
url = 'http://43.155.75.36:1069/api.php?do=Ooo0oo0O0oOo&url={0}'.format(id[1])
|
||
|
rsp = self.fetch(url)
|
||
|
jo = json.loads(rsp.text)
|
||
|
id = jo['url']
|
||
|
result = {}
|
||
|
result["parse"] = 0
|
||
|
result["playUrl"] = ""
|
||
|
result["url"] = id
|
||
|
result["header"] = ""
|
||
|
return result
|
||
|
def isVideoFormat(self,url):
|
||
|
pass
|
||
|
def manualVideoCheck(self):
|
||
|
pass
|
||
|
def localProxy(self,param):
|
||
|
return [200, "video/MP2T", action, ""]
|
||
|
header = {
|
||
|
"origin":"https://www.5dy6.vip",
|
||
|
"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
|
||
|
"Accept":" */*",
|
||
|
"Accept-Language":"zh-CN,zh;q=0.9,en-US;q=0.3,en;q=0.7",
|
||
|
"Accept-Encoding":"gzip, deflate"
|
||
|
}
|