6/18/ds/PY/py_kuaikan.py

106 lines
18 KiB
Python
Raw Normal View History

2024-07-12 09:44:07 +03:00
#coding=utf-8
#!/usr/bin/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 = {
"电视剧":"2",
"电影":"1",
"综艺":"3",
"动漫":"4",
"纪录片": "5"
}
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://api.8a5.cn/parse/kuaikan/py.php?do=homeVideoContent")
alists = json.loads(rsp.text)
alist = alists['list']
result = {
'list':alist
}
return result
def categoryContent(self,tid,pg,filter,extend):
result = {}
urlParams = []
params = ''
for key in extend:
urlParams.append(str(key) + '=' + extend[key])
params = '&'.join(urlParams)
url = 'http://api.8a5.cn/parse/kuaikan/py.php?do=categoryContent&tid={0}&page={1}&{2}'.format(tid, pg,params)
rsp = self.fetch(url)
alists = json.loads(rsp.text)
alist = alists['list']
result['list'] = alist
result['page'] = pg
result['pagecount'] = 9999
result['limit'] = 90
result['total'] = 999999
return result
def detailContent(self,array):
tid = array[0]
url = 'http://api.8a5.cn/parse/kuaikan/py.php?do=detailContent&id={0}'.format(tid)
rsp = self.fetch(url)
alists = json.loads(rsp.text)
vod = alists['vod']
result = {
'list':[
vod
]
}
return result
def searchContent(self,key,quick):
url = 'http://api.8a5.cn/parse/kuaikan/py.php?do=searchContent&wd={0}'.format(key)
rsp = self.fetch(url)
alists = json.loads(rsp.text)
list = alists['list']
result = {
'list':list
}
return result
def playerContent(self,flag,id,vipFlags):
result = {}
if 'api.8a5.cn' in id:
rsp = self.fetch(id)
alists = json.loads(rsp.text)
id = alists['url']
result["parse"] = 0
result["playUrl"] = ''
result["url"] = id
return result
config = {
"player": {},
"filter":{"2":[{"key":"area","name":"地区","value":[{"n":"全部","v":0},{"n":"内地","v":1},{"n":"中国香港","v":2},{"n":"中国台湾","v":3},{"n":"韩国","v":4},{"n":"日本","v":5},{"n":"泰国","v":6},{"n":"美国","v":7},{"n":"英国","v":8},{"n":"新加坡","v":9},{"n":"法国","v":10},{"n":"德国","v":11},{"n":"印度","v":12},{"n":"欧美","v":13},{"n":"其他","v":14}]},{"key":"year","name":"年份","value":[{"n":"全部","v":0},{"n":"2022","v":20},{"n":"2021","v":19},{"n":"2020","v":18},{"n":"2019","v":17},{"n":"2018","v":16},{"n":"2017","v":15},{"n":"2016","v":14},{"n":"2015","v":13},{"n":"2014","v":12},{"n":"2013","v":11},{"n":"2012","v":10},{"n":"2011","v":9},{"n":"2010","v":8},{"n":"2009","v":7},{"n":"2008","v":6},{"n":"2007","v":5},{"n":"2006","v":4},{"n":"2005","v":3},{"n":"2004","v":2},{"n":"更早","v":1}]},{"key":"class","name":"剧情","value":[{"n":"全部","v":0},{"n":"剧情","v":2},{"n":"爱情","v":21},{"n":"犯罪","v":23},{"n":"搞笑","v":34},{"n":"武侠","v":19},{"n":"都市","v":6},{"n":"家庭","v":16},{"n":"职场","v":42},{"n":"国产","v":112},{"n":"国产剧","v":113},{"n":"年代","v":110},{"n":"文化","v":84},{"n":"网络剧","v":114},{"n":"芒果出品","v":115},{"n":"言情","v":1},{"n":"古装","v":8},{"n":"青春","v":15},{"n":"偶像","v":7},{"n":"伦理","v":3},{"n":"喜剧","v":4},{"n":"悬疑","v":5},{"n":"神话","v":13},{"n":"警匪","v":10},{"n":"历史","v":11},{"n":"励志","v":12},{"n":"情感","v":38},{"n":"战争","v":25},{"n":"电影版","v":74},{"n":"其他","v":79},{"n":"谍战","v":14},{"n":"校园","v":61},{"n":"农村","v":88},{"n":"动作","v":17},{"n":"传记","v":29},{"n":"科幻","v":20},{"n":"惊悚","v":31},{"n":"冒险","v":56},{"n":"同性","v":111},{"n":"恋爱","v":58},{"n":"奇幻","v":24},{"n":"生活","v":39},{"n":"歌舞","v":30},{"n":"恐怖","v":22},{"n":"原创","v":86},{"n":"魔幻","v":85},{"n":"战斗","v":80},{"n":"军旅","v":104},{"n":"文艺","v":27},{"n":"音乐","v":41},{"n":"新番动画","v":77},{"n":"刑侦","v":87},{"n":"情景","v":18},{"n":"玄幻","v":60},{"n":"军事","v":9},{"n":"经典","v":55},{"n":"推理","v":57},{"n":"革命","v":109},{"n":"纪录","v":28},{"n":"运动","v":66},{"n":"热血","v":53},{"n":"竞技","v":70},{"n":"童话","v":69},{"n":"友情","v":72},{"n":"少儿","v":46},{"n":"真人秀","v":33},{"n":"动画","v":26},{"n":"灾难","v":103},{"n":"纪实","v":48},{"n":"机战","v":63},{"n":"治愈","v":59},{"n":"时尚","v":44},{"n":"脱口秀","v":32},{"n":"美食","v":43},{"n":"戏曲","v":108},{"n":"人文","v":83},{"n":"完结动画","v":78},{"n":"社会","v":71},{"n":"益智","v":68},{"n":"亲子","v":64},{"n":"访谈","v":37},{"n":"游戏","v":45},{"n":"晚会","v":40},{"n":"美少女","v":54},{"n":"动物","v":62},{"n":"真人版","v":73},{"n":"科学","v":92},{"n":"内地","v":117}]}],"1":[{"key":"area","name":"地区","value":[{"n":"全部","v":0},{"n":"中国","v":1},{"n":"中国香港","v":2},{"n":"中国台湾","v":3},{"n":"韩国","v":4},{"n":"日本","v":5},{"n":"泰国","v":6},{"n":"美国","v":7},{"n":"英国","v":8},{"n":"新加坡","v":9},{"n":"法国","v":10},{"n":"德国","v":11},{"n":"印度","v":12},{"n":"欧美","v":13},{"n":"其他","v":14}]},{"key":"year","name":"年份","value":[{"n":"全部","v":0},{"n":"2022","v":20},{"n":"2021","v":19},{"n":"2020","v":18},{"n":"2019","v":17},{"n":"2018","v":16},{"n":"2017","v":15},{"n":"2016","v":14},{"n":"2015","v":13},{"n":"2014","v":12},{"n":"2013","v":11},{"n":"2012","v":10},{"n":"2011","v":9},{"n":"2010","v":8},{"n":"2009","v":7},{"n":"2008","v":6},{"n":"2007","v":5},{"n":"2006","v":4},{"n":"2005","v":3},{"n":"2004","v":2},{"n":"更早","v":1}]},{"key":"class","name":"剧情","value":[{"n":"全部","v":0},{"n":"言情","v":1},{"n":"动作","v":17},{"n":"惊悚","v":31},{"n":"剧情","v":2},{"n":"科幻","v":20},{"n":"喜剧","v":4},{"n":"冒险","v":56},{"n":"动画","v":26},{"n":"悬疑","v":5},{"n":"恐怖","v":22},{"n":"文艺","v":27},{"n":"纪实","v":48},{"n":"爱情","v":21},{"n":"历史","v":11},{"n":"犯罪","v":23},{"n":
}
def isVideoFormat(self,url):
pass
def manualVideoCheck(self):
pass
def localProxy(self,param):
return [200, "video/MP2T", action, ""]