Add files via upload

This commit is contained in:
gaotianliuyun
2023-06-02 18:59:25 +08:00
committed by GitHub
parent 7b311ae753
commit 8831e63107
21 changed files with 1168 additions and 124 deletions
+127
View File
@@ -0,0 +1,127 @@
#coding=utf-8
#!/usr/bin/python
import sys
sys.path.append('..')
from base.spider import Spider
import json
host_url = 'https://frodo.douban.com/api/v2'
apikey = "?apikey=0ac44ae016490db2204ce0a042db2916"
class Spider(Spider): # 元类 默认的元类 type
def getName(self):
return "豆瓣"
def init(self,extend=""):
print("============{0}============".format(extend))
pass
def isVideoFormat(self,url):
pass
def manualVideoCheck(self):
pass
def homeContent(self,filter):
result = {}
cateManual = {
"热门电影": "hot_gaia",
"热播剧集": "tv_hot",
"热播综艺": "show_hot",
"电影筛选": "movie",
"电视筛选": "tv",
"电影榜单": "rank_list_movie",
"电视榜单": "rank_list_tv"
}
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):
url = host_url + '/subject_collection/subject_real_time_hotest/items' + apikey
rsp = self.fetch(url,headers=self.header)
jo = json.loads(rsp.text)
joList = jo.get("subject_collection_items")
lists = []
for item in joList:
rating = item['rating']['value'] if item['rating'] else ""
lists.append({
"vod_id": f'msearch:{item.get("type", "")}__{item.get("id", "")}',
"vod_name": item['title'],
"vod_pic": item['pic']['normal'],
"vod_remarks": rating
})
result = {
'list':lists
}
return result
def categoryContent(self,tid,pg,filter,extend):
result = {}
if extend:
sort = extend.pop('sort') if "sort" in extend else "T"
tags = ",".join(item for item in extend.values())
else:
sort = "T"
tags = ""
if tid == "hot_gaia":
urlpath = f"/movie/{tid}"
getdata = "items"
sort = extend.get("sort", "recommend")
area = extend.get("area", "全部")
sort = sort + "&area=" + area
elif tid == "tv_hot" or tid == "show_hot":
urlpath = f"/subject_collection/{tid}/items"
getdata = "subject_collection_items"
elif tid.startswith("rank_list"):
id = "movie_real_time_hotest" if tid == "rank_list_movie" else "tv_real_time_hotest"
urlpath = f"/subject_collection/{id}/items"
getdata = "subject_collection_items"
else:
urlpath = f"/{tid}/recommend"
getdata = "items"
url = host_url + urlpath + apikey + '&sort=' + sort + '&tags=' + tags + '&start=' + str((int(pg) - 1) * 30)
rsp = self.fetch(url,headers=self.header)
jo = json.loads(rsp.text)
jolist = jo[getdata]
videos = []
for vod in jolist:
rating = vod.get("rating", "").get("value", "") if vod.get("rating", "") else ""
pic = vod.get("pic", "").get("normal", "") if vod.get("pic", "") else ""
videos.append({
"vod_id": f'msearch:{vod.get("type", "")}__{vod.get("id", "")}',
"vod_name": vod['title'],
"vod_pic": pic,
"vod_remarks": rating
})
result['list'] = videos
result['page'] = pg
result['pagecount'] = 9999
result['limit'] = 90
result['total'] = 999999
return result
def detailContent(self,array):
pass
def searchContent(self,key,quick):
pass
def playerContent(self,flag,id,vipFlags):
pass
config = {
"player": {},
"filter": {"hot_gaia":[{"key":"sort","name":"排序","value":[{"n":"热度","v":"recommend"},{"n":"最新","v":"time"},{"n":"评分","v":"rank"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":"全部"},{"n":"华语","v":"华语"},{"n":"欧美","v":"欧美"},{"n":"韩国","v":"韩国"},{"n":"日本","v":"日本"}]}],"tv_hot":[{"key":"type","name":"分类","value":[{"n":"综合","v":"tv_hot"},{"n":"国产剧","v":"tv_domestic"},{"n":"欧美剧","v":"tv_american"},{"n":"日剧","v":"tv_japanese"},{"n":"韩剧","v":"tv_korean"},{"n":"动画","v":"tv_animation"}]}],"show_hot":[{"key":"type","name":"分类","value":[{"n":"综合","v":"show_hot"},{"n":"国内","v":"show_domestic"},{"n":"国外","v":"show_foreign"}]}],"movie":[{"key":"类型","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":"短片"}]},{"key":"地区","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":"丹麦"}]},{"key":"sort","name":"排序","value":[{"n":"近期热度","v":"T"},{"n":"首映时间","v":"R"},{"n":"高分优先","v":"S"}]},{"key":"年代","name":"年代","value":[{"n":"全部年代","v":""},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2010年代","v":"2010年代"},{"n":"2000年代","v":"2000年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"},{"n":"70年代","v":"70年代"},{"n":"60年代","v":"60年代"},{"n":"更早","v":"更早"}]}],"tv":[{"key":"类型","name":"类型","value":[{"n":"不限","v":""},{"n":"电视剧","v":"电视剧"},{"n":"综艺","v":"综艺"}]},{"key":"电视剧形式","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":"音乐"}]},{"key":"综艺形式","name":"综艺形式","value":[{"n":"不限","v":""},{"n":"真人秀","v":"真人秀"},{"n":"脱口秀","v":"脱口秀"},{"n":"音乐","v":"音乐"},{"n":"歌舞","v":"歌舞"}]},{"key":"地区","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":"澳大利亚"}]},{"key":"sort","name":"排序","value":[{"n":"近期热度","v":"T"},{"n":"首播时间","v":"R"},{"n":"高分优先","v":"S"}]},{"key":"年代","name":"年代","value":[{"n":"全部","v":""},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2010年代","v":"2010年代"},{"n":"2000年代","v":"2000年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"},{"n":"70年代","v":"70年代"},{"n":"60年代","v":"60年代"},{"n":"更早","v":"更早"}]},{"key":"平台","name":"平台","value":[{"n":"全部","v":""},{"n":"腾讯视频","v":"腾讯视频"},{"n":"爱奇艺","v":"爱奇艺"},{"n":"优酷","v":"优酷"},{"n":"湖南卫视","v":"湖南卫视"},{"n":"Netflix","v":"Netflix"},{"n":"HBO","v":"HBO"},{"n":"BBC","v":"BBC"},{"n":"NHK","v":"NHK"},{"n":"CBS","v":"CBS"},{"n":"NBC","v":"NBC"},{"n":"tvN","v":"tvN"}]}],"rank_list_movie":[{"key":"榜单","name":"榜单","value":[{"n":"实时热门电影","v":"movie_real_time_hotest"},{"n":"一周口碑电影榜","v":"movie_weekly_best"},{"n":"豆瓣电影Top250","v":"movie_top250"}]}],"rank_list_tv":[{"key":"榜单","name":"榜单","value":[{"n":"实时热门电视","v":"tv_real_time_hotest"},{"n":"华语口碑剧集榜","v":"tv_chinese_best_weekly"},{"n":"全球口碑剧集榜","v":"tv_global_best_weekly"},{"n":"国内口碑综艺榜","v":"show_chinese_best_weekly"},{"n":"国外口碑综艺榜","v":"show_global_best_weekly"}]}]}
}
header = {
"Host": "frodo.douban.com",
"Connection": "Keep-Alive",
"Referer": "https://servicewechat.com/wx2f9b06c1de1ccfca/84/page-frame.html",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat"
}
def localProxy(self,param):
return [200, "video/MP2T", action, ""]
+181
View File
@@ -0,0 +1,181 @@
#coding=utf-8
#!/usr/bin/python
import sys
sys.path.append('..')
from base.spider import Spider
import time
class Spider(Spider): # 元类 默认的元类 type
def getName(self):
return "央视大全"
def init(self,extend=""):
print("============{0}============".format(extend))
pass
def isVideoFormat(self,url):
pass
def manualVideoCheck(self):
pass
def homeContent(self,filter):
result = {}
cateManual = {
"央视大全": "CCTV"
}
classes = []
for k in cateManual:
classes.append({
'type_name':k,
'type_id':cateManual[k]
})
result['class'] = classes
if(filter):
import datetime
current_year = datetime.datetime.now().year
yearList = [{"n":"全部","v":""}]
for year in range(current_year, current_year - 10, -1):
yearList.append({"n":year,"v":year})
yearDict = {"key":"year","name":"年份","value":yearList}
for classe in classes:
self.config['filter'][classe['type_id']].append(yearDict)
result['filters'] = self.config['filter']
return result
def homeVideoContent(self):
result = {}
return result
def categoryContent(self,tid,pg,filter,extend):
result = {}
month = ""
year = ""
if 'month' in extend.keys():
month = extend['month']
if 'year' in extend.keys():
year = extend['year']
if year == '':
month = ''
prefix = year + month
extend['p'] = pg
filterMap = {
"fl":"",
"fc":"",
"cid":"",
"p":"1"
}
suffix = ""
for key in filterMap.keys():
if key in extend.keys():
filterMap[key] = extend[key]
suffix = suffix + '&' + key + '=' + str(filterMap[key])
url = 'https://api.cntv.cn/lanmu/columnSearch?{0}&n=20&serviceId=tvcctv&t=json'.format(suffix)
jo = self.fetch(url,headers=self.header).json()
vodList = jo['response']['docs']
videos = []
for vod in vodList:
lastVideo = vod['lastVIDE']['videoSharedCode']
if len(lastVideo) == 0:
lastVideo = '_'
guid = prefix+'###'+vod['column_name']+'###'+lastVideo+'###'+vod['column_logo']
# guid = prefix+'###'+vod['column_website']+'###'+vod['column_logo']
title = vod['column_name']
img = vod['column_logo']
videos.append({
"vod_id":guid,
"vod_name":title,
"vod_pic":img,
"vod_remarks":''
})
result['list'] = videos
result['page'] = pg
result['pagecount'] = 9999
result['limit'] = 90
result['total'] = 999999
return result
def detailContent(self,array):
aid = array[0].split('###')
tid = aid[0]
logo = aid[3]
lastVideo = aid[2]
title = aid[1]
date = aid[0]
if lastVideo == '_':
return {}
lastUrl = 'https://api.cntv.cn/video/videoinfoByGuid?guid={0}&serviceId=tvcctv'.format(lastVideo)
lastJo = self.fetch(lastUrl,headers=self.header).json()
topicId = lastJo['ctid']
url = "https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&d={1}&p=1&n=100&sort=desc&mode=0&serviceId=tvcctv&t=json".format(topicId,date)
jo = self.fetch(url,headers=self.header).json()
vodList = jo['data']['list']
videoList = []
for video in vodList:
videoList.append(video['title']+"$"+video['guid'])
if len(videoList) == 0:
return {}
if len(date) == 0:
date = time.strftime("%Y", time.localtime(time.time()))
vod = {
"vod_id":array[0],
"vod_name":date +" "+title,
"vod_pic":logo,
"type_name":lastJo['channel'],
"vod_year":date,
"vod_area":"",
"vod_remarks":date,
"vod_actor":"",
"vod_director":topicId,
"vod_content":"当前页面默认只展示最新100期的内容,可在分类页面选择年份和月份进行往期节目查看。年份和月份仅影响当前页面内容,不参与分类过滤。视频默认播放可以获取到的最高帧率。"
}
vod['vod_play_from'] = 'CCTV'
vod['vod_play_url'] = "#".join(videoList)
result = {
'list':[
vod
]
}
return result
def searchContent(self,key,quick):
result = {
'list':[]
}
return result
def playerContent(self,flag,id,vipFlags):
result = {}
url = "https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid={0}".format(id)
jo = self.fetch(url,headers=self.header).json()
link = jo['hls_url'].strip()
rsp = self.fetch(link,headers=self.header)
content = rsp.text.strip()
arr = content.split('\n')
urlPrefix = self.regStr(link,'(http[s]?://[a-zA-z0-9.]+)/')
subUrl = arr[-1].split('/')
subUrl[3] = '1200'
subUrl[-1] = '1200.m3u8'
hdUrl = urlPrefix + '/'.join(subUrl)
url = urlPrefix + arr[-1]
hdRsp = self.fetch(hdUrl,headers=self.header)
if hdRsp.status_code == 200:
url = hdUrl
result["parse"] = 0
result["playUrl"] = ''
result["url"] = url
result["header"] = ''
return result
config = {
"player": {},
"filter": {"CCTV":[{"key":"cid","name":"频道","value":[{"n":"全部","v":""},{"n":"CCTV-1综合","v":"EPGC1386744804340101"},{"n":"CCTV-2财经","v":"EPGC1386744804340102"},{"n":"CCTV-3综艺","v":"EPGC1386744804340103"},{"n":"CCTV-4中文国际","v":"EPGC1386744804340104"},{"n":"CCTV-5体育","v":"EPGC1386744804340107"},{"n":"CCTV-6电影","v":"EPGC1386744804340108"},{"n":"CCTV-7国防军事","v":"EPGC1386744804340109"},{"n":"CCTV-8电视剧","v":"EPGC1386744804340110"},{"n":"CCTV-9纪录","v":"EPGC1386744804340112"},{"n":"CCTV-10科教","v":"EPGC1386744804340113"},{"n":"CCTV-11戏曲","v":"EPGC1386744804340114"},{"n":"CCTV-12社会与法","v":"EPGC1386744804340115"},{"n":"CCTV-13新闻","v":"EPGC1386744804340116"},{"n":"CCTV-14少儿","v":"EPGC1386744804340117"},{"n":"CCTV-15音乐","v":"EPGC1386744804340118"},{"n":"CCTV-16奥林匹克","v":"EPGC1634630207058998"},{"n":"CCTV-17农业农村","v":"EPGC1563932742616872"},{"n":"CCTV-5+体育赛事","v":"EPGC1468294755566101"}]},{"key":"fc","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":"影视"}]},{"key":"fl","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"month","name":"月份","value":[{"n":"全部","v":""},{"n":"12","v":"12"},{"n":"11","v":"11"},{"n":"10","v":"10"},{"n":"09","v":"09"},{"n":"08","v":"08"},{"n":"07","v":"07"},{"n":"06","v":"06"},{"n":"05","v":"05"},{"n":"04","v":"04"},{"n":"03","v":"03"},{"n":"02","v":"02"},{"n":"01","v":"01"}]}]}
}
header = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36",
"Origin": "https://tv.cctv.com",
"Referer": "https://tv.cctv.com/"
}
def localProxy(self,param):
return [200, "video/MP2T", action, ""]
+411
View File
@@ -0,0 +1,411 @@
#coding=utf-8
#!/usr/bin/python
import sys
sys.path.append('..')
from base.spider import Spider
import base64
import math
import json
import requests
import urllib
from urllib import request, parse
import urllib.request
import re
class Spider(Spider):
def getName(self):
return "西瓜视频(个人中心)"
def init(self,extend=""):
self.userid=self.get_userid()
def isVideoFormat(self,url):
pass
def manualVideoCheck(self):
pass
def homeContent(self,filter):
result = {}
cateManual = {
"电视剧":"dianshiju",
"电影":"dianying",
"动漫":"dongman",
"纪录片":"jilupian",
"少儿":"shaoer",
"综艺":"zongyi",
"关注":"follow"
}
if self.userid=='':
del 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):
result = {
'list': []
}
return result
userid=''
def categoryContent(self,tid,pg,filter,extend):
result = {}
idTxt='电视剧'
maximum=17
url = 'https://www.ixigua.com/api/cinema/filterv2/albums'
if tid=='dianying':
idTxt='电影'
elif tid=='zongyi':
idTxt='综艺'
elif tid=='dianshiju':
idTxt='电视剧'
elif tid=='dongman':
idTxt='动漫'
elif tid=='jilupian':
idTxt='纪录片'
elif tid=='shaoer':
idTxt='少儿'
elif tid=='follow':
offset=0 if int(pg)<2 else 20*int(pg)
url='https://www.ixigua.com/api/userv2/follow/list?authorId={0}&sortType=desc&sortType=desc&cursor={1}'.format(self.userid,offset)
maximum=12
videos=[]
if tid!='follow':
offset=0 if int(pg)<2 else 18*int(pg)
self.header['Referer']='https://www.ixigua.com/cinema/filter/'.format(tid)
data=r'{"pinyin":"'+tid+'","filters":{"type":"'+idTxt+'","area":"全部地区","tag":"全部类型","sort":"综合排序","paid":"全部资费"},"offset":'+str(offset)+',"limit":18}'
req = request.Request(url=url, data=bytes(data, encoding='utf8'),headers=self.header, method='POST')
response = request.urlopen(req)
urlTxt=response.read().decode('utf-8')
videos= self.get_list_videoGroup_json(jsonTxt=urlTxt)
else:
rsp=self.fetch(url,headers=self.header)
urlTxt=rsp.text
videos= self.get_list_videoGroup_follow_json(jsonTxt=urlTxt)
numvL = len(videos)
result['list'] = videos
result['page'] = pg
result['pagecount'] = pg if int(numvL)<maximum else int(pg)+1
result['limit'] = numvL
result['total'] = numvL
return result
def get_userid(self):
Url='https://www.ixigua.com/'
rsp=self.fetch(Url,headers=self.header)
htmlTxt = rsp.text
userid= self.get_RegexGetText(Text=htmlTxt,RegexText=r'"identity":{"id":"(\d+?)",',Index=1)
return userid
def detailContent(self,array):
result = {}
aid = array[0].split('###')
key = aid[1]
title = aid[0]
act=aid[2]
logo = aid[3]
Url='https://www.ixigua.com/api/albumv2/details?albumId={0}'.format(key)
if len(aid)==5:
Url='https://www.ixigua.com/api/videov2/author/new_video_list?to_user_id={0}'.format(key)
rsp = self.fetch(Url,headers=self.header)
htmlTxt = rsp.text
typeName=''
area=''
dir=''
cont=''
vip='true'
videoList=[]
if len(aid)==5:
jRoot = json.loads(htmlTxt)
if jRoot['code']!=200:
return result
jo = jRoot['data']
jsonList=jo['videoList']
for value in jsonList:
id="{0}${1}_false".format(value['title'],value.get('group_id'))
videoList.append(id)
dir=title
elif htmlTxt.find('playlist')>2:
jRoot = json.loads(htmlTxt)
if jRoot['code']!=200:
return result
jo = jRoot['data']
jsonList=jo['playlist']
if jsonList is not None:
for value in jsonList:
id="{0}${1}?id={2}_{3}".format(value['title'],value['albumId'],value['episodeId'],vip)
videoList.append(id)
playFrom=[v for v in jo['albumInfo']['tagList']]
typeName='/'.join(playFrom)
playFrom=[v for v in jo['albumInfo']['areaList']]
area='/'.join(playFrom)
playFrom=[v['name'] for v in jo['albumInfo']['directorList']]
dir='/'.join(playFrom)
cont=jo['albumInfo']['intro']
if len(videoList)<1:
return result
vod = {
"vod_id":array[0],
"vod_name":title,
"vod_pic":logo,
"type_name":typeName,
"vod_year":'',
"vod_area":area,
"vod_remarks":"",
"vod_actor":'',
"vod_director":dir,
"vod_content":cont
}
vod['vod_play_from'] = '西瓜'
vod['vod_play_url'] = "#".join(videoList)
result = {
'list':[
vod
]
}
return result
def verifyCode(self):
pass
def searchContent(self,key,quick):
Url='https://www.ixigua.com/api/searchv2/lvideo/{0}/0'.format(urllib.parse.quote(key))
rsp = self.fetch(Url,headers=self.header)
htmlTxt = rsp.text
videos=self.get_list(html=htmlTxt)
'''
Url='https://www.ixigua.com/api/searchv2/user/{0}/10'.format(urllib.parse.quote(key))
rsp = self.fetch(Url,headers=self.header)
htmlTxt1 = rsp.text
videos=self.get_list_user(html=htmlTxt1)
'''
result = {
'list': videos
}
return result
def playerContent(self,flag,id,vipFlags):
result={}
UrlId=id.split('_')
Url='https://www.ixigua.com/{0}'.format(UrlId[0])
headers = {
'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3947.100 Mobile Safari/537.36'
}
jx=1 if UrlId[1]=='true' else 0
result["parse"] = 1#0=直接播放,1=解析
result["playUrl"] = ''
result["url"] = Url
result['jx'] = jx#VIP解析
result["header"] =headers
return result
def get_RegexGetText(self,Text,RegexText,Index):
returnTxt=""
Regex=re.search(RegexText, Text, re.M|re.I)
if Regex is None:
returnTxt=""
else:
returnTxt=Regex.group(Index)
return returnTxt
def get_RegexGetTextLine(self,Text,RegexText,Index):
returnTxt=[]
pattern = re.compile(RegexText)
ListRe=pattern.findall(Text)
if len(ListRe)<1:
return returnTxt
for value in ListRe:
returnTxt.append(value)
return returnTxt
def get_playlist(self,Text,headStr,endStr):
circuit=""
origin=Text.find(headStr)
if origin>8:
end=Text.find(endStr,origin)
circuit=Text[origin:end]
return circuit
def removeHtml(self,txt):
soup = re.compile(r'<[^>]+>',re.S)
txt =soup.sub('', txt)
return txt.replace("&nbsp;"," ")
def get_webReadFile(self,urlStr):
headers = {
'Referer':urlStr,
'User-Agent': 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36',
'Host': 'www.ikmjw.com'
}
req = urllib.request.Request(url=urlStr, headers=headers)
html = urllib.request.urlopen(req).read().decode('utf-8')
return html
def get_list(self,html):
result={}
jRoot = json.loads(html)
if jRoot['code']!=0:
return result
jo = jRoot['data']
if len(jo)<1:
return result
vodList = jo['data']
if len(vodList)<1:
return result
videos=[]
img='_'
artist='_'
for vod in vodList:
if vod['type']!='lvideo':
continue
data=vod['data']
display=data['display']
title =display['name']
if len(title)==0:
continue
episode_link=display.get('episode_link')
asc_link=episode_link.get('asc_link')
KeyName='album_id'
if asc_link is None:
asc_link=episode_link.get('desc_link')
KeyName='album_id'
id=asc_link[0].get('album_id')
sslocal=asc_link[0]['scheme_url']
if sslocal!=None and sslocal.find('sslocal:')<0:
continue
video_cover_info=display.get('video_cover_info')
img=video_cover_info['url'] if video_cover_info is not None else '_'
try:
artist=display['actor']
except Exception:
artist=''
remarks=display['rating']
vod_id="{0}###{1}###{2}###{3}".format(title,id,artist,img)
videos.append({
"vod_id":vod_id,
"vod_name":title,
"vod_pic":img,
"vod_remarks":remarks
})
return videos
def get_list_user(self,html):
result={}
jRoot = json.loads(html)
if jRoot['code']!=0:
return result
jo = jRoot['data']
if len(jo)<1:
return result
vodList = jo['data']
if len(vodList)<1:
return result
videos=[]
img='_'
artist='_'
for vod in vodList:
if vod['type']!='user':
continue
data=vod['data']
img=data['avatar']
title =data['name']
log_pb=json.loads(data.get('log_pb'))
user_auth_info=json.loads(data.get('user_auth_info'))
remarks=user_auth_info['auth_info']
id=log_pb.get('search_result_id')
vod_id="{0}###{1}###{2}###{3}###{4}".format(title,id,artist,img,'user')
videos.append({
"vod_id":vod_id,
"vod_name":title,
"vod_pic":img,
"vod_remarks":remarks
})
return videos
def get_list_videoGroup_json(self,jsonTxt):
result={}
jRoot = json.loads(jsonTxt)
if jRoot['code']!=200:
return result
jo = jRoot['data']
vodList = jo['albumList']
if len(vodList)<1:
return result
videos=[]
img='_'
artist='_'
for vod in vodList:
url =vod['albumId']
title =vod['title']
imgList =vod.get('coverList')
if len(imgList)>0:
img=imgList[0]['url']
remarks=vod['subTitle']
artistList=vod.get('actorList')
if artistList is not None:
artistList=artistList if len(artistList)<5 else artistList[0:4]
artist='/'.join(artistList)
if len(title)==0:
continue
#标题###地址###演员###封面
vod_id="{0}###{1}###{2}###{3}".format(title,url,artist,img)
videos.append({
"vod_id":vod_id,
"vod_name":title,
"vod_pic":img,
"vod_remarks":remarks
})
return videos
def get_list_videoGroup_follow_json(self,jsonTxt):
videos=[]
jRoot = json.loads(jsonTxt)
if jRoot['code']!=0:
return videos
jo = jRoot['data']
vodList=jo['data']
if len(vodList)<1:
return videos
img='_'
artist=''
for vod in vodList:
url =vod.get('user_id')
title =vod['name']
img =vod.get('avatar_url')
remarks=vod['description']
artistList=vod.get('actorList')
artist=title
if len(title)==0:
continue
#标题###地址###演员###封面
vod_id="{0}###{1}###{2}###{3}###{4}".format(title,url,artist,img,'user')
videos.append({
"vod_id":vod_id,
"vod_name":title,
"vod_pic":img,
"vod_remarks":remarks
})
return videos
def get_lineList(self,Txt,mark,after):
circuit=[]
origin=Txt.find(mark)
while origin>8:
end=Txt.find(after,origin)
circuit.append(Txt[origin:end])
origin=Txt.find(mark,end)
return circuit
def get_EpisodesList(self,jsonList):
vodItems=[]
for value in jsonList:
vodItems.append(value['title']+"$"+'https://www.ixigua.com/{0}?logTag=55abe18cfb733871bb04'.format(value['episodeId']))
return vodItems
config = {
"player": {},
"filter": {}
}
header = {
"Cookie":"s_v_web_id=verify_lev3h43l_rrTPrFDG_ztWQ_4ugg_8WBA_yGVYsXlVyoBh; passport_csrf_token=80e0efe90bc8bd6681a896dd90cd08cc; passport_csrf_token_default=80e0efe90bc8bd6681a896dd90cd08cc; __ac_nonce=0643361890096533c765; __ac_signature=_02B4Z6wo00f01JPVVrAAAIDBcisHPfWA66CT91IAAEDK9840CE-PheNOCgA4VtrFG0-K.KkLmAR5KsI-Xx-6dBXxz.ABWU2OpEd22kF7biwGaVmGR7an4S1heLEU9xpv0ObRSHFHDslR7uL8fb; support_webp=true; support_avif=false; MONITOR_WEB_ID=45c3b6ab-7ad4-4805-b971-5962d1d6909a; ttwid=1%7CCueNR-HU9tGVF30WaiFCjXDxh0FUXoXsZr-cIb9Dogg%7C1681089268%7Cf0eeaa2016a602a277055494954f083e9f7fa8121c5dd1162db9195932fa167b; odin_tt=386a42a5740f9859d4670373fc8c70cf320ea5b227aed04bcc53fde26c233e8c952a8b0ba5f80fd3d46f9663fa595d8c; sid_guard=842b56710f55021912487890e7d5bef3%7C1681089337%7C3024001%7CMon%2C+15-May-2023+01%3A15%3A38+GMT; uid_tt=b7eb5b73cd72bed6d3c2e1e1e8aaa9f3; uid_tt_ss=b7eb5b73cd72bed6d3c2e1e1e8aaa9f3; sid_tt=842b56710f55021912487890e7d5bef3; sessionid=842b56710f55021912487890e7d5bef3; sessionid_ss=842b56710f55021912487890e7d5bef3; sid_ucp_v1=1.0.0-KGQ2YzBlMDFiMzIyMjY0YTIwMDg2MjZmZGQzMTE5MmFlYTYzY2EwMTMKFQjL2cnx9AIQucbNoQYYGCAMOAhABRoCaGwiIDg0MmI1NjcxMGY1NTAyMTkxMjQ4Nzg5MGU3ZDViZWYz; ssid_ucp_v1=1.0.0-KGQ2YzBlMDFiMzIyMjY0YTIwMDg2MjZmZGQzMTE5MmFlYTYzY2EwMTMKFQjL2cnx9AIQucbNoQYYGCAMOAhABRoCaGwiIDg0MmI1NjcxMGY1NTAyMTkxMjQ4Nzg5MGU3ZDViZWYz; csrf_session_id=c58adecac1d20d91d8c61e72ce0c6fdb; ixigua-a-s=3; msToken=St3ptsHkwBjPgGvRWhZfVdhHO_K16vTizxxna17draCvt4ekz6DQXO6c2Ctrp6gOnn9_Abm83-a9URQp5rKb-JIPs4mQPn2fpKlQRY6jLDBWUdLYTePIAACU6cY2fk40; tt_scid=nN3WPItw72gnB5PDiGcHveirXDZ8oDl5n.ihKN583mmZhoe.uLhFpy3JOL8wrsQO0ed1",
"Referer": 'https://www.ixigua.com/cinema/filter/dianshiju/',
'User-Agent':'User-Agent: Mozilla%2F5.0+(Windows+NT+10.0%3B+WOW64)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F63.0.3239.132+Safari%2F537.36',
'Host': 'www.ixigua.com',
'Accept': 'application/json, text/plain, */*',
'x-secsdk-csrf-token': '0001000000017b593ba6251b18bd7bce2753042917bb36e534867b9606317584c00b0ae836c61754314b7365128e',
'tt-anti-token': 'oDr7A3PDDFq4pWzk-707faf92a9e3040f5c6ed4284d53b05b7091221852c0e9d32bca9fcfe5035225',
'content-type': 'application/json'
}
def localProxy(self,param):
return [200, "video/MP2T", action, ""]