From a14fa9a786569b27eb281ac1b10ea19ea187586d Mon Sep 17 00:00:00 2001 From: T00700 <119649139+T00700@users.noreply.github.com> Date: Mon, 30 Jan 2023 12:24:12 +0800 Subject: [PATCH] Delete TVBox_PY directory --- TVBox_PY/py_3qu.py | 191 ----- TVBox_PY/py_77.py | 175 ---- TVBox_PY/py_ali.py | 405 --------- TVBox_PY/py_ali_subtitle.py | 445 ---------- TVBox_PY/py_bili.py | 175 ---- TVBox_PY/py_bilibili.py | 175 ---- TVBox_PY/py_bilibili2.py | 379 -------- TVBox_PY/py_bilibili3.py | 1476 -------------------------------- TVBox_PY/py_bilibili4.py | 875 ------------------- TVBox_PY/py_bilifanju.py | 214 ----- TVBox_PY/py_bilimd.py | 214 ----- TVBox_PY/py_bilimy.py | 216 ----- TVBox_PY/py_bilivd.py | 231 ----- TVBox_PY/py_biliys.py | 541 ------------ TVBox_PY/py_bilizb.py | 665 -------------- TVBox_PY/py_cctv.py | 149 ---- TVBox_PY/py_cctv_1.py | 227 ----- TVBox_PY/py_cctv_full.py | 218 ----- TVBox_PY/py_changzhang.py | 244 ------ TVBox_PY/py_chuangyi.py | 216 ----- TVBox_PY/py_coke.py | 232 ----- TVBox_PY/py_cokemv.py | 232 ----- TVBox_PY/py_cyys.py | 242 ------ TVBox_PY/py_czspp.py | 300 ------- TVBox_PY/py_douban.py | 128 --- TVBox_PY/py_douyu.py | 138 --- TVBox_PY/py_freezb.py | 161 ---- TVBox_PY/py_genmov.py | 202 ----- TVBox_PY/py_gimytv.py | 216 ----- TVBox_PY/py_gitcafe.py | 136 --- TVBox_PY/py_huya.py | 140 --- TVBox_PY/py_if101.py | 86 -- TVBox_PY/py_ikan.py | 206 ----- TVBox_PY/py_jrskbs.py | 158 ---- TVBox_PY/py_jumi.py | 216 ----- TVBox_PY/py_kunyu77.py | 175 ---- TVBox_PY/py_lezhutv.py | 238 ----- TVBox_PY/py_libvio.py | 234 ----- TVBox_PY/py_mac.py | 82 -- TVBox_PY/py_pansou.py | 92 -- TVBox_PY/py_qie.py | 137 --- TVBox_PY/py_voflix.py | 228 ----- TVBox_PY/py_wmkk.py | 176 ---- TVBox_PY/py_xmaomi.py | 258 ------ TVBox_PY/py_yangshi.py | 149 ---- TVBox_PY/py_yangshiquanji.py | 218 ----- TVBox_PY/py_yiso.py | 63 -- TVBox_PY/py_yixi.py | 126 --- TVBox_PY/py_yytv.py | 136 --- TVBox_PY/py_zhaozy.py | 85 -- TVBox_PY/py_zxzj.py | 246 ------ TVBox_PY/spider_77.py | 172 ---- TVBox_PY/spider_alipansou.py | 58 -- TVBox_PY/spider_aliyundrive.py | 426 --------- TVBox_PY/spider_gitcafe.py | 70 -- TVBox_PY/spider_zhaoziyuan.py | 52 -- 56 files changed, 13645 deletions(-) delete mode 100644 TVBox_PY/py_3qu.py delete mode 100644 TVBox_PY/py_77.py delete mode 100644 TVBox_PY/py_ali.py delete mode 100644 TVBox_PY/py_ali_subtitle.py delete mode 100644 TVBox_PY/py_bili.py delete mode 100644 TVBox_PY/py_bilibili.py delete mode 100644 TVBox_PY/py_bilibili2.py delete mode 100644 TVBox_PY/py_bilibili3.py delete mode 100644 TVBox_PY/py_bilibili4.py delete mode 100644 TVBox_PY/py_bilifanju.py delete mode 100644 TVBox_PY/py_bilimd.py delete mode 100644 TVBox_PY/py_bilimy.py delete mode 100644 TVBox_PY/py_bilivd.py delete mode 100644 TVBox_PY/py_biliys.py delete mode 100644 TVBox_PY/py_bilizb.py delete mode 100644 TVBox_PY/py_cctv.py delete mode 100644 TVBox_PY/py_cctv_1.py delete mode 100644 TVBox_PY/py_cctv_full.py delete mode 100644 TVBox_PY/py_changzhang.py delete mode 100644 TVBox_PY/py_chuangyi.py delete mode 100644 TVBox_PY/py_coke.py delete mode 100644 TVBox_PY/py_cokemv.py delete mode 100644 TVBox_PY/py_cyys.py delete mode 100644 TVBox_PY/py_czspp.py delete mode 100644 TVBox_PY/py_douban.py delete mode 100644 TVBox_PY/py_douyu.py delete mode 100644 TVBox_PY/py_freezb.py delete mode 100644 TVBox_PY/py_genmov.py delete mode 100644 TVBox_PY/py_gimytv.py delete mode 100644 TVBox_PY/py_gitcafe.py delete mode 100644 TVBox_PY/py_huya.py delete mode 100644 TVBox_PY/py_if101.py delete mode 100644 TVBox_PY/py_ikan.py delete mode 100644 TVBox_PY/py_jrskbs.py delete mode 100644 TVBox_PY/py_jumi.py delete mode 100644 TVBox_PY/py_kunyu77.py delete mode 100644 TVBox_PY/py_lezhutv.py delete mode 100644 TVBox_PY/py_libvio.py delete mode 100644 TVBox_PY/py_mac.py delete mode 100644 TVBox_PY/py_pansou.py delete mode 100644 TVBox_PY/py_qie.py delete mode 100644 TVBox_PY/py_voflix.py delete mode 100644 TVBox_PY/py_wmkk.py delete mode 100644 TVBox_PY/py_xmaomi.py delete mode 100644 TVBox_PY/py_yangshi.py delete mode 100644 TVBox_PY/py_yangshiquanji.py delete mode 100644 TVBox_PY/py_yiso.py delete mode 100644 TVBox_PY/py_yixi.py delete mode 100644 TVBox_PY/py_yytv.py delete mode 100644 TVBox_PY/py_zhaozy.py delete mode 100644 TVBox_PY/py_zxzj.py delete mode 100644 TVBox_PY/spider_77.py delete mode 100644 TVBox_PY/spider_alipansou.py delete mode 100644 TVBox_PY/spider_aliyundrive.py delete mode 100644 TVBox_PY/spider_gitcafe.py delete mode 100644 TVBox_PY/spider_zhaoziyuan.py diff --git a/TVBox_PY/py_3qu.py b/TVBox_PY/py_3qu.py deleted file mode 100644 index a897313..0000000 --- a/TVBox_PY/py_3qu.py +++ /dev/null @@ -1,191 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -import re -sys.path.append('..') -from base.spider import Spider -import urllib.parse -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 = { - "电影": "movie", - "剧集": "serie", - "综艺": "variety", - "动漫": "anime" - } - 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 - - def categoryContent(self, tid, pg, filter, extend): - result = {} - header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - url = 'https://www.3qu.live/videos/{0}?page={1}'.format(tid, pg) - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='main-content-box']/div/div/div/div/div/div/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - picl = a.xpath('./@style')[0] - pica = re.findall(r"url\(\'(.*)\'\);", picl)[0] - pic = 'https://www.3qu.live{0}'.format(pica) - sidh = a.xpath("./@href")[0] - sid = self.regStr(sidh,'/videos/(\\S+).html') - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": "" - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 100 - result['total'] = 99999 - return result - - def detailContent(self, array): - tid = array[0] - url = 'https://www.3qu.live/videos/{0}.html'.format(tid) - header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - divContent = root.xpath("//div[@class='video-detail row']")[0] - title = divContent.xpath(".//div[@class='info-box']/a/h1/text()")[0] - pica = divContent.xpath(".//div[@class='thumb-box']/img/@src")[0] - pic = 'https://www.3qu.live{0}'.format(pica) - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": "" - } - infoArray = divContent.xpath(".//div[@class='info-box']/ul/li") - for info in infoArray: - content = info.xpath('string(.)') - flag = "类型" in content - if flag == True: - infon = content.strip().split(' ') - for inf in infon: - if inf.startswith('类型'): - vod['type_name'] = inf.replace("类型:", "") - if inf.startswith('地区'): - vod['vod_area'] = inf.replace("地区:", "") - if inf.startswith('语言'): - vod['vod_remarks'] = inf.replace("语言:", "") - if content.startswith('演员'): - vod['vod_actor'] = content.replace("演员:", "") - if content.startswith('年份'): - yearl = content.split(' ') - year = yearl[0].replace("年份:", "") - vod['vod_year'] = year - if content.startswith('导演'): - vod['vod_director'] = content.replace("导演:", "") - if content.startswith('简介'): - vod['vod_content'] = content.replace("简介:", "") - vodList = root.xpath(".//div[@class='tab-content']/div[@id='playlist']/a") - playUrl = '' - for vl in vodList: - name = vl.xpath("./text()")[0] - did = vl.xpath("./@data-id")[0] - playUrl = playUrl + '{0}${1}_{2}#'.format(name,tid,did) - vod['vod_play_from'] = '快播影视' - vod['vod_play_url'] = playUrl - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - header = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - url = 'https://www.3qu.live/api/v1/search?page=1&q={0}&type=all&period=0'.format(key) - rsp = self.fetch(url, headers=header) - jRoot = json.loads(rsp.text) - videos = [] - vodList = jRoot['data']['videos'] - for vod in vodList: - id = vod['id'] - title = vod['name'] - img = vod['coverURL'] - pic = 'https://www.3qu.live{0}'.format(img) - videos.append({ - "vod_id": id, - "vod_name": title, - "vod_pic": pic, - "vod_remarks": "" - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - ids = id.split("_") - header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - url = 'https://www.3qu.live/api/v1/videos/{0}/{1}/playUrl'.format(ids[0],ids[1]) - rsp = self.fetch(url,headers=header) - jRoot = json.loads(rsp.text) - apiurl = jRoot['data']['url'] - url = 'https://www.3qu.live{0}'.format(apiurl) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] =url - result["header"] = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = { - 'url': '', - 'header': '', - 'param': '', - 'type': 'string', - 'after': '' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_77.py b/TVBox_PY/py_77.py deleted file mode 100644 index b4c15fa..0000000 --- a/TVBox_PY/py_77.py +++ /dev/null @@ -1,175 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json - -class Spider(Spider): - def getName(self): - return "77" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - url = 'http://api.kunyu77.com/api.php/provide/filter' - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - classes = [] - jData = jo['data'] - for cKey in jData.keys(): - classes.append({ - 'type_name':jData[cKey][0]['cat'], - 'type_id':cKey - }) - result['class'] = classes - if(filter): - result['filters'] = self.config['filter'] - return result - def homeVideoContent(self): - url = 'http://api.kunyu77.com/api.php/provide/homeBlock?type_id=0' - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - blockList = jo['data']['blocks'] - videos = [] - for block in blockList: - vodList = block['contents'] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - if 'type_id' not in extend.keys(): - extend['type_id'] = tid - extend['pagenum'] = pg - filterParams = ["type_id", "pagenum"] - params = ["", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = '&'+filterParams[idx]+'='+extend[fp] - suffix = ''.join(params) - url = 'http://api.kunyu77.com/api.php/provide/searchFilter?pagesize=24{0}'.format(suffix) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data']['result'] - videos = [] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - 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://api.kunyu77.com/api.php/provide/videoDetail?devid=453CA5D864457C7DB4D0EAA93DE96E66&package=com.sevenVideo.app.android&version=1.8.7&ids={0}'.format(tid) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - node = jo['data'] - vod = { - "vod_id":node['id'], - "vod_name":node['videoName'], - "vod_pic":node['videoCover'], - "type_name":node['subCategory'], - "vod_year":node['year'], - "vod_area":node['area'], - "vod_remarks":node['msg'], - "vod_actor":node['actor'], - "vod_director":node['director'], - "vod_content":node['brief'].strip() - } - listUrl = 'http://api.kunyu77.com/api.php/provide/videoPlaylist?devid=453CA5D864457C7DB4D0EAA93DE96E66&package=com.sevenVideo.app.android&version=1.8.7&ids={0}'.format(tid) - listRsp = self.fetch(listUrl,headers=self.header) - listJo = json.loads(listRsp.text) - playMap = {} - episodes = listJo['data']['episodes'] - for ep in episodes: - playurls = ep['playurls'] - for playurl in playurls: - source = playurl['playfrom'] - if source not in playMap.keys(): - playMap[source] = [] - playMap[source].append(playurl['title'].strip() + '$' + playurl['playurl']) - - playFrom = [] - playList = [] - for key in playMap.keys(): - playFrom.append(key) - playList.append('#'.join(playMap[key])) - - vod_play_from = '$$$' - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - vod_play_url = vod_play_url.join(playList) - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - - def searchContent(self,key,quick): - url = 'http://api.kunyu77.com/api.php/provide/searchVideo?searchName={0}'.format(key) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data'] - videos = [] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['videoName'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - result = { - 'list':videos - } - return result - - config = { - "player": {}, - "filter": {} - } - header = { - "User-Agent":"Dalvik/2.1.0" - } - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'http://api.kunyu77.com/api.php/provide/parserUrl?url={0}'.format(id) - jo = self.fetch(url,headers=self.header).json() - result = { - 'parse':0, - 'jx':0, - 'playUrl':'', - 'url':id, - 'header':'' - } - if flag in vipFlags: - result['parse'] = 1 - result['jx'] = 1 - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_ali.py b/TVBox_PY/py_ali.py deleted file mode 100644 index def9c1b..0000000 --- a/TVBox_PY/py_ali.py +++ /dev/null @@ -1,405 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import requests -import time -import re - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "阿里云盘" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - def searchContent(self,key,quick): - result = {} - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def playerContent(self,flag,id,vipFlags): - if flag == 'AliYun': - return self.originContent(flag,id,vipFlags) - elif flag == 'AliYun原画': - return self.fhdContent(flag,id,vipFlags) - else: - return {} - def fhdContent(self,flag,id,vipFlags): - self.login() - ids = id.split('+') - shareId = ids[0] - shareToken = ids[1] - fileId = ids[2] - category = ids[3] - url = self.getDownloadUrl(shareId,shareToken,fileId,category) - print(url) - - noRsp = requests.get(url,headers=self.header, allow_redirects=False,verify = False) - realUrl = '' - if 'Location' in noRsp.headers: - realUrl = noRsp.headers['Location'] - if 'location' in noRsp.headers and len(realUrl) == 0 : - realUrl = noRsp.headers['location'] - newHeader = { - "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", - "referer":"https://www.aliyundrive.com/", - } - result = { - 'parse':'0', - 'playUrl':'', - 'url':realUrl, - 'header':newHeader - } - return result - def originContent(self,flag,id,vipFlags): - self.login() - ids = id.split('+') - shareId = ids[0] - shareToken = ids[1] - fileId = ids[2] - url = '{0}?do=push_agent&api=python&type=m3u8&share_id={1}&file_id={2}'.format(self.localProxyUrl,shareId,fileId) - - result = { - 'parse':'0', - 'playUrl':'', - 'url':url, - 'header':'' - } - - # shareToken = self.getToken(shareId,'') - # self.getMediaSlice(shareId,shareToken,fileId) - - - # map = { - # 'share_id':'p1GJYEqgeb2', - # 'file_id':'62ed1b95b1048d60ffc246669f5e0999e90b8c2f', - # 'media_id':'1' - # } - - # self.proxyMedia(map) - - return result - - def detailContent(self,array): - tid = array[0] - # shareId = self.regStr(href,'www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?') - # todo ========================================================================================= - m = re.search('www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?', tid) - col = m.groups() - shareId = col[0] - fileId = col[2] - - infoUrl = 'https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous' - - infoForm = {'share_id':shareId} - infoRsp = requests.post(infoUrl,json = infoForm,headers=self.header) - infoJo = json.loads(infoRsp.text) - - infoJa = [] - if 'file_infos' in infoJo: - infoJa = infoJo['file_infos'] - if len(infoJa) <= 0 : - return '' - fileInfo = {} - # todo - fileInfo = infoJa[0] - print(fileId) - if fileId == None or len(fileId) <= 0: - fileId = fileInfo['file_id'] - - vodList = { - 'vod_id':tid, - 'vod_name':infoJo['share_name'], - 'vod_pic':infoJo['avatar'], - 'vod_content':tid, - 'vod_play_from':'AliYun原画$$$AliYun' - } - fileType = fileInfo['type'] - if fileType != 'folder': - if fileType != 'file' or fileInfo['category'] != video: - return '' - fileId = 'root' - - shareToken = self.getToken(shareId,'') - hashMap = {} - self.listFiles(hashMap,shareId,shareToken,fileId) - - sortedMap = sorted(hashMap.items(), key=lambda x: x[0]) - arrayList = [] - playList = [] - - for sm in sortedMap: - arrayList.append(sm[0]+'$'+sm[1]) - playList.append('#'.join(arrayList)) - playList.append('#'.join(arrayList)) - vodList['vod_play_url'] = '$$$'.join(playList) - - result = { - 'list':[vodList] - } - return result - - authorization = '' - timeoutTick = 0 - localTime = 0 - expiresIn = 0 - shareTokenMap = {} - expiresMap = {} - localMedia = {} - header = { - "Referer":"https://www.aliyundrive.com/", - "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" - } - localProxyUrl = 'http://127.0.0.1:UndCover/proxy' - - def redirectResponse(tUrl): - rsp = requests.get(tUrl, allow_redirects=False,verify = False) - if 'Location' in rsp.headers: - return redirectResponse(rsp.headers['Location']) - else: - return rsp - - def getDownloadUrl(self,shareId,token,fileId,category): - lShareId = shareId - lFileId = fileId - params = { - "share_id": lShareId, - "category": "live_transcoding", - "file_id": lFileId, - "template_id": "" - } - customHeader = self.header.copy() - customHeader['x-share-token'] = token - customHeader['authorization'] = self.authorization - url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' - if category == 'video': - rsp = requests.post(url,json = params,headers=customHeader) - rspJo = json.loads(rsp.text) - lShareId = rspJo['share_id'] - lFileId = rspJo['file_id'] - jo = { - - } - if category == 'video': - jo['share_id'] = lShareId - jo['file_id'] = lFileId - jo['expire_sec'] = 600 - if category == 'audio': - jo['share_id'] = lShareId - jo['file_id'] = lFileId - jo['get_audio_play_info'] = True - downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url' - downloadRsp = requests.post(downloadUrl,json = jo,headers=customHeader) - resultJo = json.loads(downloadRsp.text) - return resultJo['download_url'] - - def getMediaSlice(self,shareId,token,fileId): - params = { - "share_id": shareId, - "category": "live_transcoding", - "file_id": fileId, - "template_id": "" - } - customHeader = self.header.copy() - customHeader['x-share-token'] = token - customHeader['authorization'] = self.authorization - url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' - - rsp = requests.post(url,json = params,headers=customHeader) - rspJo = json.loads(rsp.text) - - quality = ['FHD','HD','SD'] - videoList = rspJo['video_preview_play_info']['live_transcoding_task_list'] - highUrl = '' - for q in quality: - if len(highUrl) > 0: - break - for video in videoList: - if(video['template_id'] == q): - highUrl = video['url'] - break - if len(highUrl) == 0: - highUrl = videoList[0]['url'] - - noRsp = requests.get(highUrl,headers=self.header, allow_redirects=False,verify = False) - m3u8Url = '' - if 'Location' in noRsp.headers: - m3u8Url = noRsp.headers['Location'] - if 'location' in noRsp.headers and len(m3u8Url) == 0 : - m3u8Url = noRsp.headers['location'] - m3u8Rsp = requests.get(m3u8Url,headers=self.header) - m3u8Content = m3u8Rsp.text - - tmpArray = m3u8Url.split('/')[0:-1] - host = '/'.join(tmpArray) + '/' - - m3u8List = [] - mediaMap = {} - slices = m3u8Content.split("\n") - count = 0 - for slice in slices: - tmpSlice = slice - if 'x-oss-expires' in tmpSlice: - count = count + 1 - mediaMap[str(count)] = host+tmpSlice - - tmpSlice = "{0}?do=push_agent&api=python&type=media&share_id={1}&file_id={2}&media_id={3}".format(self.localProxyUrl,shareId,fileId,count) - m3u8List.append(tmpSlice) - - self.localMedia[fileId] = mediaMap - - return '\n'.join(m3u8List) - - def proxyMedia(self,map): - shareId = map['share_id'] - fileId = map['file_id'] - mediaId = map['media_id'] - shareToken = self.getToken(shareId,'') - - refresh = False - url = '' - ts = 0 - if fileId in self.localMedia: - fileMap = self.localMedia[fileId] - if mediaId in fileMap: - url = fileMap[mediaId] - if len(url) > 0: - ts = int(self.regStr(url,"x-oss-expires=(\\d+)&")) - - # url = self.localMedia[fileId][mediaId] - - # ts = int(self.regStr(url,"x-oss-expires=(\\d+)&")) - - self.localTime = int(time.time()) - - if ts - self.localTime <= 60: - self.getMediaSlice(shareId,shareToken,fileId) - url = self.localMedia[fileId][mediaId] - - action = { - 'url':url, - 'header':self.header, - 'param':'', - 'type':'stream', - 'after':'' - } - print(action) - return [200, "video/MP2T", action, ""] - - def proxyM3U8(self,map): - shareId = map['share_id'] - fileId = map['file_id'] - - shareToken = self.getToken(shareId,'') - content = self.getMediaSlice(shareId,shareToken,fileId) - - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - - return [200, "application/octet-stream", action, content] - - def localProxy(self,param): - typ = param['type'] - if typ == "m3u8": - return self.proxyM3U8(param) - if typ == "media": - return self.proxyMedia(param) - return None - - def getToken(self,shareId,sharePwd): - self.localTime = int(time.time()) - shareToken = '' - if shareId in self.shareTokenMap: - shareToken = self.shareTokenMap[shareId] - # todo - expire = self.expiresMap[shareId] - if len(shareToken) > 0 and expire - self.localTime > 600: - return shareToken - params = { - 'share_id':shareId, - 'share_pwd':sharePwd - } - url = 'https://api.aliyundrive.com/v2/share_link/get_share_token' - rsp = requests.post(url,json = params,headers=self.header) - jo = json.loads(rsp.text) - newShareToken = jo['share_token'] - self.expiresMap[shareId] = self.localTime + int(jo['expires_in']) - self.shareTokenMap[shareId] = newShareToken - - print(self.expiresMap) - print(self.shareTokenMap) - - return newShareToken - - def listFiles(self,map,shareId,shareToken,fileId): - url = 'https://api.aliyundrive.com/adrive/v3/file/list' - newHeader = self.header.copy() - newHeader['x-share-token'] = shareToken - params = { - 'image_thumbnail_process':'image/resize,w_160/format,jpeg', - 'image_url_process':'image/resize,w_1920/format,jpeg', - 'limit':200, - 'order_by':'updated_at', - 'order_direction':'DESC', - 'parent_file_id':fileId, - 'share_id':shareId, - 'video_thumbnail_process':'video/snapshot,t_1000,f_jpg,ar_auto,w_300' - } - maker = '' - arrayList = [] - for i in range(1,51): - if i >= 2 and len(maker) == 0: - break - params['marker'] = maker - rsp = requests.post(url,json = params,headers=newHeader) - jo = json.loads(rsp.text) - ja = jo['items'] - for jt in ja: - if jt['type'] == 'folder': - arrayList.append(jt['file_id']) - else: - if 'video' in jt['mime_type'] or 'video' in jt['category']: - repStr = jt['name'].replace("#", "_").replace("$", "_") - map[repStr] = shareId + "+" + shareToken + "+" + jt['file_id'] + "+" + jt['category'] - # print(repStr,shareId + "+" + shareToken + "+" + jt['file_id']) - maker = jo['next_marker'] - i = i + 1 - - for item in arrayList: - self.listFiles(map,shareId,shareToken,item) - - def login(self): - self.localTime = int(time.time()) - url = 'https://api.aliyundrive.com/token/refresh' - if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600: - form = { - 'refresh_token':'4acb3ad2f2254ba1b566279f7cd98ba3' - } - rsp = requests.post(url,json = form,headers=self.header) - jo = json.loads(rsp.text) - self.authorization = jo['token_type'] + ' ' + jo['access_token'] - self.expiresIn = int(jo['expires_in']) - self.timeoutTick = self.localTime + self.expiresIn - - # print(self.authorization) - # print(self.timeoutTick) - # print(self.localTime) - # print(self.expiresIn) diff --git a/TVBox_PY/py_ali_subtitle.py b/TVBox_PY/py_ali_subtitle.py deleted file mode 100644 index 99ca2ae..0000000 --- a/TVBox_PY/py_ali_subtitle.py +++ /dev/null @@ -1,445 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import requests -import time -import re - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "阿里云盘" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - def searchContent(self,key,quick): - result = {} - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def playerContent(self,flag,id,vipFlags): - if flag == 'AliYun': - return self.originContent(flag,id,vipFlags) - elif flag == 'AliYun原画': - return self.fhdContent(flag,id,vipFlags) - else: - return {} - def fhdContent(self,flag,id,vipFlags): - if not self.login(): - return {} - ids = id.split('+') - shareId = ids[0] - shareToken = ids[1] - fileId = ids[2] - category = ids[3] - subtitle = ids[4] - url = self.getDownloadUrl(shareId,shareToken,fileId,category) - - noRsp = requests.get(url,headers=self.header, allow_redirects=False,verify = False) - realUrl = '' - if 'Location' in noRsp.headers: - realUrl = noRsp.headers['Location'] - if 'location' in noRsp.headers and len(realUrl) == 0 : - realUrl = noRsp.headers['location'] - newHeader = { - "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", - "referer":"https://www.aliyundrive.com/", - } - subtitleUrl = self.subtitleContent(id) - result = { - 'parse':'0', - 'playUrl':'', - 'url':realUrl, - 'header':newHeader, - 'subt':subtitleUrl - } - return result - def subtitleContent(self,id): - ids = id.split('+') - shareId = ids[0] - shareToken = ids[1] - fileId = ids[2] - category = ids[3] - subtitle = ids[4] - if len(subtitle) == 0: - return "" - - customHeader = self.header.copy() - customHeader['x-share-token'] = shareToken - customHeader['authorization'] = self.authorization - - jo = { - "expire_sec": 600, - "share_id": shareId, - "file_id": subtitle, - "image_url_process": "image/resize,w_1920/format,jpeg", - "image_thumbnail_process": "image/resize,w_1920/format,jpeg", - "get_streams_url": True - # , - # "drive_id": "183237630" - } - - downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url' - resultJo = requests.post(downloadUrl,json = jo,headers=customHeader).json() - print(resultJo) - noRsp = requests.get(resultJo['download_url'],headers=self.header, allow_redirects=False,verify = False) - realUrl = '' - if 'Location' in noRsp.headers: - realUrl = noRsp.headers['Location'] - if 'location' in noRsp.headers and len(realUrl) == 0 : - realUrl = noRsp.headers['location'] - return realUrl - - def originContent(self,flag,id,vipFlags): - if not self.login(): - return {} - ids = id.split('+') - shareId = ids[0] - shareToken = ids[1] - fileId = ids[2] - subtitle = ids[4] - url = '{0}?do=push_agent&api=python&type=m3u8&share_id={1}&file_id={2}'.format(self.localProxyUrl,shareId,fileId) - subtitleUrl = self.subtitleContent(id) - newHeader = { - "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", - "referer":"https://www.aliyundrive.com/", - } - result = { - 'parse':'0', - 'playUrl':'', - 'url':url, - 'header':newHeader, - 'subt':subtitleUrl - } - return result - - def detailContent(self,array): - tid = array[0] - m = re.search('www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?', tid) - col = m.groups() - shareId = col[0] - fileId = col[2] - - infoUrl = 'https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous' - - infoForm = {'share_id':shareId} - infoRsp = requests.post(infoUrl,json = infoForm,headers=self.header) - infoJo = json.loads(infoRsp.text) - - infoJa = [] - if 'file_infos' in infoJo: - infoJa = infoJo['file_infos'] - if len(infoJa) <= 0 : - return '' - fileInfo = {} - - fileInfo = infoJa[0] - - if fileId == None or len(fileId) <= 0: - fileId = fileInfo['file_id'] - - vodList = { - 'vod_id':tid, - 'vod_name':infoJo['share_name'], - 'vod_pic':infoJo['avatar'], - 'vod_content':tid, - 'vod_play_from':'AliYun$$$AliYun原画' - } - fileType = fileInfo['type'] - if fileType != 'folder': - if fileType != 'file' or fileInfo['category'] != video: - return '' - fileId = 'root' - - shareToken = self.getToken(shareId,'') - hashMap = {} - self.listFiles(hashMap,shareId,shareToken,fileId) - - sortedMap = sorted(hashMap.items(), key=lambda x: x[0]) - arrayList = [] - playList = [] - - for sm in sortedMap: - arrayList.append(sm[0]+'$'+sm[1]) - playList.append('#'.join(arrayList)) - playList.append('#'.join(arrayList)) - vodList['vod_play_url'] = '$$$'.join(playList) - - result = { - 'list':[vodList] - } - return result - - authorization = '' - timeoutTick = 0 - localTime = 0 - expiresIn = 0 - shareTokenMap = {} - expiresMap = {} - localMedia = {} - header = { - "Referer":"https://www.aliyundrive.com/", - "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" - } - localProxyUrl = 'http://127.0.0.1:UndCover/proxy' - - def redirectResponse(tUrl): - rsp = requests.get(tUrl, allow_redirects=False,verify = False) - if 'Location' in rsp.headers: - return redirectResponse(rsp.headers['Location']) - else: - return rsp - - def getDownloadUrl(self,shareId,token,fileId,category): - lShareId = shareId - lFileId = fileId - params = { - "share_id": lShareId, - "category": "live_transcoding", - "file_id": lFileId, - "template_id": "" - } - customHeader = self.header.copy() - customHeader['x-share-token'] = token - customHeader['authorization'] = self.authorization - url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' - if category == 'video': - rsp = requests.post(url,json = params,headers=customHeader) - rspJo = json.loads(rsp.text) - lShareId = rspJo['share_id'] - lFileId = rspJo['file_id'] - jo = { - - } - if category == 'video': - jo['share_id'] = lShareId - jo['file_id'] = lFileId - jo['expire_sec'] = 600 - if category == 'audio': - jo['share_id'] = lShareId - jo['file_id'] = lFileId - jo['get_audio_play_info'] = True - downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url' - downloadRsp = requests.post(downloadUrl,json = jo,headers=customHeader) - resultJo = json.loads(downloadRsp.text) - return resultJo['download_url'] - - def getMediaSlice(self,shareId,token,fileId): - params = { - "share_id": shareId, - "category": "live_transcoding", - "file_id": fileId, - "template_id": "" - } - customHeader = self.header.copy() - customHeader['x-share-token'] = token - customHeader['authorization'] = self.authorization - url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' - - rsp = requests.post(url,json = params,headers=customHeader) - rspJo = json.loads(rsp.text) - - quality = ['FHD','HD','SD'] - videoList = rspJo['video_preview_play_info']['live_transcoding_task_list'] - highUrl = '' - for q in quality: - if len(highUrl) > 0: - break - for video in videoList: - if(video['template_id'] == q): - highUrl = video['url'] - break - if len(highUrl) == 0: - highUrl = videoList[0]['url'] - - noRsp = requests.get(highUrl,headers=self.header, allow_redirects=False,verify = False) - m3u8Url = '' - if 'Location' in noRsp.headers: - m3u8Url = noRsp.headers['Location'] - if 'location' in noRsp.headers and len(m3u8Url) == 0 : - m3u8Url = noRsp.headers['location'] - m3u8Rsp = requests.get(m3u8Url,headers=self.header) - m3u8Content = m3u8Rsp.text - - tmpArray = m3u8Url.split('/')[0:-1] - host = '/'.join(tmpArray) + '/' - - m3u8List = [] - mediaMap = {} - slices = m3u8Content.split("\n") - count = 0 - for slice in slices: - tmpSlice = slice - if 'x-oss-expires' in tmpSlice: - count = count + 1 - mediaMap[str(count)] = host+tmpSlice - - tmpSlice = "{0}?do=push_agent&api=python&type=media&share_id={1}&file_id={2}&media_id={3}".format(self.localProxyUrl,shareId,fileId,count) - m3u8List.append(tmpSlice) - - self.localMedia[fileId] = mediaMap - - return '\n'.join(m3u8List) - - def proxyMedia(self,map): - shareId = map['share_id'] - fileId = map['file_id'] - mediaId = map['media_id'] - shareToken = self.getToken(shareId,'') - - refresh = False - url = '' - ts = 0 - if fileId in self.localMedia: - fileMap = self.localMedia[fileId] - if mediaId in fileMap: - url = fileMap[mediaId] - if len(url) > 0: - ts = int(self.regStr(url,"x-oss-expires=(\\d+)&")) - - self.localTime = int(time.time()) - - if ts - self.localTime <= 60: - self.getMediaSlice(shareId,shareToken,fileId) - url = self.localMedia[fileId][mediaId] - - action = { - 'url':url, - 'header':self.header, - 'param':'', - 'type':'stream', - 'after':'' - } - return [200, "video/MP2T", action, ""] - - def proxyM3U8(self,map): - shareId = map['share_id'] - fileId = map['file_id'] - - shareToken = self.getToken(shareId,'') - content = self.getMediaSlice(shareId,shareToken,fileId) - - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - - return [200, "application/octet-stream", action, content] - - def localProxy(self,param): - if not self.login(): - return {} - typ = param['type'] - if typ == "m3u8": - return self.proxyM3U8(param) - if typ == "media": - return self.proxyMedia(param) - return None - - def getToken(self,shareId,sharePwd): - self.localTime = int(time.time()) - shareToken = '' - if shareId in self.shareTokenMap: - shareToken = self.shareTokenMap[shareId] - # todo - expire = self.expiresMap[shareId] - if len(shareToken) > 0 and expire - self.localTime > 600: - return shareToken - params = { - 'share_id':shareId, - 'share_pwd':sharePwd - } - url = 'https://api.aliyundrive.com/v2/share_link/get_share_token' - rsp = requests.post(url,json = params,headers=self.header) - jo = json.loads(rsp.text) - newShareToken = jo['share_token'] - self.expiresMap[shareId] = self.localTime + int(jo['expires_in']) - self.shareTokenMap[shareId] = newShareToken - - # print(self.expiresMap) - # print(self.shareTokenMap) - - return newShareToken - - def listFiles(self,map,shareId,shareToken,fileId,subtitle={}): - url = 'https://api.aliyundrive.com/adrive/v3/file/list' - newHeader = self.header.copy() - newHeader['x-share-token'] = shareToken - params = { - 'image_thumbnail_process':'image/resize,w_160/format,jpeg', - 'image_url_process':'image/resize,w_1920/format,jpeg', - 'limit':200, - 'order_by':'updated_at', - 'order_direction':'DESC', - 'parent_file_id':fileId, - 'share_id':shareId, - 'video_thumbnail_process':'video/snapshot,t_1000,f_jpg,ar_auto,w_300' - } - maker = '' - arrayList = [] - for i in range(1,51): - if i >= 2 and len(maker) == 0: - break - params['marker'] = maker - rsp = requests.post(url,json = params,headers=newHeader) - jo = json.loads(rsp.text) - ja = jo['items'] - for jt in ja: - if jt['type'] == 'folder': - arrayList.append(jt['file_id']) - else: - if 'video' in jt['mime_type'] or 'video' in jt['category']: - repStr = jt['name'].replace("#", "_").replace("$", "_").replace(jt['file_extension'],'')[0:-1] - map[repStr] = shareId + "+" + shareToken + "+" + jt['file_id'] + "+" + jt['category'] + "+" - elif 'others' == jt['category'] and ('srt' == jt['file_extension'] or 'ass' == jt['file_extension']): - repStr = jt['name'].replace("#", "_").replace("$", "_").replace(jt['file_extension'],'')[0:-1] - subtitle[repStr] = jt['file_id'] - maker = jo['next_marker'] - i = i + 1 - - for item in arrayList: - self.listFiles(map,shareId,shareToken,item,subtitle) - for key in map.keys(): - for subKey in subtitle.keys(): - if key in subKey and map[key][-1] == "+": - map[key]=map[key]+subtitle[subKey] - break - - def login(self): - self.localTime = int(time.time()) - url = 'https://api.aliyundrive.com/token/refresh' - if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600: - form = { - 'refresh_token':'4acb3ad2f2254ba1b566279f7cd98ba3' - } - rsp = requests.post(url,json = form,headers=self.header) - jo = json.loads(rsp.text) - if rsp.status_code == 200: - self.authorization = jo['token_type'] + ' ' + jo['access_token'] - self.expiresIn = int(jo['expires_in']) - self.timeoutTick = self.localTime + self.expiresIn - return True - return False - else: - return True - - # print(self.authorization) - # print(self.timeoutTick) - # print(self.localTime) - # print(self.expiresIn) \ No newline at end of file diff --git a/TVBox_PY/py_bili.py b/TVBox_PY/py_bili.py deleted file mode 100644 index 7597b37..0000000 --- a/TVBox_PY/py_bili.py +++ /dev/null @@ -1,175 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { - "Zard": "Zard", - "玩具汽车": "玩具汽车", - "儿童": "儿童", - "幼儿": "幼儿", - "儿童玩具": "儿童玩具", - "昆虫": "昆虫", - "动物世界": "动物世界", - "纪录片": "纪录片", - "相声小品": "相声小品", - "搞笑": "搞笑", - "假窗-白噪音": "窗+白噪音", - "演唱会": "演唱会" - } - 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 - cookies = '' - def getCookie(self): - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - return rsp.cookies - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&duration=4&page={1}'.format(tid,pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url,cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url,cookies=self.getCookie()) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("","").replace("","") - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def cleanSpace(self,str): - return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') - def detailContent(self,array): - aid = array[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - - rsp = self.fetch(url,headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['title'].replace("","").replace("","") - pic = jo['pic'] - desc = jo['desc'] - typeName = jo['tname'] - vod = { - "vod_id":aid, - "vod_name":title, - "vod_pic":pic, - "type_name":typeName, - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":desc - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'] - playUrl = playUrl + '{0}${1}_{2}#'.format(part,aid,cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - # https://www.555dianying.cc/vodplay/static/js/playerconfig.js - result = {} - - ids = id.split("_") - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid=%20%20{1}&qn=112'.format(ids[0],ids[1]) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer":"https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_bilibili.py b/TVBox_PY/py_bilibili.py deleted file mode 100644 index 7597b37..0000000 --- a/TVBox_PY/py_bilibili.py +++ /dev/null @@ -1,175 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { - "Zard": "Zard", - "玩具汽车": "玩具汽车", - "儿童": "儿童", - "幼儿": "幼儿", - "儿童玩具": "儿童玩具", - "昆虫": "昆虫", - "动物世界": "动物世界", - "纪录片": "纪录片", - "相声小品": "相声小品", - "搞笑": "搞笑", - "假窗-白噪音": "窗+白噪音", - "演唱会": "演唱会" - } - 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 - cookies = '' - def getCookie(self): - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - return rsp.cookies - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&duration=4&page={1}'.format(tid,pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url,cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url,cookies=self.getCookie()) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("","").replace("","") - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def cleanSpace(self,str): - return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') - def detailContent(self,array): - aid = array[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - - rsp = self.fetch(url,headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['title'].replace("","").replace("","") - pic = jo['pic'] - desc = jo['desc'] - typeName = jo['tname'] - vod = { - "vod_id":aid, - "vod_name":title, - "vod_pic":pic, - "type_name":typeName, - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":desc - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'] - playUrl = playUrl + '{0}${1}_{2}#'.format(part,aid,cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - # https://www.555dianying.cc/vodplay/static/js/playerconfig.js - result = {} - - ids = id.split("_") - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid=%20%20{1}&qn=112'.format(ids[0],ids[1]) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer":"https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_bilibili2.py b/TVBox_PY/py_bilibili2.py deleted file mode 100644 index cf15ec4..0000000 --- a/TVBox_PY/py_bilibili2.py +++ /dev/null @@ -1,379 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { - "动态":"动态", - "热门":"热门", - "排行榜":"排行榜", - "频道":"频道", - "历史记录":"历史记录", - "zane妈":"zane妈", - "相声小品": "相声小品", - "林芊妤":"林芊妤", - "Zard": "Zard", - "玩具汽车": "玩具汽车", - "儿童": "儿童", - "幼儿": "幼儿", - "儿童玩具": "儿童玩具", - "昆虫": "昆虫", - "动物世界": "动物世界", - "纪录片": "纪录片", - "搞笑": "搞笑", - "假窗-白噪音": "窗+白噪音", - "演唱会": "演唱会" - } - 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 - cookies = '' - def getCookie(self): - import requests - import http.cookies - ### 这里加cookie - raw_cookie_line = "" - simple_cookie = http.cookies.SimpleCookie(raw_cookie_line) - cookie_jar = requests.cookies.RequestsCookieJar() - cookie_jar.update(simple_cookie) - return cookie_jar - def get_dynamic(self,pg): - result = {} - if int(pg) > 1: - return result - offset = '' - videos = [] - for i in range(0,10): - url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={0}&offset={1}'.format(pg,offset) - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - offset = jo['data']['offset'] - vodList = jo['data']['items'] - for vod in vodList: - if vod['type'] == 'DYNAMIC_TYPE_AV': - ivod = vod['modules']['module_dynamic']['major']['archive'] - aid = str(ivod['aid']).strip() - title = ivod['title'].strip().replace("","").replace("","") - img = ivod['cover'].strip() - remark = str(ivod['duration_text']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def second_to_time(self,a): - #将秒数转化为 时分秒的格式 - if a < 3600: - return time.strftime("%M:%S", time.gmtime(a)) - else: - return time.strftime("%H:%M:%S", time.gmtime(a)) - def get_history(self,pg): - result = {} - url = 'http://api.bilibili.com/x/v2/history?pn=%s' % pg - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - jo = json.loads(content) #解析api接口,转化成json数据对象 - if jo['code'] == 0: - videos = [] - vodList = jo['data'] - for vod in vodList: - if vod['duration'] > 0: #筛选掉非视频的历史记录 - aid = str(vod["aid"]).strip() #获取 aid - #获取标题 - title = vod["title"].replace("", "").replace("", "").replace(""", - '"') - #封面图片 - img = vod["pic"].strip() - - #获取已观看时间 - if str(vod['progress'])=='-1': - process=str(self.second_to_time(vod['duration'])).strip() - else: - process = str(self.second_to_time(vod['progress'])).strip() - #获取视频总时长 - total_time= str(self.second_to_time(vod['duration'])).strip() - #组合 已观看时间 / 总时长 ,赋值给 remark - remark = process+' / '+total_time - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def get_hot(self,pg): - result = {} - url= 'https://api.bilibili.com/x/web-interface/popular?ps=20&pn={0}'.format(pg) - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("","").replace("","") - img = vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def get_rank(self): - result = {} - url= 'https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all' - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("","").replace("","") - img = vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - def get_channel(self,pg,cid): - result = {} - if int(pg) > 1: - return result - offset = '' - videos = [] - for i in range(0,5): - url= 'https://api.bilibili.com/x/web-interface/web/channel/multiple/list?channel_id={0}&sort_type=hot&offset={1}&page_size=30'.format(cid,offset) - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - print(content) - jo = json.loads(content) - if jo['code'] == 0: - offset = jo['data']['offset'] - vodList = jo['data']['list'] - for vod in vodList: - if vod['card_type'] == 'rank': - rankVods = vod['items'] - for ivod in rankVods: - aid = str(ivod['id']).strip() - title = ivod['name'].strip().replace("","").replace("","") - img = ivod['cover'].strip() - remark = str(ivod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - elif vod['card_type'] == 'archive': - aid = str(vod['id']).strip() - title = vod['name'].strip().replace("","").replace("","") - img = vod['cover'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def categoryContent(self,tid,pg,filter,extend): - print(tid,pg,filter,extend) - result = {} - if tid == "热门": - return self.get_hot(pg=pg) - if tid == "排行榜" : - return self.get_rank() - if tid == '动态': - return self.get_dynamic(pg=pg) - if tid == '历史记录': - return self.get_history(pg=pg) - if tid == '频道': - cid = '9222' - if 'cid' in extend: - cid = extend['cid'] - return self.get_channel(pg=pg,cid=cid) - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}'.format(tid,pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url,cookies=self.getCookie()) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url,cookies=self.getCookie()) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = tid + ":" + vod['title'].strip().replace("","").replace("","") - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def cleanSpace(self,str): - return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') - def detailContent(self,array): - aid = array[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - - rsp = self.fetch(url,headers=self.header,cookies=self.getCookie()) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['title'].replace("","").replace("","") - pic = jo['pic'] - desc = jo['desc'] - typeName = jo['tname'] - vod = { - "vod_id":aid, - "vod_name":title, - "vod_pic":pic, - "type_name":typeName, - "vod_year":"", - "vod_area":"bilidanmu", - "vod_remarks":"", - "vod_actor":jo['owner']['name'], - "vod_director":jo['owner']['name'], - "vod_content":desc - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'] - playUrl = playUrl + '{0}${1}_{2}#'.format(part,aid,cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - search = self.categoryContent(tid=key,pg=1,filter=None,extend=None) - result = { - 'list':search['list'] - } - return result - def playerContent(self,flag,id,vipFlags): - # https://www.555dianying.cc/vodplay/static/js/playerconfig.js - result = {} - - ids = id.split("_") - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid=%20%20{1}&qn=112'.format(ids[0],ids[1]) - rsp = self.fetch(url,cookies=self.getCookie()) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer":"https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {"频道":[{"key":"cid","name":"分类","value":[{'n': '搞笑', 'v': 1833}, {'n': '美食', 'v': 20215}, {'n': '鬼畜', 'v': 68}, {'n': '天官赐福', 'v': 2544632}, {'n': '英雄联盟', 'v': 9222}, {'n': '美妆', 'v': 832569}, {'n': '必剪创作', 'v': 15775524}, {'n': '单机游戏', 'v': 17683}, {'n': '搞笑', 'v': 1833}, {'n': '科普', 'v': 5417}, {'n': '影视剪辑', 'v': 318570}, {'n': 'vlog', 'v': 2511282}, {'n': '声优', 'v': 1645}, {'n': '动漫杂谈', 'v': 530918}, {'n': 'COSPLAY', 'v': 88}, {'n': '漫展', 'v': 22551}, {'n': 'MAD', 'v': 281}, {'n': '手书', 'v': 608}, {'n': '英雄联盟', 'v': 9222}, {'n': '王者荣耀', 'v': 1404375}, {'n': '单机游戏', 'v': 17683}, {'n': '我的世界', 'v': 47988}, {'n': '守望先锋', 'v': 926988}, {'n': '恐怖游戏', 'v': 17941}, {'n': '英雄联盟', 'v': 9222}, {'n': '王者荣耀', 'v': 1404375}, {'n': '守望先锋', 'v': 926988}, {'n': '炉石传说', 'v': 318756}, {'n': 'DOTA2', 'v': 47034}, {'n': 'CS:GO', 'v': 99842}, {'n': '鬼畜', 'v': 68}, {'n': '鬼畜调教', 'v': 497221}, {'n': '诸葛亮', 'v': 51330}, {'n': '二次元鬼畜', 'v': 29415}, {'n': '王司徒', 'v': 987568}, {'n': '万恶之源', 'v': 21}, {'n': '美妆', 'v': 832569}, {'n': '服饰', 'v': 313718}, {'n': '减肥', 'v': 20805}, {'n': '穿搭', 'v': 1139735}, {'n': '发型', 'v': 13896}, {'n': '化妆教程', 'v': 261355}, {'n': '电音', 'v': 14426}, {'n': '欧美音乐', 'v': 17034}, {'n': '中文翻唱', 'v': 8043}, {'n': '洛天依', 'v': 8564}, {'n': '翻唱', 'v': 386}, {'n': '日文翻唱', 'v': 85689}, {'n': '科普', 'v': 5417}, {'n': '技术宅', 'v': 368}, {'n': '历史', 'v': 221}, {'n': '科学', 'v': 1364}, {'n': '人文', 'v': 40737}, {'n': '科幻', 'v': 5251}, {'n': '手机', 'v': 7007}, {'n': '手机评测', 'v': 143751}, {'n': '电脑', 'v': 1339}, {'n': '摄影', 'v': 25450}, {'n': '笔记本', 'v': 1338}, {'n': '装机', 'v': 413678}, {'n': '课堂教育', 'v': 3233375}, {'n': '公开课', 'v': 31864}, {'n': '演讲', 'v': 2739}, {'n': 'PS教程', 'v': 335752}, {'n': '编程', 'v': 28784}, {'n': '英语学习', 'v': 360005}, {'n': '喵星人', 'v': 1562}, {'n': '萌宠', 'v': 6943}, {'n': '汪星人', 'v': 9955}, {'n': '大熊猫', 'v': 22919}, {'n': '柴犬', 'v': 30239}, {'n': '吱星人', 'v': 6947}, {'n': '美食', 'v': 20215}, {'n': '甜点', 'v': 35505}, {'n': '吃货', 'v': 6942}, {'n': '厨艺', 'v': 239855}, {'n': '烘焙', 'v': 218245}, {'n': '街头美食', 'v': 1139423}, {'n': 'A.I.Channel', 'v': 3232987}, {'n': '虚拟UP主', 'v': 4429874}, {'n': '神楽めあ', 'v': 7562902}, {'n': '白上吹雪', 'v': 7355391}, {'n': '彩虹社', 'v': 1099778}, {'n': 'hololive', 'v': 8751822}, {'n': 'EXO', 'v': 191032}, {'n': '防弹少年团', 'v': 536395}, {'n': '肖战', 'v': 1450880}, {'n': '王一博', 'v': 902215}, {'n': '易烊千玺', 'v': 15186}, {'n': 'BLACKPINK', 'v': 1749296}, {'n': '宅舞', 'v': 9500}, {'n': '街舞', 'v': 5574}, {'n': '舞蹈教学', 'v': 157087}, {'n': '明星舞蹈', 'v': 6012204}, {'n': '韩舞', 'v': 159571}, {'n': '古典舞', 'v': 161247}, {'n': '旅游', 'v': 6572}, {'n': '绘画', 'v': 2800}, {'n': '手工', 'v': 11265}, {'n': 'vlog', 'v': 2511282}, {'n': 'DIY', 'v': 3620}, {'n': '手绘', 'v': 1210}, {'n': '综艺', 'v': 11687}, {'n': '国家宝藏', 'v': 105286}, {'n': '脱口秀', 'v': 4346}, {'n': '日本综艺', 'v': 81265}, {'n': '国内综艺', 'v': 641033}, {'n': '人类观察', 'v': 282453}, {'n': '影评', 'v': 111377}, {'n': '电影解说', 'v': 1161117}, {'n': '影视混剪', 'v': 882598}, {'n': '影视剪辑', 'v': 318570}, {'n': '漫威', 'v': 138600}, {'n': '超级英雄', 'v': 13881}, {'n': '影视混剪', 'v': 882598}, {'n': '影视剪辑', 'v': 318570}, {'n': '诸葛亮', 'v': 51330}, {'n': '韩剧', 'v': 53056}, {'n': '王司徒', 'v': 987568}, {'n': '泰剧', 'v': 179103}, {'n': '郭德纲', 'v': 8892}, {'n': '相声', 'v': 5783}, {'n': '张云雷', 'v': 1093613}, {'n': '秦霄贤', 'v': 3327368}, {'n': '孟鹤堂', 'v': 1482612}, {'n': '岳云鹏', 'v': 24467}, {'n': '假面骑士', 'v': 2069}, {'n': '特摄', 'v': 2947}, {'n': '奥特曼', 'v': 963}, {'n': '迪迦奥特曼', 'v': 13784}, {'n': '超级战队', 'v': 32881}, {'n': '铠甲勇士', 'v': 11564}, {'n': '健身', 'v': 4344}, {'n': '篮球', 'v': 1265}, {'n': '体育', 'v': 41103}, {'n': '帕梅拉', 'v': 257412}, {'n': '极限运动', 'v': 8876}, {'n': '足球', 'v': 584}, {'n': '星海', 'v': 178862}, {'n': '张召忠', 'v': 116480}, {'n': '航母', 'v': 57834}, {'n': '航天', 'v': 81618}, {'n': '导弹', 'v': 14958}, {'n': '战斗机', 'v': 24304}]}]} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_bilibili3.py b/TVBox_PY/py_bilibili3.py deleted file mode 100644 index 8fe3f1d..0000000 --- a/TVBox_PY/py_bilibili3.py +++ /dev/null @@ -1,1476 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -import requests -from requests import session, utils -import os -import time -import base64 -from time import strftime -from time import gmtime - - - - -class Spider(Spider): # 元类 默认的元类 type - box_video_type = '' - vod_area='bilidanmu' - - def getName(self): - return "哔哩3_带直播" - - - def __init__(self): - - - self.getCookie() - - - - url = 'http://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid=%s&jsonp=jsonp' % (self.userid) - - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - - - - fav_list=[] - - - if jo['code'] == 0: - for fav in jo['data'].get('list'): - - fav_dict = {'n':fav['title'].replace("", "").replace("", "").replace(""", '"').strip() ,'v':fav['id']} - fav_list.append(fav_dict) - - - if self.config["filter"].get('收藏夹'): - for i in self.config["filter"].get('收藏夹'): - if i['key']=='mlid': - i['value']=fav_list - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - - def isVideoFormat(self, url): - pass - - def second_to_time(self,a): - #将秒数转化为 时分秒的格式 - if a < 3600: - return time.strftime("%M:%S", time.gmtime(a)) - else: - return time.strftime("%H:%M:%S", time.gmtime(a)) - - def manualVideoCheck(self): - - pass - - #用户userid - userid='' - - def get_live_userInfo(self,uid): - - url = 'https://api.live.bilibili.com/live_user/v1/Master/info?uid=%s'%uid - - - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - - if jo['code'] == 0: - - return jo['data']["info"]["uname"] - - - - def homeContent(self, filter): - result = {} - cateManual = { - "动态": "动态", - "历史记录": '历史记录', - "收藏夹": '收藏夹', - "热门": "热门", - "排行榜": "排行榜", - "频道": "频道", - "直播": "直播", - "舞蹈": "舞蹈", - "宅舞": "宅舞", - "少女": "少女", - 'cosplay':'cosplay', - 'mmd':'mmd', - - "鬼畜": "鬼畜", - "狗狗": "汪星人", - '科技': '科技', - - "音声": "音声", - "演唱会": "演唱会", - "番剧": "1", - "国创": "4", - "电影": "2", - "综艺": "7", - "电视剧": "5", - "纪录片": "3", - - } - 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): - self.box_video_type = '热门' - return self.get_hot(pg='1') - - cookies = '' - - # def getCookie(self): - # # 在cookies_str中填入会员或大会员cookie,以获得更好的体验。 - # cookies_str = "buvid3=CFF74DA7-E79E-4B53-BB96-FC74AB8CD2F3184997infoc; LIVE_BUVID=AUTO4216125328906835; rpdid=|(umRum~uY~R0J'uYukYukkkY; balh_is_closed=; balh_server_inner=__custom__; PVID=4; video_page_version=v_old_home; i-wanna-go-back=-1; CURRENT_BLACKGAP=0; blackside_state=0; fingerprint=8965144a609d60190bd051578c610d72; buvid_fp_plain=undefined; CURRENT_QUALITY=120; hit-dyn-v2=1; nostalgia_conf=-1; buvid_fp=CFF74DA7-E79E-4B53-BB96-FC74AB8CD2F3184997infoc; CURRENT_FNVAL=4048; DedeUserID=85342; DedeUserID__ckMd5=f070401c4c699c83; b_ut=5; hit-new-style-dyn=0; buvid4=15C64651-E8B7-100C-4B1F-C7CFD2DB473007906-022110820-jYQRaMeS%2BRXRfw14q70%2FLQ%3D%3D; b_nut=1667910208; b_lsid=3CE4AE79_184578915C0; is-2022-channel=1; innersign=0; SESSDATA=a5e4d58d%2C1683641322%2C2c39a%2Ab1; bili_jct=2f3126b5954e37f593130f2fef082cd8; sid=p7tjqv22; bp_video_offset_85342=726936847258746900" - # cookies_dic = dict([co.strip().split('=') for co in cookies_str.split(';')]) - # rsp = session() - # cookies_jar = utils.cookiejar_from_dict(cookies_dic) - # rsp.cookies = cookies_jar - # content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - # res = json.loads(content.text) - # if res["code"] == 0: - # self.cookies = rsp.cookies - # else: - - # rsp = self.fetch("https://www.bilibili.com/") - # self.cookies = rsp.cookies - # return rsp.cookies - def getCookie(self): - - #在下方cookies_str 后面 双引号里面放置你的cookies - cookies_str = "" - if cookies_str: - cookies = dict([co.strip().split('=') for co in cookies_str.split(';')]) - bili_jct = cookies['bili_jct'] - SESSDATA = cookies['SESSDATA'] - DedeUserID = cookies['DedeUserID'] - - cookies_jar={"bili_jct":bili_jct, - 'SESSDATA': SESSDATA, - 'DedeUserID':DedeUserID - - } - rsp = session() - rsp.cookies = cookies_jar - content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - res = json.loads(content.text) - - if res["code"] == 0: - self.cookies = rsp.cookies - self.userid = res["data"].get('mid') - - return rsp.cookies - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - - - return rsp.cookies - - - - - def get_hot(self, pg): - self.box_video_type = '热门' - result = {} - url = 'https://api.bilibili.com/x/web-interface/popular?ps=20&pn={0}'.format(pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid+'&hot', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def str2sec(self,x): - ''' - 字符串时分秒转换成秒 - ''' - x=str(x) - try: - h, m, s = x.strip().split(':') #.split()函数将其通过':'分隔开,.strip()函数用来除去空格 - return int(h)*3600 + int(m)*60 + int(s) #int()函数转换成整数运算 - except: - m, s = x.strip().split(':') #.split()函数将其通过':'分隔开,.strip()函数用来除去空格 - return int(m)*60 + int(s) #int()函数转换成整数运算 - - - def get_rank(self): - self.box_video_type = '排行榜' - result = {} - url = 'https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid+'&rank', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - - def filter_duration(self, vodlist, key): - # 按时间过滤 - if key == '0': - return vodlist - else: - - - vod_list_new = [i for i in vodlist if self.time_diff1[key][0] <= self.str2sec(str(i["vod_remarks"])) < self.time_diff1[key][1]] - return vod_list_new - - - - - chanel_offset='' - def get_channel(self, pg, cid,extend,order,duration_diff): - result = {} - self.box_video_type = '频道' - - - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}'.format( - cid, pg,duration_diff,order) - rsp = self.fetch(url, cookies=self.cookies) - - content = rsp.text - jo = json.loads(content) - if jo.get('code') == 0: - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - remark = str( self.second_to_time(self.str2sec(vod['duration']))).strip() - videos.append({ - "vod_id": aid+'&channale', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - - - #videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - - - - dynamic_offset = '' - - def get_dynamic(self, pg): - self.box_video_type = '动态' - result = {} - - if str(pg) == '1': - url = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page=%s' % pg - else: - # print('偏移',self.dynamic_offset) - url = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&offset=%s&page=%s' % ( - self.dynamic_offset, pg) - - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - self.dynamic_offset = jo['data'].get('offset') - videos = [] - vodList = jo['data']['items'] - for vod in vodList: - if vod['type'] == 'DYNAMIC_TYPE_AV': - #up=vod['modules']["module_author"]['name'] - ivod = vod['modules']['module_dynamic']['major']['archive'] - aid = str(ivod['aid']).strip() - title = ivod['title'].strip().replace("", "").replace("", "") - img = ivod['cover'].strip() - #remark = str(ivod['duration_text']).strip() - remark =str( self.second_to_time(self.str2sec(ivod['duration_text']))).strip() - videos.append({ - "vod_id": aid+'&dynamic', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - - time_diff1={'1':[0,300], - '2':[300,900],'3':[900,1800],'4':[1800,3600], - '5':[3600,99999999999999999999999999999999] - - } - - time_diff='0' - - - def get_fav_detail(self,pg,mlid,order): - result = {} - self.box_video_type = '收藏夹' - - - - url = 'http://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&order=%s&pn=%s&ps=20&platform=web&type=0'%(mlid,order,pg) - rsp = self.fetch(url, cookies=self.cookies) - - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['medias'] - - for vod in vodList: - #print(vod) - #只展示类型为 视频的条目 - #过滤去掉收藏夹中的 已失效视频;如果不喜欢可以去掉这个 if条件 - if vod.get('type') in [2] and vod.get('title') != '已失效视频': - - aid = str(vod['id']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod['cover'].strip() - remark = str( self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid+'&fav', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - - - - #videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - - return result - - def get_fav(self,pg,order,extend): - self.box_video_type = '收藏夹' - - #获取自己的up_mid(也就是用户uid) - - - mlid='' - - fav_config=self.config["filter"].get('收藏夹') - - #默认显示第一个收藏夹内容 - if fav_config: - for i in fav_config: - if i['key']=='mlid': - if len(i['value'])>0: - mlid=i['value'][0]['v'] - - - - - #print(self.config["filter"].get('收藏夹')) - - if 'mlid' in extend: - mlid = extend['mlid'] - if mlid: - return self.get_fav_detail(pg=pg,mlid=mlid,order=order) - else: - return {} - - - - def get_history(self,pg): - result = {} - self.box_video_type = '历史记录' - url = 'http://api.bilibili.com/x/v2/history?pn=%s' % pg - rsp = self.fetch(url,cookies=self.cookies) - content = rsp.text - jo = json.loads(content) #解析api接口,转化成json数据对象 - if jo['code'] == 0: - videos = [] - vodList = jo['data'] - for vod in vodList: - if vod['duration'] > 0: #筛选掉非视频的历史记录 - aid = str(vod["aid"]).strip() #获取 aid - #获取标题 - title = vod["title"].replace("", "").replace("", "").replace(""", - '"') - #封面图片 - img = vod["pic"].strip() - - #获取已观看时间 - if str(vod['progress'])=='-1': - process=str(self.second_to_time(vod['duration'])).strip() - else: - process = str(self.second_to_time(vod['progress'])).strip() - #获取视频总时长 - total_time= str(self.second_to_time(vod['duration'])).strip() - #组合 已观看时间 / 总时长 ,赋值给 remark - remark = process+' / '+total_time - videos.append({ - "vod_id":aid+'&history', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - - def get_live(self,pg,parent_area_id): - result = {} - self.box_video_type = '直播' - - - url = 'https://api.live.bilibili.com/room/v3/area/getRoomList?page=%s&sort_type=online&parent_area_id=%s'%(pg,parent_area_id) - rsp = self.fetch(url, cookies=self.cookies) - - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - - for vod in vodList: - - - - aid = str(vod['roomid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod.get('cover').strip() - remark = '直播间人数:'+str( vod['online']).strip() - videos.append({ - "vod_id": aid+'&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - - - - #videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - - return result - - - - - def categoryContent(self, tid, pg, filter, extend): - - result = {} - - if len(self.cookies) <= 0: - self.getCookie() - - if tid == "热门": - self.box_video_type = '热门' - return self.get_hot(pg=pg) - elif tid == "排行榜": - self.box_video_type = '排行榜' - return self.get_rank() - elif tid == "收藏夹": - self.box_video_type = '收藏夹' - order = 'mtime' - if 'order' in extend: - order = extend['order'] - - return self.get_fav(pg=pg, order=order,extend=extend) - - elif tid == '直播': - self.box_video_type = '直播' - parent_area_id = '0' - if 'parent_area_id' in extend: - parent_area_id = extend['parent_area_id'] - return self.get_live(pg=pg,parent_area_id=parent_area_id) - - - - elif tid == '频道': - self.box_video_type = '频道' - - cid = '搞笑' - if 'cid' in extend: - cid = extend['cid'] - - duration_diff='0' - if 'duration' in extend: - duration_diff = extend['duration'] - - order = 'totalrank' - if 'order' in extend: - order = extend['order'] - - - - - - - return self.get_channel(pg=pg, cid=cid,extend=extend,order=order,duration_diff=duration_diff) - - - elif tid == '动态': - self.box_video_type = '动态' - return self.get_dynamic(pg=pg) - - elif tid == '历史记录': - self.box_video_type = '历史记录' - return self.get_history(pg=pg) - elif tid.isdigit(): - self.box_video_type = '影视' - url = 'https://api.bilibili.com/pgc/season/index/result?order=2&season_status=-1&style_id=-1&sort=0&area=-1&pagesize=20&type=1&st={0}&season_type={0}&page={1}'.format( - tid, pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['index_show'].strip() - videos.append({ - "vod_id": aid+'&movie', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark # 视频part数量 - - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - - - - else: - duration_diff='0' - if 'duration' in extend: - duration_diff = extend['duration'] - - order = 'totalrank' - if 'order' in extend: - order = extend['order'] - - - - - self.box_video_type = '其他' - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}'.format( - tid, pg,duration_diff,order) - rsp = self.fetch(url, cookies=self.cookies) - - content = rsp.text - jo = json.loads(content) - - if jo.get('code') == 0: - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - #remark = str(vod['duration']).strip() - remark =str( self.second_to_time(self.str2sec(vod['duration']))).strip() - videos.append({ - "vod_id": aid+'&other', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - - }) - - - #videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - # if int(array[0])< 1000000: - result={} - arrays = array[0].split("&") - if arrays[-1] == 'movie': - self.box_video_type='影视' - aid = arrays[0] - url = "http://api.bilibili.com/pgc/view/web/season?season_id={0}".format(aid) - rsp = self.fetch(url, headers=self.header) - jRoot = json.loads(rsp.text) - if jRoot['code'] == 0: - jo = jRoot['result'] - id = jo['season_id'] - title = jo['title'] - pic = jo['cover'] - areas = jo['areas'][0]['name'] - typeName = jo['share_sub_title'] - dec = jo['evaluate'] - remark = jo['new_ep']['desc'] - vod = { - "vod_id": id, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - # "vod_area":areas, - "vod_area": self.vod_area, #弹幕是否显示的开关 - "vod_remarks": remark, - "vod_actor": "", - "vod_director": "", - "vod_content": dec - } - ja = jo['episodes'] - playUrl = '' - for tmpJo in ja: - eid = tmpJo['id'] - cid = tmpJo['cid'] - part = tmpJo['title'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, eid, cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - - elif arrays[-1] == 'live': - self.box_video_type='直播' - aid = arrays[0] - - - url = "https://api.live.bilibili.com/room/v1/Room/get_info?room_id=%s"%aid - rsp = self.fetch(url, headers=self.header,cookies=self.cookies) - jRoot = json.loads(rsp.text) - if jRoot.get('code')==0: - jo = jRoot['data'] - title = jo['title'].replace("", "").replace("", "") - pic = jo.get("user_cover") - desc = jo.get('description') - - dire = self.get_live_userInfo(jo["uid"]) - typeName = jo.get("area_name") - remark = '在线人数:'+str(jo['online']).strip() - - vod = { - "vod_id": aid, - "vod_name": '(' + dire + ")" + title, - "vod_pic": pic, - "type_name": typeName, - - "vod_area": self.vod_area, - #"vod_area":"", - "vod_remarks": remark, - "vod_actor": "直播间id-"+aid, - "vod_director": dire, - "vod_content": desc + '\n主播:' + dire, - 'vod_play_from':'B站', - 'vod_play_url':'flv线路原画$platform=web&quality=4_'+aid+'#flv线路高清$platform=web&quality=3_'+aid+'#h5线路原画$platform=h5&quality=4_'+aid+'#h5线路高清$platform=h5&quality=3_'+aid - # 'vod_play_url':aid - } - - - result = { - 'list': [ - vod - ] - } - - else : - self.box_video_type='其他' - aid = arrays[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - rsp = self.fetch(url, headers=self.header) - jRoot = json.loads(rsp.text) - if jRoot['code'] == 0: - jo = jRoot['data'] - title = jo['title'].replace("", "").replace("", "") - pic = jo['pic'] - desc = jo['desc'] - timeStamp = jo['pubdate'] - timeArray = time.localtime(timeStamp) - year = str(time.strftime("%Y", timeArray)) - dire = jo['owner']['name'] - typeName = jo['tname'] - remark = str(jo['duration']).strip() - - vod = { - "vod_id": aid, - "vod_name": '(' + dire + ")" + title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": year, - "vod_area": self.vod_area, - # "vod_area":"", - "vod_remarks": remark, - "vod_actor": '', - - "vod_director": dire, - "vod_content": desc + '\nup主:' + dire - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, aid, cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - self.box_video_type = '搜索' - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page=1'.format(key) - - rsp = self.fetch(url, cookies=self.cookies, headers=header) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url, cookies=self.cookies, headers=header) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id": aid+'&search', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - if self.box_video_type == '影视': - ids = id.split("_") - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - url = 'https://api.bilibili.com/pgc/player/web/playurl?qn=116&ep_id={0}&cid={1}'.format(ids[0], ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies, headers=header) - jRoot = json.loads(rsp.text) - if jRoot['message'] != 'success': - print("需要大会员权限才能观看") - return {} - jo = jRoot['result'] - ja = jo['durl'] - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - result["contentType"] = 'video/x-flv' - self.box_video_type = '影视' - - elif self.box_video_type == '直播': - - ids = id.split("_") - - - url = 'https://api.live.bilibili.com/room/v1/Room/playUrl?cid=%s&%s'%(ids[1],ids[0]) - - #raise Exception(url) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - jRoot = json.loads(rsp.text) - - - if jRoot['code'] == 0: - - - jo = jRoot['data'] - ja = jo['durl'] - - - url = '' - if len(ja) > 0: - - url = ja[0]['url'] - - result["parse"] = 0 - # result['type'] ="m3u8" - result["playUrl"] = '' - - result["url"] = url - result["header"] = { - "Referer": "https://live.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - - self.box_video_type = '直播' - if ids[0]=="h5": - result["contentType"] = '' - else: - result["contentType"] = 'video/x-flv' - - else: - - ids = id.split("_") - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'.format(ids[0], ids[1]) - - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - - maxSize = -1 - position = -1 - - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - result["contentType"] = 'video/x-flv' - self.box_video_type = '其他' - return result - - config = { - "player": {}, - "filter": { - - - - "舞蹈": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }], - - - - "少女": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }], - - "mmd": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }], - - "直播": [{ - "key": "parent_area_id", - "name": "直播分区", - "value": [ - - { - "n": "全部分区", - "v": "0" - }, - - { - "n": "娱乐", - "v": "1" - }, - { - "n": "电台", - "v": "5" - }, - { - "n": "网游", - "v": "2" - }, - { - "n": "手游", - "v": "3" - }, - - - - { - "n": "单机游戏", - "v": "6" - }, - - { - "n": "虚拟主播", - "v": "9" - },{'n': '生活', 'v': 10}, - {'n': '知识', 'v': 11}, - {'n': '赛事', 'v': 13} - - - - ] - }, - ], - - - "音声": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }], - - "收藏夹": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "收藏时间", - "v": "mtime" - }, - - { - "n": "播放量", - "v": "view" - }, - - { - "n": "投稿时间", - "v": "pubtime" - } - - - - ] - }, - { - "key": "mlid", - "name": "收藏夹分区", - "value": [ - ] - }], - "cosplay": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }], - - - - - - - - - - - - - - - - - - - - - - "频道": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - - - { - "n": "最多弹幕", - "v": "dm" - }, - - - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }, {"key": "cid", "name": "分类", - "value":[{'n': '搞笑', 'v': '搞笑'}, {'n': '美食', 'v': '美食'}, {'n': '鬼畜', 'v': '鬼畜'}, {'n': '美妆', 'v': '美妆'}, {'n': 'mmd', 'v': 'mmd'}, {'n': '科普', 'v': '科普'}, {'n': 'COSPLAY', 'v': 'COSPLAY'}, {'n': '漫展', 'v': '漫展'}, {'n': 'MAD', 'v': 'MAD'}, {'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': 'PS教程', 'v': 'PS教程'}, {'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': 'A.I.Channel', 'v': 'A.I.Channel'}, {'n': '虚拟UP主', 'v': '虚拟UP主'}, {'n': '神楽めあ', 'v': '神楽めあ'}, {'n': '白上吹雪', 'v': '白上吹雪'}, {'n': '婺源', 'v': '婺源'}, {'n': 'hololive', 'v': 'hololive'}, {'n': 'EXO', 'v': 'EXO'}, {'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': 'vlog', 'v': 'vlog'}, {'n': 'DIY', 'v': 'DIY'}, {'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': '帕梅拉'}, {'n': '极限运动', 'v': '极限运动'}, {'n': '足球', 'v': '足球'}, {'n': '星海', 'v': '星海'}, {'n': '张召忠', 'v': '张召忠'}, {'n': '航母', 'v': '航母'}, {'n': '航天', 'v': '航天'}, {'n': '导弹', 'v': '导弹'}, {'n': '战斗机', 'v': '战斗机'}] -} - ], - } - } - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - def localProxy(self, param): - - - return [200, "video/MP2T", action, ""] - - -if __name__ == '__main__': - a=Spider() - - - print(a.categoryContent('5','1',filter={},extend='1')) - - - #print(a.get_live(pg=1,parent_area_id='0')) - - a.box_video_type='直播' - print(a.get_hot(pg=1)) - print(a.detailContent(['43000&movie'])) - - - print(a.playerContent('flag', 'flv线路$web_43000#h5线路$h5_43000', 'vipFlags')) - - - - #print(a.get_fav(pg='1',order='mtime',extend={})) - diff --git a/TVBox_PY/py_bilibili4.py b/TVBox_PY/py_bilibili4.py deleted file mode 100644 index c645ae4..0000000 --- a/TVBox_PY/py_bilibili4.py +++ /dev/null @@ -1,875 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -import requests -from requests import session, utils -import time -import base64 - - -class Spider(Spider): - - def getName(self): - return "哔哩哔哩" - - # 主页 - def homeContent(self, filter): - result = {} - cateManual = { - "动态": "动态", - "热门": "热门", - "推荐": "推荐", - "历史记录": "历史记录", - # "稍后再看":"稍后再看", #意义不大,隐藏该项 - "收藏": "收藏", - "动画": "1", - "音乐": "3", - "舞蹈": "129", - "游戏": "4", - "鬼畜": "119", - "知识": "36", - "科技": "188", - "运动": "234", - "生活": "160", - "美食": "211", - "动物": "217", - "汽车": "223", - "时尚": "155", - "娱乐": "5", - "影视": "181", - "每周必看": "每周必看", - "入站必刷": "入站必刷", - "频道": "频道", - } - 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 - - # 用户cookies - cookies = '' - userid = '' - csrf = '' - - def getCookie(self): - import http.cookies - # ----↓↓↓↓↓↓↓----在下方raw_cookie_line后的双引号内填写----↓↓↓↓↓↓↓---- - raw_cookie_line = "" - simple_cookie = http.cookies.SimpleCookie(raw_cookie_line) - cookie_jar = requests.cookies.RequestsCookieJar() - cookie_jar.update(simple_cookie) - rsp = session() - rsp.cookies = cookie_jar - content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - res = json.loads(content.text) - if res["code"] == 0: - self.cookies = rsp.cookies - self.userid = res["data"].get('mid') - self.csrf = rsp.cookies['bili_jct'] - return cookie_jar - - def __init__(self): - self.getCookie() - url = 'https://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid=%s&jsonp=jsonp' % self.userid - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - fav_list = [] - if jo['code'] == 0: - for fav in jo['data'].get('list'): - fav_dict = { - 'n': fav['title'].replace("", "").replace("", "").replace(""", - '"').strip(), - 'v': fav['id']} - fav_list.append(fav_dict) - if self.config["filter"].get('收藏'): - for i in self.config["filter"].get('收藏'): - if i['key'] == 'mlid': - i['value'] = fav_list - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def post_history(self, aid, cid): - url = 'http://api.bilibili.com/x/v2/history/report?aid={0}&cid={1}&csrf={2}'.format(aid, cid, self.csrf) - requests.post(url=url, cookies=self.cookies) - - # 将超过10000的数字换成成以万和亿为单位 - def zh(self, num): - if int(num) >= 100000000: - p = round(float(num) / float(100000000), 1) - p = str(p) + '亿' - else: - if int(num) >= 10000: - p = round(float(num) / float(10000), 1) - p = str(p) + '万' - else: - p = str(num) - return p - - # 将秒数转化为 时分秒的格式 - def second_to_time(self, a): - if a < 3600: - return time.strftime("%M:%S", time.gmtime(a)) - else: - return time.strftime("%H:%M:%S", time.gmtime(a)) - - # 字符串时分秒以及分秒形式转换成秒 - def str2sec(self, x): - x = str(x) - try: - h, m, s = x.strip().split(':') # .split()函数将其通过':'分隔开,.strip()函数用来除去空格 - return int(h) * 3600 + int(m) * 60 + int(s) # int()函数转换成整数运算 - except: - m, s = x.strip().split(':') # .split()函数将其通过':'分隔开,.strip()函数用来除去空格 - return int(m) * 60 + int(s) # int()函数转换成整数运算 - - # 按时间过滤 - def filter_duration(self, vodlist, key): - if key == '0': - return vodlist - else: - vod_list_new = [i for i in vodlist if - self.time_diff1[key][0] <= self.str2sec(str(i["vod_remarks"])) < self.time_diff1[key][1]] - return vod_list_new - - time_diff1 = {'1': [0, 300], - '2': [300, 900], '3': [900, 1800], '4': [1800, 3600], - '5': [3600, 99999999999999999999999999999999] - } - time_diff = '0' - - def homeVideoContent(self): - result = {} - url = 'https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'][0:50] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - dynamic_offset = '' - - def get_dynamic(self, pg): - result = {} - if str(pg) == '1': - url = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page=%s' % pg - else: - # print('偏移',self.dynamic_offset) - url = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&offset=%s&page=%s' % (self.dynamic_offset, pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - self.dynamic_offset = jo['data'].get('offset') - videos = [] - vodList = jo['data']['items'] - for vod in vodList: - if vod['type'] == 'DYNAMIC_TYPE_AV': - up = vod['modules']["module_author"]['name'] - ivod = vod['modules']['module_dynamic']['major']['archive'] - aid = str(ivod['aid']).strip() - title = ivod['title'].strip().replace("", "").replace("", "") - img = ivod['cover'].strip() - # remark = str(ivod['duration_text']).strip() - remark = str(self.second_to_time(self.str2sec(ivod['duration_text']))).strip() + ' ' + str( - up).strip() # 显示分钟数+up主名字 - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_hot(self, pg): - result = {} - url = 'https://api.bilibili.com/x/web-interface/popular?ps=10&pn={0}'.format(pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'][0:50] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_rcmd(self, pg): - result = {} - url = 'https://api.bilibili.com/x/web-interface/index/top/feed/rcmd?y_num={0}&fresh_type=3&feed_version=SEO_VIDEO&fresh_idx_1h=1&fetch_row=1&fresh_idx=1&brush=0&homepage_ver=1&ps=10'.format( - pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['item'] - for vod in vodList: - if vod['duration'] > 0: - aid = str(vod['id']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_rank(self): - result = {} - url = 'https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'][0:50] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_history(self, pg): - result = {} - url = 'https://api.bilibili.com/x/v2/history?pn=%s&ps=10' % pg - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) # 解析api接口,转化成json数据对象 - if jo['code'] == 0: - videos = [] - vodList = jo['data'] - for vod in vodList: - if vod['duration'] > 0: # 筛选掉非视频的历史记录 - aid = str(vod["aid"]).strip() - title = vod["title"].replace("", "").replace("", "").replace(""", - '"') - img = vod["pic"].strip() - # 获取已观看时间 - if str(vod['progress']) == '-1': - process = str(self.second_to_time(vod['duration'])).strip() - else: - process = str(self.second_to_time(vod['progress'])).strip() - # 获取视频总时长 - total_time = str(self.second_to_time(vod['duration'])).strip() - # 组合 已观看时间 / 总时长 ,赋值给 remark - remark = process + ' / ' + total_time - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_fav(self, pg, order, extend): - mlid = '' - fav_config = self.config["filter"].get('收藏') - # 默认显示第一个收藏内容 - if fav_config: - for i in fav_config: - if i['key'] == 'mlid': - if len(i['value']) > 0: - mlid = i['value'][0]['v'] - # print(self.config["filter"].get('收藏')) - if 'mlid' in extend: - mlid = extend['mlid'] - if mlid: - return self.get_fav_detail(pg=pg, mlid=mlid, order=order) - else: - return {} - - def get_fav_detail(self, pg, mlid, order): - result = {} - url = 'https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&order=%s&pn=%s&ps=10&platform=web&type=0' % (mlid, order, pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['medias'] - for vod in vodList: - # print(vod) - # 只展示类型为 视频的条目 - # 过滤去掉收藏中的 已失效视频;如果不喜欢可以去掉这个 if条件 - if vod.get('type') in [2] and vod.get('title') != '已失效视频': - aid = str(vod['id']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", - '"') - img = vod['cover'].strip() - remark = "观看:" + self.zh(vod['cnt_info']['play']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - # videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_zone(self, tid): - result = {} - url = 'https://api.bilibili.com/x/web-interface/ranking/v2?rid={0}&type=all'.format(tid) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'][0:50] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_weekly(self): - result = {} - url1 = 'https://api.bilibili.com/x/web-interface/popular/series/list' - rsp1 = self.fetch(url1, cookies=self.cookies) - content1 = rsp1.text - jo1 = json.loads(content1) - number = jo1['data']['list'][0]['number'] - url = 'https://api.bilibili.com/x/web-interface/popular/series/one?number=' + str(number) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip() - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_must_watch(self): - result = {} - url = 'https://api.bilibili.com/x/web-interface/popular/precious?page_size=100&page=1' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip() - img = vod['pic'].strip() - remark = "观看:" + self.zh(vod['stat']['view']) + "  " + str(self.second_to_time(vod['duration'])).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_toview(self, pg): - result = {} - url = 'https://api.bilibili.com/x/v2/history/toview' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) # 解析api接口,转化成json数据对象 - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - if vod['duration'] > 0: - aid = str(vod["aid"]).strip() - title = vod["title"].replace("", "").replace("", "").replace(""", - '"') - img = vod["pic"].strip() - if str(vod['progress']) == '-1': - process = str(self.second_to_time(vod['duration'])).strip() - else: - process = str(self.second_to_time(vod['progress'])).strip() - # 获取视频总时长 - total_time = str(self.second_to_time(vod['duration'])).strip() - # 组合 已观看时间 / 总时长 ,赋值给 remark - remark = process + ' / ' + total_time - videos.append({ - "vod_id": aid + '&toview', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - chanel_offset = '' - - def get_channel(self, pg, cid, extend, order, duration_diff): - result = {} - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}&page_size=10'.format( - cid, pg, duration_diff, order) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo.get('code') == 0: - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - remark = "观看:" + self.zh(vod['play']) + "  " + str(self.second_to_time(self.str2sec(vod['duration']))).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - # videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - if len(self.cookies) <= 0: - self.getCookie() - if tid == "动态": - return self.get_dynamic(pg=pg) - elif tid == "热门": - return self.get_hot(pg=pg) - elif tid == '推荐': - return self.get_rcmd(pg=pg) - elif tid == '历史记录': - return self.get_history(pg=pg) - elif tid == "每周必看": - return self.get_weekly() - elif tid == "入站必刷": - return self.get_must_watch() - elif tid == '稍后再看': - return self.get_toview(pg=pg) - elif tid in ("1", "3", "129", "4", "119", "36", "188", "234", "160", "211", "217", "223", "155", "5", "181"): - return self.get_zone(tid=tid) - - elif tid == "收藏": - order = 'mtime' - if 'order' in extend: - order = extend['order'] - return self.get_fav(pg=pg, order=order, extend=extend) - - elif tid == '频道': - cid = '搞笑' - if 'cid' in extend: - cid = extend['cid'] - duration_diff = '0' - if 'duration' in extend: - duration_diff = extend['duration'] - order = 'totalrank' - if 'order' in extend: - order = extend['order'] - return self.get_channel(pg=pg, cid=cid, extend=extend, order=order, duration_diff=duration_diff) - - else: - duration_diff = '0' - if 'duration' in extend: - duration_diff = extend['duration'] - order = 'totalrank' - if 'order' in extend: - order = extend['order'] - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}&page_size=10'.format( - tid, pg, duration_diff, order) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo.get('code') == 0: - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", - '"') - img = 'https:' + vod['pic'].strip() - # remark = str(vod['duration']).strip() - remark = "观看:" + self.zh(vod['play']) + "  " + str(self.second_to_time(self.str2sec(vod['duration']))).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - # videos=self.filter_duration(videos, duration_diff) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - aid = array[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - rsp = self.fetch(url, headers=self.header, cookies=self.cookies) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['title'].replace("", "").replace("", "") - pic = jo['pic'] - desc = jo['desc'] - typeName = jo['tname'] - date = time.strftime("%Y%m%d", time.localtime(jo['pubdate'])) # 投稿时间本地年月日表示 - stat = jo['stat'] - # 演员项展示视频状态,包括以下内容: - status = "播放: " + self.zh(stat['view']) + " 弹幕: " + self.zh(stat['danmaku']) + " 点赞: " + self.zh(stat['like']) + " 收藏: " + self.zh(stat['favorite']) + " 投币: " + self.zh(stat['coin']) - remark = str(jo['duration']).strip() - vod = { - "vod_id": aid, - "vod_name": '[' + jo['owner']['name'] + "]" + title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": date, - "vod_area": "bilidanmu", - "vod_remarks": remark, # 不会显示 - 'vod_tags': 'mv', # 不会显示 - "vod_actor": status, - "vod_director": jo['owner']['name'], - "vod_content": desc - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, aid, cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page=1'.format(key) - - rsp = self.fetch(url, cookies=self.cookies, headers=self.header) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url, cookies=self.cookies, headers=self.header) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') + '[' + key + ']' - img = 'https:' + vod['pic'].strip() - remark = str(self.second_to_time(self.str2sec(vod['duration']))).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - ids = id.split("_") - if len(ids) < 2: - return result - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'.format(ids[0], ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - self.post_history(ids[0], ids[1]) # 回传播放历史记录 - rsp = self.fetch(url, cookies=self.cookies) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": { - - "收藏": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "收藏时间", - "v": "mtime" - }, - - { - "n": "播放量", - "v": "view" - }, - - { - "n": "投稿时间", - "v": "pubtime" - } - - ] - }, - { - "key": "mlid", - "name": "收藏分区", - "value": [ - ] - }], - - "频道": [{ - "key": "order", - "name": "排序", - "value": [ - - { - "n": "综合排序", - "v": "totalrank" - }, - - { - "n": "最新发布", - "v": "pubdate" - }, - - { - "n": "最多点击", - "v": "click" - }, - { - "n": "最多收藏", - "v": "stow" - }, - - { - "n": "最多弹幕", - "v": "dm" - }, - - ] - }, - { - "key": "duration", - "name": "时长", - "value": [{ - "n": "全部", - "v": "0" - }, - { - "n": "60分钟以上", - "v": "4" - }, - - { - "n": "30~60分钟", - "v": "3" - }, - { - "n": "5~30分钟", - "v": "2" - }, - { - "n": "5分钟以下", - "v": "1" - } - ] - }, {"key": "cid", "name": "分类", - "value": [{'n': '搞笑', 'v': '搞笑'}, {'n': '美食', 'v': '美食'}, {'n': '鬼畜', 'v': '鬼畜'}, - {'n': '美妆', 'v': '美妆'}, {'n': 'mmd', 'v': 'mmd'}, {'n': '科普', 'v': '科普'}, - {'n': 'COSPLAY', 'v': 'COSPLAY'}, {'n': '漫展', 'v': '漫展'}, {'n': 'MAD', 'v': 'MAD'}, - {'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': 'PS教程', 'v': 'PS教程'}, {'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': 'A.I.Channel', 'v': 'A.I.Channel'}, {'n': '虚拟UP主', 'v': '虚拟UP主'}, - {'n': '神楽めあ', 'v': '神楽めあ'}, {'n': '白上吹雪', 'v': '白上吹雪'}, {'n': '婺源', 'v': '婺源'}, - {'n': 'hololive', 'v': 'hololive'}, {'n': 'EXO', 'v': 'EXO'}, - {'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': 'vlog', 'v': 'vlog'}, - {'n': 'DIY', 'v': 'DIY'}, {'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': '帕梅拉'}, {'n': '极限运动', 'v': '极限运动'}, {'n': '足球', 'v': '足球'}, - {'n': '星海', 'v': '星海'}, {'n': '张召忠', 'v': '张召忠'}, {'n': '航母', 'v': '航母'}, - {'n': '航天', 'v': '航天'}, {'n': '导弹', 'v': '导弹'}, {'n': '战斗机', 'v': '战斗机'}] - } - ], - } - } - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - def localProxy(self, param): - - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_bilifanju.py b/TVBox_PY/py_bilifanju.py deleted file mode 100644 index 43b7653..0000000 --- a/TVBox_PY/py_bilifanju.py +++ /dev/null @@ -1,214 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -from requests import session, utils -import os -import time -import base64 - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "B站影视" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "番剧": "1", - "国创": "4", - "电影": "2", - "综艺": "7", - "电视剧": "5", - "纪录片": "3" - } - 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 - cookies = '' - def getCookie(self): - #在cookies_str中填入会员或大会员cookie,以获得更好的体验 - cookies_str = "innersign=0; buvid3=606BE156-AE37-AEA8-7052-9DA0B21766E776404infoc; b_nut=1663302976; i-wanna-go-back=-1; b_ut=7; b_lsid=4106252F6_18344933A90; _uuid=586AAEB7-6B88-A691-F7AC-95C27E57F53C43036infoc; buvid4=B6FF1449-4361-1C76-DEFC-4AFCA1777B7E78304-022091612-PdJr0jKE6N5TamfAEX9uACD1RXvklspbNdlcIQEFLMu0d9wS3G3sdA%3D%3D; buvid_fp=2a9b54d5e06aa54293dc7544e000552d" - cookies_dic = dict([co.strip().split('=') for co in cookies_str.split(';')]) - rsp = session() - cookies_jar = utils.cookiejar_from_dict(cookies_dic) - rsp.cookies = cookies_jar - content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - res = json.loads(content.text) - if res["code"] == 0: - self.cookies = rsp.cookies - else: - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - return rsp.cookies - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://api.bilibili.com/pgc/season/index/result?order=2&season_status=-1&style_id=-1&sort=0&area=-1&pagesize=20&type=1&st={0}&season_type={0}&page={1}'.format(tid,pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['index_show'].strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def cleanSpace(self,str): - return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') - def detailContent(self,array): - aid = array[0] - url = "http://api.bilibili.com/pgc/view/web/season?season_id={0}".format(aid) - rsp = self.fetch(url,headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['result'] - id = jo['season_id'] - title = jo['title'] - pic = jo['cover'] - areas = jo['areas'][0]['name'] - typeName = jo['share_sub_title'] - dec = jo['evaluate'] - remark = jo['new_ep']['desc'] - vod = { - "vod_id":id, - "vod_name":title, - "vod_pic":pic, - "type_name":typeName, - "vod_year":"", - "vod_area":areas, - "vod_remarks":remark, - "vod_actor":"", - "vod_director":"", - "vod_content":dec - } - ja = jo['episodes'] - playUrl = '' - for tmpJo in ja: - eid = tmpJo['id'] - cid = tmpJo['cid'] - part = tmpJo['title'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, eid, cid) - - vod['vod_play_from'] = 'B站影视' - vod['vod_play_url'] = playUrl - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_bangumi&keyword={0}'.format(key) # 番剧搜索 - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - rs = jo['data'] - if rs['numResults'] == 0: - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_ft&keyword={0}'.format(key) # 影视搜索 - rspRetry = self.fetch(url, cookies=self.cookies) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['eps'][0]['cover'].strip() - remark = vod['index_show'] - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self,flag,id,vipFlags): - result = {} - ids = id.split("_") - header = { - "Referer": "https://www.bilibili.com", - "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" - } - url = 'https://api.bilibili.com/pgc/player/web/playurl?qn=116&ep_id={0}&cid={1}'.format(ids[0],ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url,cookies=self.cookies,headers=header) - jRoot = json.loads(rsp.text) - if jRoot['message'] != 'success': - print("需要大会员权限才能观看") - return {} - jo = jRoot['result'] - ja = jo['durl'] - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer":"https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_bilimd.py b/TVBox_PY/py_bilimd.py deleted file mode 100644 index 43b7653..0000000 --- a/TVBox_PY/py_bilimd.py +++ /dev/null @@ -1,214 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -from requests import session, utils -import os -import time -import base64 - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "B站影视" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "番剧": "1", - "国创": "4", - "电影": "2", - "综艺": "7", - "电视剧": "5", - "纪录片": "3" - } - 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 - cookies = '' - def getCookie(self): - #在cookies_str中填入会员或大会员cookie,以获得更好的体验 - cookies_str = "innersign=0; buvid3=606BE156-AE37-AEA8-7052-9DA0B21766E776404infoc; b_nut=1663302976; i-wanna-go-back=-1; b_ut=7; b_lsid=4106252F6_18344933A90; _uuid=586AAEB7-6B88-A691-F7AC-95C27E57F53C43036infoc; buvid4=B6FF1449-4361-1C76-DEFC-4AFCA1777B7E78304-022091612-PdJr0jKE6N5TamfAEX9uACD1RXvklspbNdlcIQEFLMu0d9wS3G3sdA%3D%3D; buvid_fp=2a9b54d5e06aa54293dc7544e000552d" - cookies_dic = dict([co.strip().split('=') for co in cookies_str.split(';')]) - rsp = session() - cookies_jar = utils.cookiejar_from_dict(cookies_dic) - rsp.cookies = cookies_jar - content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - res = json.loads(content.text) - if res["code"] == 0: - self.cookies = rsp.cookies - else: - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - return rsp.cookies - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://api.bilibili.com/pgc/season/index/result?order=2&season_status=-1&style_id=-1&sort=0&area=-1&pagesize=20&type=1&st={0}&season_type={0}&page={1}'.format(tid,pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['index_show'].strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def cleanSpace(self,str): - return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') - def detailContent(self,array): - aid = array[0] - url = "http://api.bilibili.com/pgc/view/web/season?season_id={0}".format(aid) - rsp = self.fetch(url,headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['result'] - id = jo['season_id'] - title = jo['title'] - pic = jo['cover'] - areas = jo['areas'][0]['name'] - typeName = jo['share_sub_title'] - dec = jo['evaluate'] - remark = jo['new_ep']['desc'] - vod = { - "vod_id":id, - "vod_name":title, - "vod_pic":pic, - "type_name":typeName, - "vod_year":"", - "vod_area":areas, - "vod_remarks":remark, - "vod_actor":"", - "vod_director":"", - "vod_content":dec - } - ja = jo['episodes'] - playUrl = '' - for tmpJo in ja: - eid = tmpJo['id'] - cid = tmpJo['cid'] - part = tmpJo['title'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, eid, cid) - - vod['vod_play_from'] = 'B站影视' - vod['vod_play_url'] = playUrl - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_bangumi&keyword={0}'.format(key) # 番剧搜索 - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - rs = jo['data'] - if rs['numResults'] == 0: - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_ft&keyword={0}'.format(key) # 影视搜索 - rspRetry = self.fetch(url, cookies=self.cookies) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['eps'][0]['cover'].strip() - remark = vod['index_show'] - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self,flag,id,vipFlags): - result = {} - ids = id.split("_") - header = { - "Referer": "https://www.bilibili.com", - "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" - } - url = 'https://api.bilibili.com/pgc/player/web/playurl?qn=116&ep_id={0}&cid={1}'.format(ids[0],ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url,cookies=self.cookies,headers=header) - jRoot = json.loads(rsp.text) - if jRoot['message'] != 'success': - print("需要大会员权限才能观看") - return {} - jo = jRoot['result'] - ja = jo['durl'] - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer":"https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_bilimy.py b/TVBox_PY/py_bilimy.py deleted file mode 100644 index bfda54e..0000000 --- a/TVBox_PY/py_bilimy.py +++ /dev/null @@ -1,216 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -from requests import session, utils -import os -import time -import base64 - - -class Spider(Spider): - box_video_type = '' - - def getDependence(self): - return ['py_bilibili'] - - def getName(self): - return "我的哔哩" - - def init(self, extend=""): - self.bilibili = extend[0] - print("============{0}============".format(extend)) - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def homeContent(self, filter): - result = {} - cateManual = { - # ————————以下可自定义关键词,结果以搜索方式展示———————— - "宅舞": "宅舞", - "cosplay": "cosplay", - "周杰伦": "周杰伦", - "狗狗": "汪星人", - "猫咪": "喵星人", - "请自定义关键词": "美女", - # ————————以下可自定义UP主,冒号后须填写UID———————— - "徐云流浪中国": "697166795", - # "虫哥说电影": "29296192", - - } - classes = [] - for k in cateManual: - classes.append({ - 'type_name': k, - 'type_id': cateManual[k] - }) - result['class'] = classes - if (filter): - filters = {} - for lk in cateManual: - if not cateManual[lk].isdigit(): - link = cateManual[lk] - filters.update({ - link: [{"key": "order", "name": "排序", - "value": [{"n": "综合排序", "v": "totalrank"}, {"n": "最新发布", "v": "pubdate"}, - {"n": "最多点击", "v": "click"}, {"n": "最多收藏", "v": "stow"}, - {"n": "最多弹幕", "v": "dm"}, ]}, - {"key": "duration", "name": "时长", - "value": [{"n": "全部", "v": "0"}, {"n": "60分钟以上", "v": "4"}, - {"n": "30~60分钟", "v": "3"}, {"n": "5~30分钟", "v": "2"}, - {"n": "5分钟以下", "v": "1"}]}] - }) - result['filters'] = filters - return result - - # 用户cookies,请在py_bilibili里填写,此处不用改 - cookies = '' - - def getCookie(self): - self.cookies = self.bilibili.getCookie() - return self.cookies - - def homeVideoContent(self): - result = {} - return result - - def get_up_videos(self, tid, pg): - result = {} - url = 'https://api.bilibili.com/x/space/arc/search?mid={0}&pn={1}&ps=10'.format(tid, pg) - rsp = self.fetch(url, headers=self.header, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list']['vlist'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].strip().replace("", "").replace("", "") - img = vod['pic'].strip() - remark = "观看:" + self.bilibili.zh(vod['play']) + "  " + str(vod['length']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def categoryContent(self, tid, pg, filter, extend): - self.box_video_type = "分区" - if tid.isdigit(): - return self.get_up_videos(tid, pg) - else: - result = self.bilibili.categoryContent(tid, pg, filter, extend) - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - if self.box_video_type == "搜索": - mid = array[0] - # 获取UP主视频列表,ps后面为视频数量,默认为20,加快加载速度 - url = 'https://api.bilibili.com/x/space/arc/search?mid={0}&pn=1&ps=20'.format(mid) - rsp = self.fetch(url, headers=self.header) - content = rsp.text - jRoot = json.loads(content) - jo = jRoot['data']['list']['vlist'] - - url2 = "https://api.bilibili.com/x/web-interface/card?mid={0}".format(mid) - rsp2 = self.fetch(url2, headers=self.header) - jRoot2 = json.loads(rsp2.text) - jo2 = jRoot2['data']['card'] - name = jo2['name'].replace("", "").replace("", "") - pic = jo2['face'] - desc = jo2['Official']['desc'] + " " + jo2['Official']['title'] - vod = { - "vod_id": mid, - "vod_name": name + " " + "个人主页", - "vod_pic": pic, - "type_name": "最近投稿", - "vod_year": "", - "vod_area": "bilidanmu", - "vod_remarks": "", # 不会显示 - 'vod_tags': 'mv', # 不会显示 - "vod_actor": "粉丝数:" + self.bilibili.zh(jo2['fans']), - "vod_director": name, - "vod_content": desc - } - playUrl = '' - for tmpJo in jo: - eid = tmpJo['aid'] - url3 = "https://api.bilibili.com/x/web-interface/view?aid=%s" % str(eid) - rsp3 = self.fetch(url3) - jRoot3 = json.loads(rsp3.text) - cid = jRoot3['data']['cid'] - part = tmpJo['title'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, eid, cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - else: - return self.bilibili.detailContent(array) - - def searchContent(self, key, quick): - self.box_video_type = "搜索" - if len(self.cookies) <= 0: - self.getCookie() - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&keyword={0}'.format(key) - rsp = self.fetch(url, headers=self.header, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['mid']) # str(vod["res"][0]["aid"]) - title = "UP主:" + vod['uname'].strip() + " ☜" + key - img = 'https:' + vod['upic'].strip() - remark = "粉丝数" + self.bilibili.zh(vod['fans']) - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - return self.bilibili.playerContent(flag, id, vipFlags) - - config = { - "player": {}, - "filter": { - } - } - - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - def localProxy(self, param): - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_bilivd.py b/TVBox_PY/py_bilivd.py deleted file mode 100644 index f7100cf..0000000 --- a/TVBox_PY/py_bilivd.py +++ /dev/null @@ -1,231 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -import requests -from requests import session, utils -import os -import time -import base64 - - -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 = { - "Zard": "Zard", - "玩具汽车": "玩具汽车", - "儿童": "儿童", - "幼儿": "幼儿", - "儿童玩具": "儿童玩具", - "昆虫": "昆虫", - "动物世界": "动物世界", - "纪录片": "纪录片", - "相声小品": "相声小品", - "搞笑": "搞笑", - "假窗-白噪音": "窗+白噪音", - "演唱会": "演唱会" - } - 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 - - cookies = '' - - def getCookie(self): - # 在cookies_str中填入会员或大会员cookie,以获得更好的体验。 - cookies_str = "innersign=0; buvid3=606BE156-AE37-AEA8-7052-9DA0B21766E776404infoc; b_nut=1663302976; i-wanna-go-back=-1; b_ut=7; b_lsid=4106252F6_18344933A90; _uuid=586AAEB7-6B88-A691-F7AC-95C27E57F53C43036infoc; buvid4=B6FF1449-4361-1C76-DEFC-4AFCA1777B7E78304-022091612-PdJr0jKE6N5TamfAEX9uACD1RXvklspbNdlcIQEFLMu0d9wS3G3sdA%3D%3D; buvid_fp=2a9b54d5e06aa54293dc7544e000552d" - cookies_dic = dict([co.strip().split('=') for co in cookies_str.split(';')]) - rsp = session() - cookies_jar = utils.cookiejar_from_dict(cookies_dic) - rsp.cookies = cookies_jar - content = self.fetch("http://api.bilibili.com/x/web-interface/nav", cookies=rsp.cookies) - res = json.loads(content.text) - if res["code"] == 0: - self.cookies = rsp.cookies - else: - rsp = self.fetch("https://www.bilibili.com/") - self.cookies = rsp.cookies - return rsp.cookies - - def categoryContent(self, tid, pg, filter, extend): - result = {} - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}'.format(tid, pg) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - aid = array[0] - url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) - rsp = self.fetch(url, headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['title'].replace("", "").replace("", "") - pic = jo['pic'] - desc = jo['desc'] - timeStamp = jo['pubdate'] - timeArray = time.localtime(timeStamp) - year = str(time.strftime("%Y", timeArray)) - dire = jo['owner']['name'] - typeName = jo['tname'] - remark = str(jo['duration']).strip() - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": year, - "vod_area": "", - "vod_remarks": remark, - "vod_actor": "", - "vod_director": dire, - "vod_content": desc - } - ja = jo['pages'] - playUrl = '' - for tmpJo in ja: - cid = tmpJo['cid'] - part = tmpJo['part'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, aid, cid) - - vod['vod_play_from'] = 'B站视频' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - header = { - "Referer": "https://www.bilibili.com", - "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" - } - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}'.format(key) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies,headers=header) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url, cookies=self.getCookie()) - content = rspRetry.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - for vod in vodList: - aid = str(vod['aid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = 'https:' + vod['pic'].strip() - remark = str(vod['duration']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - - ids = id.split("_") - url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'.format(ids[0], ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - ja = jo['durl'] - - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self, param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_biliys.py b/TVBox_PY/py_biliys.py deleted file mode 100644 index d19b4a5..0000000 --- a/TVBox_PY/py_biliys.py +++ /dev/null @@ -1,541 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -from requests import session, utils -import os -import time -import base64 - - -class Spider(Spider): - def getDependence(self): - return ['py_bilibili'] - - def getName(self): - return "哔哩影视" - - def init(self, extend=""): - self.bilibili = extend[0] - print("============{0}============".format(extend)) - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - # 主页 - def homeContent(self, filter): - result = {} - cateManual = { - "番剧": "1", - "国创": "4", - "电影": "2", - "电视剧": "5", - "纪录片": "3", - "综艺": "7", - "全部": "全部", - "追番": "追番", - "追剧": "追剧", - "时间表": "时间表", - # ————————以下可自定义关键字,结果以影视类搜索展示———————— - # "喜羊羊": "喜羊羊" - - } - 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 - - # 用户cookies - cookies = '' - userid = '' - - def getCookie(self): - self.cookies = self.bilibili.getCookie() - self.userid = self.bilibili.userid - return self.cookies - - # 将超过10000的数字换成成以万和亿为单位 - def zh(self, num): - if int(num) >= 100000000: - p = round(float(num) / float(100000000), 1) - p = str(p) + '亿' - else: - if int(num) >= 10000: - p = round(float(num) / float(10000), 1) - p = str(p) + '万' - else: - p = str(num) - return p - - def homeVideoContent(self): - result = {} - videos = self.get_rank(1)['list'][0:5] - for i in [4, 2, 5, 3, 7]: - videos += self.get_rank2(i)['list'][0:5] - result['list'] = videos - return result - - def get_rank(self, tid): - result = {} - url = 'https://api.bilibili.com/pgc/web/rank/list?season_type={0}&day=3'.format(tid) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['result']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['new_ep']['index_show'] - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_rank2(self, tid): - result = {} - url = 'https://api.bilibili.com/pgc/season/rank/web/list?season_type={0}&day=3'.format(tid) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['new_ep']['index_show'] - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_zhui(self, pg, mode): - result = {} - if len(self.cookies) <= 0: - self.getCookie() - url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type={2}&follow_status=0&pn={1}&ps=10&vmid={0}'.format(self.userid, pg, mode) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'] - img = vod['cover'].strip() - remark = vod['new_ep']['index_show'].strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_all(self, tid, pg, order, season_status, extend): - result = {} - if len(self.cookies) <= 0: - self.getCookie() - url = 'https://api.bilibili.com/pgc/season/index/result?order={2}&pagesize=10&type=1&season_type={0}&page={1}&season_status={3}'.format(tid, pg, order, season_status) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'] - img = vod['cover'].strip() - remark = vod['index_show'].strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_timeline(self, tid, pg): - result = {} - url = 'https://api.bilibili.com/pgc/web/timeline/v2?season_type={0}&day_before=2&day_after=4'.format(tid) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos1 = [] - vodList = jo['result']['latest'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['pub_index'] + ' ' + vod['follows'].replace('系列', '') - videos1.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - videos2 = [] - for i in range(0, 7): - vodList = jo['result']['timeline'][i]['episodes'] - for vod in vodList: - if str(vod['published']) == "0": - aid = str(vod['season_id']).strip() - title = str(vod['title']).strip() - img = str(vod['cover']).strip() - date = str(time.strftime("%m-%d %H:%M", time.localtime(vod['pub_ts']))) - remark = date + " " + vod['pub_index'] - videos2.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos2 + videos1 - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - if len(self.cookies) <= 0: - self.getCookie() - if tid == "1": - return self.get_rank(tid=tid) - elif tid in {"2", "3", "4", "5", "7"}: - return self.get_rank2(tid=tid) - elif tid == "全部": - tid = '1' # 全部界面默认展示最多播放的番剧 - order = '2' - season_status = '-1' - if 'tid' in extend: - tid = extend['tid'] - if 'order' in extend: - order = extend['order'] - if 'season_status' in extend: - season_status = extend['season_status'] - return self.get_all(tid, pg, order, season_status, extend) - elif tid == "追番": - return self.get_zhui(pg, 1) - elif tid == "追剧": - return self.get_zhui(pg, 2) - elif tid == "时间表": - tid = 1 - if 'tid' in extend: - tid = extend['tid'] - return self.get_timeline(tid, pg) - else: - result = self.searchContent(key=tid, quick="false") - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - aid = array[0] - url = "https://api.bilibili.com/pgc/view/web/season?season_id={0}".format(aid) - rsp = self.fetch(url, headers=self.header) - jRoot = json.loads(rsp.text) - jo = jRoot['result'] - id = jo['season_id'] - title = jo['title'] - pic = jo['cover'] - # areas = jo['areas']['name'] 改bilidanmu显示弹幕 - typeName = jo['share_sub_title'] - date = jo['publish']['pub_time'][0:4] - dec = jo['evaluate'] - remark = jo['new_ep']['desc'] - stat = jo['stat'] - # 演员和导演框展示视频状态,包括以下内容: - status = "弹幕: " + self.zh(stat['danmakus']) + " 点赞: " + self.zh(stat['likes']) + " 投币: " + self.zh( - stat['coins']) + " 追番追剧: " + self.zh(stat['favorites']) - if 'rating' in jo: - score = "评分: " + str(jo['rating']['score']) + ' ' + jo['subtitle'] - else: - score = "暂无评分" + ' ' + jo['subtitle'] - vod = { - "vod_id": id, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": date, - "vod_area": "bilidanmu", - "vod_remarks": remark, - "vod_actor": status, - "vod_director": score, - "vod_content": dec - } - ja = jo['episodes'] - playUrl = '' - for tmpJo in ja: - aid = tmpJo['aid'] - cid = tmpJo['cid'] - part = tmpJo['title'].replace("#", "-") - playUrl = playUrl + '{0}${1}_{2}#'.format(part, aid, cid) - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - if len(self.cookies) <= 0: - self.getCookie() - url1 = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_bangumi&keyword={0}'.format( - key) # 番剧搜索 - rsp1 = self.fetch(url1, cookies=self.cookies) - content1 = rsp1.text - jo1 = json.loads(content1) - rs1 = jo1['data'] - url2 = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_ft&keyword={0}'.format( - key) # 影视搜索 - rsp2 = self.fetch(url2, cookies=self.cookies) - content2 = rsp2.text - jo2 = json.loads(content2) - rs2 = jo2['data'] - videos = [] - if rs1['numResults'] == 0: - vodList = jo2['data']['result'] - elif rs2['numResults'] == 0: - vodList = jo1['data']['result'] - else: - vodList = jo1['data']['result'] + jo2['data']['result'] - for vod in vodList: - aid = str(vod['season_id']).strip() - title = key + '➢' + vod['title'].strip().replace("", "").replace("", "") - img = vod['cover'].strip() # vod['eps'][0]['cover'].strip()原来的错误写法 - remark = vod['index_show'] - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - ids = id.split("_") - header = { - "Referer": "https://www.bilibili.com", - "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" - } - url = 'https://api.bilibili.com/pgc/player/web/playurl?qn=116&aid={0}&cid={1}'.format(ids[0], ids[1]) - if len(self.cookies) <= 0: - self.getCookie() - self.bilibili.post_history(ids[0], ids[1]) # 回传播放历史记录 - rsp = self.fetch(url, cookies=self.cookies, headers=header) - jRoot = json.loads(rsp.text) - if jRoot['message'] != 'success': - print("需要大会员权限才能观看") - return {} - jo = jRoot['result'] - ja = jo['durl'] - maxSize = -1 - position = -1 - for i in range(len(ja)): - tmpJo = ja[i] - if maxSize < int(tmpJo['size']): - maxSize = int(tmpJo['size']) - position = i - - url = '' - if len(ja) > 0: - if position == -1: - position = 0 - url = ja[position]['url'] - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://www.bilibili.com", - "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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": { - "全部": [ - { - "key": "tid", - "name": "分类", - "value": [{ - "n": "番剧", - "v": "1" - }, - { - "n": "国创", - "v": "4" - }, - - { - "n": "电影", - "v": "2" - }, - { - "n": "电视剧", - "v": "5" - }, - { - "n": "记录片", - "v": "3" - }, - { - "n": "综艺", - "v": "7" - } - - ] - }, - { - "key": "order", - "name": "排序", - "value": [ - - { - "n": "播放数量", - "v": "2" - }, - - { - "n": "更新时间", - "v": "0" - }, - - { - "n": "最高评分", - "v": "4" - }, - { - "n": "弹幕数量", - "v": "1" - }, - { - "n": "追看人数", - "v": "3" - }, - - { - "n": "开播时间", - "v": "5" - }, - { - "n": "上映时间", - "v": "6" - }, - - ] - }, - { - "key": "season_status", - "name": "付费", - "value": [ - { - "n": "全部", - "v": "-1" - }, - { - "n": "免费", - "v": "1" - }, - - { - "n": "付费", - "v": "2%2C6" - }, - - { - "n": "大会员", - "v": "4%2C6" - }, - - ] - }, - ], - - - "时间表": [{ - "key": "tid", - "name": "分类", - "value": [ - - { - "n": "番剧", - "v": "1" - }, - - { - "n": "国创", - "v": "4" - }, - - ] - }, - ], - } - } - - - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - def localProxy(self, param): - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_bilizb.py b/TVBox_PY/py_bilizb.py deleted file mode 100644 index 7da84e4..0000000 --- a/TVBox_PY/py_bilizb.py +++ /dev/null @@ -1,665 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys - -sys.path.append('..') -from base.spider import Spider -import json -import requests -from requests import session, utils -import time -import base64 - - -class Spider(Spider): - def getDependence(self): - return ['py_bilibili'] - - def getName(self): - return "哔哩直播" - - def homeContent(self, filter): - result = {} - cateManual = { - "推荐": "推荐", - "网游": "2", - "手游": "3", - "单机": "6", - "娱乐": "1", - "生活": "10", - "知识": "11", - "赛事": "13", - "电台": "5", - "虚拟": "9", - "我的关注": "我的关注", - "观看记录": "观看记录", - - } - 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 - - # 用户cookies - cookies = '' - userid = '' - - def getCookie(self): - self.cookies = self.bilibili.getCookie() - return self.cookies - - def init(self, extend=""): - self.bilibili = extend[0] - print("============{0}============".format(extend)) - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - # 将超过10000的数字换成成以万和亿为单位 - def zh(self, num): - if int(num) >= 100000000: - p = round(float(num) / float(100000000), 1) - p = str(p) + '亿' - else: - if int(num) >= 10000: - p = round(float(num) / float(10000), 1) - p = str(p) + '万' - else: - p = str(num) - return p - - uname = '' - - def get_live_userInfo(self, uid): - url = 'https://api.live.bilibili.com/live_user/v1/Master/info?uid=%s' % uid - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - return jo['data']["info"]["uname"] - - def homeVideoContent(self): - return self.get_hot(1) - - def get_recommend(self, pg): - result = {} - url = 'https://api.live.bilibili.com/xlive/web-interface/v1/webMain/getList?platform=web&page=%s' % pg - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['recommend_room_list'] - for vod in vodList: - aid = str(vod['roomid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod['keyframe'].strip() - remark = vod['watched_show']['text_small'].strip() + " " + vod['uname'].strip() - videos.append({ - "vod_id": aid + '&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_hot(self, pg): - result = {} - url = 'https://api.live.bilibili.com/room/v1/room/get_user_recommend?page=%s' % pg - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data'] - for vod in vodList: - aid = str(vod['roomid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod['user_cover'].strip() - remark = vod['watched_show']['text_small'].strip() + " " + vod['uname'].strip() - videos.append({ - "vod_id": aid + '&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_live(self, pg, parent_area_id, area_id): - result = {} - url = 'https://api.live.bilibili.com/xlive/web-interface/v1/second/getList?platform=web&parent_area_id=%s&area_id=%s&sort_type=online&page=%s' % ( - parent_area_id, area_id, pg) - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['roomid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod.get('cover').strip() - remark = vod['watched_show']['text_small'].strip() + " " + vod['uname'].strip() - videos.append({ - "vod_id": aid + '&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_fav(self, pg): - result = {} - url = 'https://api.live.bilibili.com/xlive/web-ucenter/v1/xfetter/GetWebList?page=%s&page_size=10' % pg - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['rooms'] - for vod in vodList: - aid = str(vod['room_id']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod['cover_from_user'].strip() - remark = vod['uname'].strip() - videos.append({ - "vod_id": aid + '&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def get_history(self): - result = {} - url = 'https://api.bilibili.com/x/web-interface/history/cursor?ps=30&type=live' - rsp = self.fetch(url, cookies=self.cookies) - content = rsp.text - jo = json.loads(content) - if jo['code'] == 0: - videos = [] - vodList = jo['data']['list'] - for vod in vodList: - aid = str(vod['history']['oid']).strip() - title = vod['title'].replace("", "").replace("", "").replace(""", '"') - img = vod['cover'].strip() - remark = str(vod['live_status']).replace("0", "未开播").replace("1", "") +" " + vod['author_name'].strip() - videos.append({ - "vod_id": aid + '&live', - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = 1 - result['pagecount'] = 1 - result['limit'] = 90 - result['total'] = 999999 - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - if len(self.cookies) <= 0: - self.getCookie() - if tid.isdigit(): - parent_area_id = tid - area_id = 0 - if 'area_id' in extend: - area_id = extend['area_id'] - return self.get_live(pg=pg, parent_area_id=parent_area_id, area_id=area_id) - if tid == "推荐": - return self.get_recommend(pg) - if tid == "我的关注": - return self.get_fav(pg) - if tid == "观看记录": - return self.get_history() - return result - - def cleanSpace(self, str): - return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') - - def detailContent(self, array): - arrays = array[0].split("&") - aid = arrays[0] - url = "https://api.live.bilibili.com/room/v1/Room/get_info?room_id=%s" % aid - rsp = self.fetch(url, headers=self.header, cookies=self.cookies) - jRoot = json.loads(rsp.text) - if jRoot.get('code') == 0: - jo = jRoot['data'] - title = jo['title'].replace("", "").replace("", "") - pic = jo.get("user_cover") - desc = jo.get('description') - dire = self.get_live_userInfo(jo["uid"]) - typeName = jo.get("area_name") - live_status = str(jo.get('live_status')).replace("0", "未开播").replace("1", "").replace("2", "") - live_time = str(jo.get('live_time'))[5: 16] - remark = '在线人数:' + str(jo['online']).strip() - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "bilidanmu", - "vod_remarks": remark, - "vod_actor": "主播:" + dire + "  " + "房间号:" + aid + "  " + live_status, - "vod_director": "关注:" + self.zh(jo.get('attention')) + "  " + "开播时间:" + live_time, - "vod_content": desc, - } - playUrl = 'flv线路原画$platform=web&quality=4_' + aid + '#flv线路高清$platform=web&quality=3_' + aid + '#h5线路原画$platform=h5&quality=4_' + aid + '#h5线路高清$platform=h5&quality=3_' + aid - - vod['vod_play_from'] = 'B站' - vod['vod_play_url'] = playUrl - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=live&keyword={0}&page=1'.format(key) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies, headers=self.header) - content = rsp.text - jo = json.loads(content) - if jo['code'] != 0: - rspRetry = self.fetch(url, cookies=self.cookies, headers=self.header) - content = rspRetry.text - jo = json.loads(content) - videos1 = [] - if jo['data']['pageinfo']['live_room']['numResults'] != 0: - vodList = jo['data']['result']['live_room'] - for vod in vodList: - aid = str(vod['roomid']).strip() - title = vod['title'].strip() + "⇦" + key - img = 'https:' + vod['user_cover'].strip() - remark = vod['watched_show']['text_small'].strip() + " " + vod['uname'].strip() - videos1.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - videos2 = [] - if jo['data']['pageinfo']['live_user']['numResults'] != 0: - vodList = jo['data']['result']['live_user'] - for vod in vodList: - aid = str(vod['roomid']).strip() - title = vod['uname'].strip().replace("", "").replace("", "") + "⇦" + key - img = 'https:' + vod['uface'].strip() - remark = str(vod['live_status']).replace("0", "未开播").replace("1", "") + " 关注:" + self.zh(vod['attentions']) - videos2.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - videos = videos1 + videos2 - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - ids = id.split("_") - - url = 'https://api.live.bilibili.com/room/v1/Room/playUrl?cid=%s&%s' % (ids[1], ids[0]) - - # raise Exception(url) - if len(self.cookies) <= 0: - self.getCookie() - rsp = self.fetch(url, cookies=self.cookies) - jRoot = json.loads(rsp.text) - if jRoot['code'] == 0: - - jo = jRoot['data'] - ja = jo['durl'] - - url = '' - if len(ja) > 0: - url = ja[0]['url'] - - result["parse"] = 0 - # result['type'] ="m3u8" - result["playUrl"] = '' - result["url"] = url - result["header"] = { - "Referer": "https://live.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - if "h5" in ids[0]: - result["contentType"] = '' - else: - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": { - "1": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "舞见", - "v": "207" - }, - { - "n": "视频唱见", - "v": "21" - }, - { - "n": "萌宅领域", - "v": "530" - }, - - { - "n": "视频聊天", - "v": "145" - }, - - { - "n": "情感", - "v": "706" - }, - { - "n": "户外", - "v": "123" - }, - { - "n": "日常", - "v": "399" - }, - ] - }, - ], - "2": [ - { - "key": "area_id", - "name": "热门分类", - "value": [ - { - "n": "英雄联盟", - "v": "86" - }, - { - "n": "DOTA2", - "v": "92" - }, - { - "n": "CS:GO", - "v": "89" - }, - - { - "n": "APEX英雄", - "v": "240" - }, - - { - "n": "永劫无间", - "v": "666" - }, - { - "n": "穿越火线", - "v": "88" - }, - { - "n": "守望先锋", - "v": "87" - }, - ] - }, - ], - "3": [ - { - "key": "area_id", - "name": "热门分类", - "value": [ - { - "n": "王者荣耀", - "v": "35" - }, - { - "n": "和平精英", - "v": "256" - }, - { - "n": "LOL手游", - "v": "395" - }, - - { - "n": "原神", - "v": "321" - }, - - { - "n": "第五人格", - "v": "163" - }, - { - "n": "明日方舟", - "v": "255" - }, - { - "n": "哈利波特:魔法觉醒", - "v": "474" - }, - ] - }, - ], - "6": [ - { - "key": "area_id", - "name": "热门分类", - "value": [ - { - "n": "主机游戏", - "v": "236" - }, - { - "n": "战神", - "v": "579" - }, - { - "n": "我的世界", - "v": "216" - }, - - { - "n": "独立游戏", - "v": "283" - }, - - { - "n": "怀旧游戏", - "v": "237" - }, - { - "n": "大多数", - "v": "726" - }, - { - "n": "弹幕互动玩法", - "v": "460" - }, - ] - }, - ], - "5": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "唱见电台", - "v": "190" - }, - { - "n": "聊天电台", - "v": "192" - }, - { - "n": "配音", - "v": "193" - }, - ] - }, - ], - "9": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "虚拟主播", - "v": "371" - }, - { - "n": "3D虚拟主播", - "v": "697" - }, - ] - }, - ], - "10": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "生活分享", - "v": "646" - }, - { - "n": "运动", - "v": "628" - }, - { - "n": "搞笑", - "v": "624" - }, - - { - "n": "手工绘画", - "v": "627" - }, - - { - "n": "萌宠", - "v": "369" - }, - { - "n": "美食", - "v": "367" - }, - { - "n": "时尚", - "v": "378" - }, - { - "n": "影音馆", - "v": "33" - }, - ] - }, - ], - "11": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "社科法律心理", - "v": "376" - }, - { - "n": "人文历史", - "v": "702" - }, - { - "n": "校园学习", - "v": "372" - }, - - { - "n": "职场·技能", - "v": "377" - }, - - { - "n": "科技", - "v": "375" - }, - { - "n": "科学科普", - "v": "710" - }, - ] - }, - ], - "13": [ - { - "key": "area_id", - "name": "全部分类", - "value": [ - { - "n": "游戏赛事", - "v": "561" - }, - { - "n": "体育赛事", - "v": "562" - }, - { - "n": "赛事综合", - "v": "563" - }, - ] - }, - ], - } - } - header = { - "Referer": "https://www.bilibili.com", - "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' - } - - def localProxy(self, param): - - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_cctv.py b/TVBox_PY/py_cctv.py deleted file mode 100644 index 0fa51f2..0000000 --- a/TVBox_PY/py_cctv.py +++ /dev/null @@ -1,149 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { - "等着我": "TOPC1451378757637200", - "我爱发明": "TOPC1569314345479107", - "动物世界": "TOPC1451378967257534", - "探索发现": "TOPC1451557893544236", - "创新进行时": "TOPC1570875218228998", - "我爱发明2021": "TOPC1451557970755294", - "经典咏流传 第五季":"VIDAIiNbDQzOjE5mLl3T4t2B220403" - } - 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 - def categoryContent(self,tid,pg,filter,extend): - result = {} - extend['id'] = tid - extend['p'] = pg - filterParams = ["id", "p", "d"] - params = ["", "", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = '{0}={1}'.format(filterParams[idx],extend[fp]) - suffix = '&'.join(params) - url = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix) - if not tid.startswith('TOPC'): - url = 'https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data']['list'] - videos = [] - for vod in vodList: - guid = vod['guid'] - title = vod['title'] - img = vod['image'] - brief = vod['brief'] - videos.append({ - "vod_id":guid+"###"+img, - "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] - url = "https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid={0}".format(tid) - - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - title = jo['title'].strip() - link = jo['hls_url'].strip() - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":aid[1], - "type_name":'', - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - vod['vod_play_from'] = 'CCTV' - vod['vod_play_url'] = title+"$"+link - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - result = {} - rsp = self.fetch(id,headers=self.header) - content = rsp.text.strip() - arr = content.split('\n') - urlPrefix = self.regStr(id,'(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": {"TOPC1451557970755294": [{"key": "d", "name": "年份", "value": [{"n": "全部", "v": ""}, {"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"}]}]} - } - 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" - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_cctv_1.py b/TVBox_PY/py_cctv_1.py deleted file mode 100644 index 552e394..0000000 --- a/TVBox_PY/py_cctv_1.py +++ /dev/null @@ -1,227 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { -"等着我": "TOPC1451378757637200", -"我爱发明": "TOPC1569314345479107", -"我爱发明2021": "TOPC1451557970755294", -"动物世界": "TOPC1451378967257534", -"自然传奇": "TOPC1451558150787467", -"探索发现": "TOPC1451557893544236", -"地理中国": "TOPC1451557421544786", -"人与自然": "TOPC1451525103989666", -"远方的家": "TOPC1451541349400938", -"动画大放映": "TOPC1451559025546574", -"动画乐园": "TOPC1451378857272262", -"动漫世界": "TOPC1451559448233349", -"新闻联播": "TOPC1451528971114112", -"焦点访谈": "TOPC1451558976694518", -"海峡两岸": "TOPC1451540328102649", -"今日关注": "TOPC1451540389082713", -"今日亚洲": "TOPC1451540448405749", -"今日环球": "TOPC1571034705435323", -"防务新观察": "TOPC1451526164984187", -"共同关注": "TOPC1451558858788377", -"深度国际": "TOPC1451540709098112", -"环球视线": "TOPC1451558926200436", -"世界周刊": "TOPC1451558687534149", -"东方时空": "TOPC1451558532019883", -"新闻调查": "TOPC1451558819463311", -"环球记者连线": "TOPC1451559225116905", -"中国舆论场": "TOPC1458109953138295", -"国际时讯": "TOPC1451558887804404", -"卢健访谈": "TOPC1609904361007481", -"新闻1+1": "TOPC1451559066181661", -"朝闻天下": "TOPC1451558496100826", -"新闻直播间": "TOPC1451559129520755", -"晚间新闻": "TOPC1451528792881669", -"第一时间": "TOPC1451530259915198", -"新闻30分": "TOPC1451559097947700", -"中国新闻": "TOPC1451539894330405", -"讲武堂": "TOPC1451526241359341", -"国宝发现": "TOPC1571034869935436", -"国宝档案": "TOPC1451540268188575", -"天下财经": "TOPC1451531385787654", -"央视财经评论": "TOPC1451538686034772", -"生财有道": "TOPC1451534118159896", -"中国经济大讲堂": "TOPC1514182710380601", -"正点财经": "TOPC1453100395512779", -"走进科学": "TOPC1451558190239536", -"解码科技史": "TOPC1570876640457386", -"法律讲堂": "TOPC1451542824484472", -"今日说法": "TOPC1451464665008914", -"一线": "TOPC1451543462858283", -"百家讲坛": "TOPC1451557052519584", -"名家书场": "TOPC1579401761622774", -"星光大道": "TOPC1451467630488780", -"非常6+1": "TOPC1451467940101208", -"中国节拍": "TOPC1570025984977611", -"一鸣惊人": "TOPC1451558692971175", -"金牌喜剧班": "TOPC1611826337610628", -"九州大戏台": "TOPC1451558399948678", -"乡村大舞台": "TOPC1563179546003162", -"家庭幽默大赛": "TOPC1451375222891702", -"综艺盛典": "TOPC1451985071887935", -"环球综艺": "TOPC1571300682556971", -"中国好歌曲": "TOPC1451984949453678", -"广场舞金曲": "TOPC1528685010104859", -"今日影评": "TOPC1470713254980521", -"聆听时刻": "TOPC1570026397101703", -"影视留声机": "TOPC1451542346007956", -"全球中文音乐榜": "TOPC1451542061864640", -"曲苑杂谈": "TOPC1451984417763860", -"锦绣梨园": "TOPC1451558363250650", -"梨园周刊": "TOPC1574909786070351", -"角儿来了": "TOPC1508747509633692", -"宝贝亮相吧": "TOPC1579401989187953", -"曲藏": "TOPC1597825254395109", -"外国人在中国": "TOPC1451541113743615", -"华人世界": "TOPC1451539822927345", -"动物传奇": "TOPC1451984181884527", -"武林大会": "TOPC1451551891055866", -"棋牌乐": "TOPC1451550531682936", -"天下足球": "TOPC1451551777876756", -"体育世界": "TOPC1451551371554333", -"健康之路": "TOPC1451557646802924", -"味道中国": "TOPC1482483166133803", -"美食中国": "TOPC1571034804976375", -"田间示范秀": "TOPC1563178908227191", -"三农群英会": "TOPC1600745974233265", -"乡村振兴面对面": "TOPC1568966531726705", -"超级新农人": "TOPC1597627647957699", -"印象乡村": "TOPC1563178734372977", -"农业气象": "TOPC1568949200635957", -"中国三农报道": "TOPC1600746045741952", -"大地讲堂": "TOPC1568966472372643", -"振兴路上": "TOPC1632709936747979", -"谁知盘中餐": "TOPC1568966325430648", -"我的美丽乡村": "TOPC1570787364956444", -"乡土中国": "TOPC1563178586782832", -"乡里乡亲": "TOPC1568966155566515"} - - - 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 - def categoryContent(self,tid,pg,filter,extend): - result = {} - extend['id'] = tid - extend['p'] = pg - filterParams = ["id", "p", "d"] - params = ["", "", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = '{0}={1}'.format(filterParams[idx],extend[fp]) - suffix = '&'.join(params) - url = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix) - print(url) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data']['list'] - videos = [] - for vod in vodList: - guid = vod['guid'] - title = vod['title'] - img = vod['image'] - brief = vod['brief'] - videos.append({ - "vod_id":guid+"###"+img, - "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] - url = "https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid={0}".format(tid) - - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - title = jo['title'].strip() - link = jo['hls_url'].strip() - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":aid[1], - "type_name":'', - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - vod['vod_play_from'] = 'CCTV' - vod['vod_play_url'] = title+"$"+link - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - result = {} - rsp = self.fetch(id,headers=self.header) - content = rsp.text.strip() - arr = content.split('\n') - urlPrefix = self.regStr(id,'(http[s]?://[a-zA-z0-9.]+)/') - url = urlPrefix + arr[-1] - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {"TOPC1451557970755294": [{"key": "d", "name": "年份", "value": [{"n": "全部", "v": ""}, {"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"}]}]} - } - 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" - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_cctv_full.py b/TVBox_PY/py_cctv_full.py deleted file mode 100644 index e716003..0000000 --- a/TVBox_PY/py_cctv_full.py +++ /dev/null @@ -1,218 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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): - result['filters'] = self.config['filter'] - return result - def homeVideoContent(self): - result = { - 'list':[] - } - 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 + '=' + 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 detailContent(self,array): - # aid = array[0].split('###') - # tid = aid[0] - # logo = aid[2] - # webSite = aid[1] - # date = aid[0] - # rsp = self.fetch(webSite,headers=self.header) - # topicId = '' - # root = self.html(rsp.text) - # topicId = self.regStr(rsp.text,"(TOPC[0-9]{16})") - # title = root.xpath('.//title/text()')[0] - # if len(topicId) <= 0: - # return {} - # 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 = '近期' - # vod = { - # "vod_id":array[0], - # "vod_name":date +" "+title, - # "vod_pic":logo, - # "type_name":'', - # "vod_year":date, - # "vod_area":"", - # "vod_remarks":date, - # "vod_actor":"", - # "vod_director":"", - # "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":"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":"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, ""] \ No newline at end of file diff --git a/TVBox_PY/py_changzhang.py b/TVBox_PY/py_changzhang.py deleted file mode 100644 index 73b8eab..0000000 --- a/TVBox_PY/py_changzhang.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import base64 -from Crypto.Cipher import AES - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "厂长资源" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "豆瓣电影Top250": "dbtop250", - "最新电影": "zuixindianying", - "电视剧": "dsj", - "国产剧": "gcj", - "美剧": "meijutt", - "韩剧": "hanjutv", - "番剧": "fanju", - "动漫": "dm" - } - classes = [] - for k in cateManual: - classes.append({ - 'type_name': k, - 'type_id': cateManual[k] - }) - result['class'] = classes - return result - - def homeVideoContent(self): - rsp = self.fetch("https://czspp.com") - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='mi_btcon']//ul/li") - videos = [] - for a in aList: - name = a.xpath('./a/img/@alt')[0] - pic = a.xpath('./a/img/@data-original')[0] - mark = a.xpath("./div[@class='hdinfo']/span/text()")[0] - sid = a.xpath("./a/@href")[0] - sid = self.regStr(sid, "/movie/(\\S+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - url = 'https://czspp.com/{0}/page/{1}'.format(tid, pg) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[contains(@class,'mi_cont')]//ul/li") - videos = [] - for a in aList: - name = a.xpath('./a/img/@alt')[0] - pic = a.xpath('./a/img/@data-original')[0] - mark = a.xpath("./div[@class='hdinfo']/span/text()")[0] - sid = a.xpath("./a/@href")[0] - sid = self.regStr(sid, "/movie/(\\S+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - 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 = 'https://czspp.com/movie/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - node = root.xpath("//div[@class='dyxingq']")[0] - pic = node.xpath(".//div[@class='dyimg fl']/img/@src")[0] - title = node.xpath('.//h1/text()')[0] - detail = root.xpath(".//div[@class='yp_context']//p/text()")[0] - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": detail - } - infoArray = node.xpath(".//ul[@class='moviedteail_list']/li") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('类型'): - tpyen = '' - for inf in info: - tn = inf.text - tpyen = tpyen +'/'+'{0}'.format(tn) - vod['type_name'] = tpyen.strip('/') - if content.startswith('地区'): - tpyeare = '' - for inf in info: - tn = inf.text - tpyeare = tpyeare +'/'+'{0}'.format(tn) - vod['vod_area'] = tpyeare.strip('/') - if content.startswith('豆瓣'): - vod['vod_remarks'] = content - if content.startswith('主演'): - tpyeact = '' - for inf in info: - tn = inf.text - tpyeact = tpyeact +'/'+'{0}'.format(tn) - vod['vod_actor'] = tpyeact.strip('/') - if content.startswith('导演'): - tpyedire = '' - for inf in info: - tn = inf.text - tpyedire = tpyedire +'/'+'{0}'.format(tn) - vod['vod_director'] = tpyedire .strip('/') - vod_play_from = '$$$' - playFrom = ['厂长'] - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='paly_list_btn']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href, '/v_play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://czspp.com/xssearch?q={0}'.format(key) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - vodList = root.xpath("//div[contains(@class,'mi_ne_kd')]/ul/li/a") - videos = [] - for vod in vodList: - name = vod.xpath('./img/@alt')[0] - pic = vod.xpath('./img/@data-original')[0] - href = vod.xpath('./@href')[0] - tid = self.regStr(href, 'movie/(\\S+).html') - res = vod.xpath('./div[@class="jidi"]/span/text()') - if len(res) == 0: - remark = '全1集' - else: - remark = vod.xpath('./div[@class="jidi"]/span/text()')[0] - videos.append({ - "vod_id": tid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - config = { - "player": {}, - "filter": {} - } - header = { - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" - } - def parseCBC(self, enc, key, iv): - keyBytes = key.encode("utf-8") - ivBytes = iv.encode("utf-8") - cipher = AES.new(keyBytes, AES.MODE_CBC, ivBytes) - msg = cipher.decrypt(enc) - paddingLen = msg[len(msg) - 1] - return msg[0:-paddingLen] - - def playerContent(self, flag, id, vipFlags): - url = 'https://czspp.com/v_play/{0}.html'.format(id) - pat = '\\"([^\\"]+)\\";var [\\d\\w]+=function dncry.*md5.enc.Utf8.parse\\(\\"([\\d\\w]+)\\".*md5.enc.Utf8.parse\\(([\\d]+)\\)' - rsp = self.fetch(url) - html = rsp.text - content = self.regStr(html, pat) - if content == '': - return {} - key = self.regStr(html, pat, 2) - iv = self.regStr(html, pat, 3) - decontent = self.parseCBC(base64.b64decode(content), key, iv).decode() - urlPat = 'video: \\{url: \\\"([^\\\"]+)\\\"' - vttPat = 'subtitle: \\{url:\\\"([^\\\"]+\\.vtt)\\\"' - str3 = self.regStr(decontent, urlPat) - str4 = self.regStr(decontent, vttPat) - self.loadVtt(str3) - result = { - 'parse': '0', - 'playUrl': '', - 'url': str3, - 'header': '' - } - if len(str4) > 0: - result['subf'] = '/vtt/utf-8' - # result['subt'] = Proxy.localProxyUrl() + "?do=czspp&url=" + URLEncoder.encode(str4) - result['subt'] = '' - return result - - def loadVtt(self, url): - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = {} - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_chuangyi.py b/TVBox_PY/py_chuangyi.py deleted file mode 100644 index a164d4c..0000000 --- a/TVBox_PY/py_chuangyi.py +++ /dev/null @@ -1,216 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -import re -sys.path.append('..') -from base.spider import Spider -import urllib.parse - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "创艺影视" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "电影": "1", - "剧集": "2", - "动漫": "4", - "综艺": "3", - "纪录片": "30" - } - 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 - - def categoryContent(self, tid, pg, filter, extend): - result = {} - header = {"User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - url = 'https://www.30dian.cn/vodtype/{0}-{1}.html'.format(tid, pg) - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='myui-panel myui-panel-bg clearfix']/div/div/ul/li") - videos = [] - for a in aList: - name = a.xpath('./div/a/@title')[0] - pic = a.xpath('./div/a/@data-original')[0] - mark = a.xpath("./div/a/span/span[@class='tag']/text()")[0] - sid = a.xpath("./div/a/@href")[0].replace("/", "").replace("voddetail", "").replace(".html", "") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 999 - result['limit'] = 5 - result['total'] = 9999 - return result - - def detailContent(self, array): - tid = array[0] - url = 'https://www.30dian.cn/voddetail/{0}.html'.format(tid) - header = {"User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - divContent = root.xpath("//div[@class='col-lg-wide-75 col-md-wide-7 col-xs-1 padding-0']")[0] - title = divContent.xpath(".//div[@class='myui-content__detail']/h1/text()")[0] - pic = divContent.xpath(".//div[@class='myui-content__thumb']/a/img/@data-original")[0] - det = divContent.xpath(".//div[@class='col-pd text-collapse content']/span[@class='data']")[0] - if det.text is None: - detail = det.xpath(".//p/text()")[0] - else: - detail = det.text - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": detail - } - infoArray = divContent.xpath(".//div[@class='myui-content__detail']/p[contains(@class,'data')]") - for info in infoArray: - content = info.xpath('string(.)') - flag = "分类" in content - if flag == True: - infon = content.replace("\t","").replace("\n","").strip().split('\r') - for inf in infon: - if inf.startswith('分类'): - vod['type_name'] = inf.replace("分类:", "") - if inf.startswith('地区'): - vod['vod_area'] = inf.replace("地区:", "") - if inf.startswith('年份'): - vod['vod_year'] = inf.replace("年份:", "") - if content.startswith('主演'): - vod['vod_actor'] = content.replace("\xa0", "/").replace("主演:", "").strip('/') - if content.startswith('更新'): - vod['vod_remarks'] = content.replace("更新:", "") - if content.startswith('导演'): - vod['vod_director'] = content.replace("\xa0", "").replace("导演:", "").strip('/') - - vod_play_from = '$$$' - playFrom = [] - vodHeader = divContent.xpath(".//div[@class='myui-panel_hd']/div/ul/li/a[contains(@href,'playlist')]/text()") - for v in vodHeader: - playFrom.append(v.replace(" ", "")) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = divContent.xpath(".//div[contains(@id,'playlist')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./ul/li/a') - if len(aList) <= 0: - name = '无法找到播放源' - tId = '00000' - vodItems.append(name + "$" + tId) - else: - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath("./text()")[0].replace(" ", "") - tId = self.regStr(href, '/vodplay/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://www.30dian.cn/vodsearch/-------------.html?wd={0}'.format(key) - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - rsp = self.fetch(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//ul[contains(@class,'myui-vodlist__media clearfix')]/li") - videos = [] - for a in aList: - name = a.xpath(".//div[@class='detail']/h4/a/text()")[0] - pic = a.xpath(".//a[contains(@class,'myui-vodlist__thumb')]//@data-original")[0] - mark = a.xpath(".//span[@class='tag']/text()")[0] - sid = a.xpath(".//div[@class='detail']/h4/a/@href")[0] - sid = self.regStr(sid,'/voddetail/(\\S+).html') - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - if id == '00000': - return {} - url = 'https://www.30dian.cn/vodplay/{0}.html'.format(id) - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - scripts = root.xpath("//div[@class='embed-responsive clearfix']/script[@type='text/javascript']/text()")[0] - ukey = re.findall(r"url(.*)url_next", scripts)[0].replace('"', "").replace(',', "").replace(':', "") - purl = urllib.parse.unquote(ukey) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] =purl - result["header"] = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = { - 'url': '', - 'header': '', - 'param': '', - 'type': 'string', - 'after': '' - } - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_coke.py b/TVBox_PY/py_coke.py deleted file mode 100644 index 96bf2aa..0000000 --- a/TVBox_PY/py_coke.py +++ /dev/null @@ -1,232 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import requests -import base64 - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "Cokemv" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - cateManual = { - "抖音电影":"5", - "电视剧":"2", - "电影":"1", - "动漫":"4", - "综艺":"3" - } - 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("https://cokemv.me/") - root = self.html(rsp.text) - aList = root.xpath("//div[@class='main']//div[contains(@class,'module-items')]/a") - - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('.//img/@data-original')[0] - mark = a.xpath(".//div[@class='module-item-note']/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - - urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] - urlParams[0] = tid - urlParams[8] = pg - for key in extend: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams) - url = 'https://cokemv.me/vodshow/{0}.html'.format(params) - rsp = self.fetch(url) - root = self.html(rsp.text) - aList = root.xpath("//div[contains(@class, 'module-items')]/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('.//img/@data-original')[0] - mark = a.xpath(".//div[contains(@class,'module-item-note')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\d+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - - 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 = 'https://cokemv.me/voddetail/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(rsp.text) - divContent = root.xpath("//div[@class='module-info-main']")[0] - title = divContent.xpath('.//h1/text()')[0] - year = divContent.xpath('.//div/div/div[1]/a/text()')[0] - area = divContent.xpath('.//div/div/div[2]/a/text()')[0] - typ = divContent.xpath('.//div/div/div[3]/a/text()') - type = ', '.join(typ) - dir = divContent.xpath(".//div[@class='module-info-items']/div[2]/div[1]/a/text()")[0] - act = divContent.xpath(".//div[@class='module-info-items']/div[4]/div/a/text()") - actor = ', '.join(act) - pic = root.xpath(".//div[@class='module-poster-bg']//img/@data-original")[0] - detail = root.xpath(".//div[@class='module-info-introduction-content']/p/text()")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":type, - "vod_year":year, - "vod_area":area, - "vod_remarks":"", - "vod_actor":actor, - "vod_director":dir, - "vod_content":detail - } - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath("//div[@class='module-tab-item tab-item']/span/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='module-play-list']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./div/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('.//span/text()')[0] - tId = self.regStr(href,'/vodplay/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - - def verifyCode(self, url): - retry = 5 - 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"} - while retry: - try: - session = requests.session() - img = session.get('https://cokemv.me/index.php/verify/index.html?', headers=header).content - code = session.post('https://api.nn.ci/ocr/b64/text', data=base64.b64encode(img).decode()).text - res = session.post(url=f"https://cokemv.me/index.php/ajax/verify_check?type=search&verify={code}", headers=header).json() - if res["msg"] == "ok": - return session - except Exception as e: - print(e) - finally: - retry = retry - 1 - - def searchContent(self, key, quick): - url = 'https://cokemv.me/vodsearch/-------------.html?wd={0}'.format(key) - session = self.verifyCode(url) - rsp = session.get(url) - root = self.html(rsp.text) - vodList = root.xpath("//div[@class='module-card-item module-item']/a[@class='module-card-item-poster']") - videos = [] - for vod in vodList: - name = vod.xpath(".//img/@alt")[0] - pic = vod.xpath(".//img/@data-original")[0] - mark = vod.xpath(".//div[@class='module-item-note']/text()")[0] - sid = vod.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - - config = { - "player": {"cokemv0555":{"show":"COKEMV","des":"","ps":"0","parse":""},"cokeqie01":{"show":"極速路線","des":"","ps":"0","parse":""},"xin":{"show":"高速路線","des":"","ps":"0","parse":""},"90mm":{"show":"COKEMV(測試)","des":"","ps":"0","parse":""},"toutiao":{"show":"海外路線","des":"","ps":"0","parse":""},"age01":{"show":"動漫一線","des":"","ps":"0","parse":""},"mahua":{"show":"海外(禁國內)","des":"","ps":"0","parse":""},"age02":{"show":"動漫二線","des":"","ps":"0","parse":""}}, - "filter": {"5":[{"key":3,"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":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"國語","v":"國語"},{"n":"英語","v":"英語"},{"n":"粵語","v":"粵語"},{"n":" 閩南語","v":"閩南語"},{"n":"韓語","v":"韓語"},{"n":"日語","v":"日語"},{"n":"法語","v":"法語"},{"n":"德語","v":"德語"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"2":[{"key":0,"name":"类型","value":[{"n":"全部","v":"2"},{"n":"大陸劇","v":"13"},{"n":"香港劇","v":"14"},{"n":"韓國劇","v":"15"},{"n":"歐美劇","v":"16"},{"n":"日本劇","v":"20"},{"n":"台灣劇","v":"21"},{"n":"泰國劇","v":"22"}]},{"key":1,"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":"其他"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"1":[{"key":0,"name":"类型","value":[{"n":"全部","v":"1"},{"n":"動作片","v":"6"},{"n":"喜劇片","v":"7"},{"n":"愛情片","v":"8"},{"n":"科幻片","v":"9"},{"n":"恐怖片","v":"10"},{"n":"劇情片","v":"11"},{"n":"戰爭片","v":"12"},{"n":"犯罪片","v":"23"},{"n":"奇幻片","v":"24"},{"n":"懸疑片","v":"25"},{"n":"記錄片","v":"27"}]},{"key":1,"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":"其他"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"德语","v":"德语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"4":[{"key":0,"name":"类型","value":[{"n":"全部","v":"4"},{"n":"動畫電影","v":"41"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"日本","v":"日本"},{"n":"美国","v":"美国"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"3":[{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"韩国","v":" 韩国"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩 语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":" 时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}]} - } - header = { - "origin":"https://cokemv.me", - "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" - } - def playerContent(self,flag,id,vipFlags): - url = 'https://cokemv.me/vodplay/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - result = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - parseUrl = "" - playerConfig = self.config['player'] - if jo['from'] in self.config['player']: - playerConfig = self.config['player'][jo['from']] - videoUrl = jo['url'] - playerUrl = playerConfig['parse'] - result["parse"] = playerConfig['ps'] - result["playUrl"] = playerUrl - result["url"] = videoUrl - result["header"] = json.dumps(self.header) - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_cokemv.py b/TVBox_PY/py_cokemv.py deleted file mode 100644 index 96bf2aa..0000000 --- a/TVBox_PY/py_cokemv.py +++ /dev/null @@ -1,232 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import requests -import base64 - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "Cokemv" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - cateManual = { - "抖音电影":"5", - "电视剧":"2", - "电影":"1", - "动漫":"4", - "综艺":"3" - } - 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("https://cokemv.me/") - root = self.html(rsp.text) - aList = root.xpath("//div[@class='main']//div[contains(@class,'module-items')]/a") - - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('.//img/@data-original')[0] - mark = a.xpath(".//div[@class='module-item-note']/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - - urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] - urlParams[0] = tid - urlParams[8] = pg - for key in extend: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams) - url = 'https://cokemv.me/vodshow/{0}.html'.format(params) - rsp = self.fetch(url) - root = self.html(rsp.text) - aList = root.xpath("//div[contains(@class, 'module-items')]/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('.//img/@data-original')[0] - mark = a.xpath(".//div[contains(@class,'module-item-note')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\d+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - - 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 = 'https://cokemv.me/voddetail/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(rsp.text) - divContent = root.xpath("//div[@class='module-info-main']")[0] - title = divContent.xpath('.//h1/text()')[0] - year = divContent.xpath('.//div/div/div[1]/a/text()')[0] - area = divContent.xpath('.//div/div/div[2]/a/text()')[0] - typ = divContent.xpath('.//div/div/div[3]/a/text()') - type = ', '.join(typ) - dir = divContent.xpath(".//div[@class='module-info-items']/div[2]/div[1]/a/text()")[0] - act = divContent.xpath(".//div[@class='module-info-items']/div[4]/div/a/text()") - actor = ', '.join(act) - pic = root.xpath(".//div[@class='module-poster-bg']//img/@data-original")[0] - detail = root.xpath(".//div[@class='module-info-introduction-content']/p/text()")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":type, - "vod_year":year, - "vod_area":area, - "vod_remarks":"", - "vod_actor":actor, - "vod_director":dir, - "vod_content":detail - } - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath("//div[@class='module-tab-item tab-item']/span/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='module-play-list']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./div/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('.//span/text()')[0] - tId = self.regStr(href,'/vodplay/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - - def verifyCode(self, url): - retry = 5 - 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"} - while retry: - try: - session = requests.session() - img = session.get('https://cokemv.me/index.php/verify/index.html?', headers=header).content - code = session.post('https://api.nn.ci/ocr/b64/text', data=base64.b64encode(img).decode()).text - res = session.post(url=f"https://cokemv.me/index.php/ajax/verify_check?type=search&verify={code}", headers=header).json() - if res["msg"] == "ok": - return session - except Exception as e: - print(e) - finally: - retry = retry - 1 - - def searchContent(self, key, quick): - url = 'https://cokemv.me/vodsearch/-------------.html?wd={0}'.format(key) - session = self.verifyCode(url) - rsp = session.get(url) - root = self.html(rsp.text) - vodList = root.xpath("//div[@class='module-card-item module-item']/a[@class='module-card-item-poster']") - videos = [] - for vod in vodList: - name = vod.xpath(".//img/@alt")[0] - pic = vod.xpath(".//img/@data-original")[0] - mark = vod.xpath(".//div[@class='module-item-note']/text()")[0] - sid = vod.xpath("./@href")[0] - sid = self.regStr(sid,"/voddetail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - - config = { - "player": {"cokemv0555":{"show":"COKEMV","des":"","ps":"0","parse":""},"cokeqie01":{"show":"極速路線","des":"","ps":"0","parse":""},"xin":{"show":"高速路線","des":"","ps":"0","parse":""},"90mm":{"show":"COKEMV(測試)","des":"","ps":"0","parse":""},"toutiao":{"show":"海外路線","des":"","ps":"0","parse":""},"age01":{"show":"動漫一線","des":"","ps":"0","parse":""},"mahua":{"show":"海外(禁國內)","des":"","ps":"0","parse":""},"age02":{"show":"動漫二線","des":"","ps":"0","parse":""}}, - "filter": {"5":[{"key":3,"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":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"國語","v":"國語"},{"n":"英語","v":"英語"},{"n":"粵語","v":"粵語"},{"n":" 閩南語","v":"閩南語"},{"n":"韓語","v":"韓語"},{"n":"日語","v":"日語"},{"n":"法語","v":"法語"},{"n":"德語","v":"德語"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"2":[{"key":0,"name":"类型","value":[{"n":"全部","v":"2"},{"n":"大陸劇","v":"13"},{"n":"香港劇","v":"14"},{"n":"韓國劇","v":"15"},{"n":"歐美劇","v":"16"},{"n":"日本劇","v":"20"},{"n":"台灣劇","v":"21"},{"n":"泰國劇","v":"22"}]},{"key":1,"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":"其他"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"1":[{"key":0,"name":"类型","value":[{"n":"全部","v":"1"},{"n":"動作片","v":"6"},{"n":"喜劇片","v":"7"},{"n":"愛情片","v":"8"},{"n":"科幻片","v":"9"},{"n":"恐怖片","v":"10"},{"n":"劇情片","v":"11"},{"n":"戰爭片","v":"12"},{"n":"犯罪片","v":"23"},{"n":"奇幻片","v":"24"},{"n":"懸疑片","v":"25"},{"n":"記錄片","v":"27"}]},{"key":1,"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":"其他"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"德语","v":"德语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"4":[{"key":0,"name":"类型","value":[{"n":"全部","v":"4"},{"n":"動畫電影","v":"41"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"日本","v":"日本"},{"n":"美国","v":"美国"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}],"3":[{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"韩国","v":" 韩国"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩 语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":" 时间排序","v":"time"},{"n":"人气排序","v":"hits"},{"n":"评分排序","v":"score"}]}]} - } - header = { - "origin":"https://cokemv.me", - "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" - } - def playerContent(self,flag,id,vipFlags): - url = 'https://cokemv.me/vodplay/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - result = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - parseUrl = "" - playerConfig = self.config['player'] - if jo['from'] in self.config['player']: - playerConfig = self.config['player'][jo['from']] - videoUrl = jo['url'] - playerUrl = playerConfig['parse'] - result["parse"] = playerConfig['ps'] - result["playUrl"] = playerUrl - result["url"] = videoUrl - result["header"] = json.dumps(self.header) - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_cyys.py b/TVBox_PY/py_cyys.py deleted file mode 100644 index 1d0ae57..0000000 --- a/TVBox_PY/py_cyys.py +++ /dev/null @@ -1,242 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -import re -sys.path.append('..') -from base.spider import Spider -import urllib.parse -import base64 -from Crypto.Cipher import AES - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "创艺影视" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "电影": "1", - "剧集": "2", - "动漫": "4", - "综艺": "3", - "纪录片": "30" - } - 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 - - def categoryContent(self, tid, pg, filter, extend): - result = {} - header = {"User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - url = 'https://www.30dian.cn/vodtype/{0}-{1}.html'.format(tid, pg) - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='myui-panel myui-panel-bg clearfix']/div/div/ul/li") - videos = [] - for a in aList: - name = a.xpath('./div/a/@title')[0] - pic = a.xpath('./div/a/@data-original')[0] - mark = a.xpath("./div/a/span/span[@class='tag']/text()")[0] - sid = a.xpath("./div/a/@href")[0].replace("/", "").replace("voddetail", "").replace(".html", "") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 999 - result['limit'] = 5 - result['total'] = 9999 - return result - - def detailContent(self, array): - tid = array[0] - url = 'https://www.30dian.cn/voddetail/{0}.html'.format(tid) - header = {"User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - divContent = root.xpath("//div[@class='col-lg-wide-75 col-md-wide-7 col-xs-1 padding-0']")[0] - title = divContent.xpath(".//div[@class='myui-content__detail']/h1/text()")[0] - pic = divContent.xpath(".//div[@class='myui-content__thumb']/a/img/@data-original")[0] - det = divContent.xpath(".//div[@class='col-pd text-collapse content']/span[@class='data']")[0] - if det.text is None: - detail = det.xpath(".//p/text()")[0] - else: - detail = det.text - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": detail - } - infoArray = divContent.xpath(".//div[@class='myui-content__detail']/p[contains(@class,'data')]") - for info in infoArray: - content = info.xpath('string(.)') - flag = "分类" in content - if flag == True: - infon = content.replace("\t","").replace("\n","").strip().split('\r') - for inf in infon: - if inf.startswith('分类'): - vod['type_name'] = inf.replace("分类:", "") - if inf.startswith('地区'): - vod['vod_area'] = inf.replace("地区:", "") - if inf.startswith('年份'): - vod['vod_year'] = inf.replace("年份:", "") - if content.startswith('主演'): - vod['vod_actor'] = content.replace("\xa0", "/").replace("主演:", "").strip('/') - if content.startswith('更新'): - vod['vod_remarks'] = content.replace("更新:", "") - if content.startswith('导演'): - vod['vod_director'] = content.replace("\xa0", "").replace("导演:", "").strip('/') - - vod_play_from = '$$$' - playFrom = [] - vodHeader = divContent.xpath(".//div[@class='myui-panel_hd']/div/ul/li/a[contains(@href,'playlist')]/text()") - for v in vodHeader: - playFrom.append(v.replace(" ", "")) - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - playList = [] - vodList = divContent.xpath(".//div[contains(@id,'playlist')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./ul/li/a') - if len(aList) <= 0: - name = '无法找到播放源' - tId = '00000' - vodItems.append(name + "$" + tId) - else: - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath("./text()")[0].replace(" ", "") - tId = self.regStr(href, '/vodplay/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://www.30dian.cn/vodsearch/-------------.html?wd={0}'.format(key) - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - rsp = self.fetch(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//ul[contains(@class,'myui-vodlist__media clearfix')]/li") - videos = [] - for a in aList: - name = a.xpath(".//div[@class='detail']/h4/a/text()")[0] - pic = a.xpath(".//a[contains(@class,'myui-vodlist__thumb')]//@data-original")[0] - mark = a.xpath(".//span[@class='tag']/text()")[0] - sid = a.xpath(".//div[@class='detail']/h4/a/@href")[0] - sid = self.regStr(sid,'/voddetail/(\\S+).html') - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - def parseCBC(self, enc, key, iv): - keyBytes = key.encode("utf-8") - ivBytes = iv.encode("utf-8") - cipher = AES.new(keyBytes, AES.MODE_CBC, ivBytes) - msg = cipher.decrypt(enc) - paddingLen = msg[len(msg) - 1] - return msg[0:-paddingLen] - - def playerContent(self, flag, id, vipFlags): - result = {} - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} - if id == '00000': - return {} - url = 'https://www.30dian.cn/vodplay/{0}.html'.format(id) - rsp = self.fetch(url,headers=header) - root = self.html(self.cleanText(rsp.text)) - scripts = root.xpath("//div[@class='embed-responsive clearfix']/script[@type='text/javascript']/text()")[0] - ukey = re.findall(r"url(.*)url_next", scripts)[0].replace('"', "").replace(',', "").replace(':', "") - pf = re.findall(r'\"from\":\"(.*?)\"', scripts)[0] - purl = urllib.parse.unquote(ukey) - if purl.startswith('http'): - purl = purl - if pf == 'wjm3u8': - prsp = self.fetch(purl, headers=header) - purle = prsp.text.strip('\n').split('\n')[-1] - purls = re.findall(r"http.*://.*?/", purl)[0].strip('/') - purl = purls + purle - else: - scrurl = 'https://vip.30dian.cn/?url={0}'.format(purl) - script = self.fetch(scrurl,headers=header) - html = script.text - pat = 'var le_token = \\"([\\d\\w]+)\\"' - cpat = 'getVideoInfo\\(\\"(.*)\\"\\)' - content = self.regStr(html, cpat) - iv = self.regStr(html, pat) - key = 'A42EAC0C2B408472' - purl = self.parseCBC(base64.b64decode(content), key, iv).decode() - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = purl - result["header"] = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = { - 'url': '', - 'header': '', - 'param': '', - 'type': 'string', - 'after': '' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_czspp.py b/TVBox_PY/py_czspp.py deleted file mode 100644 index 999a063..0000000 --- a/TVBox_PY/py_czspp.py +++ /dev/null @@ -1,300 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import base64 -import hashlib -import requests -from Crypto.Cipher import AES -import urllib - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "厂长资源" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "豆瓣电影Top250": "dbtop250", - "最新电影": "zuixindianying", - "电视剧": "dsj", - "国产剧": "gcj", - "美剧": "meijutt", - "韩剧": "hanjutv", - "番剧": "fanju", - "动漫": "dm" - } - classes = [] - for k in cateManual: - classes.append({ - 'type_name': k, - 'type_id': cateManual[k] - }) - result['class'] = classes - return result - - def homeVideoContent(self): - url = "https://czspp.com" - header = { - "Connection": "keep-alive", - "Referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" - } - session = self.getCookie(url,header) - rsp = session.get(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='mi_btcon']//ul/li") - videos = [] - for a in aList: - name = a.xpath('./a/img/@alt')[0] - pic = a.xpath('./a/img/@data-original')[0] - mark = a.xpath("./div[@class='hdinfo']/span/text()")[0] - sid = a.xpath("./a/@href")[0] - sid = self.regStr(sid, "/movie/(\\S+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - - def getCookie(self,url,header): - session = requests.session() - rsp = session.get(url) - nurl = 'https://czspp.com' + self.regStr(rsp.text, 'src=\"(.*?)\"') - nrsp = session.get(nurl, headers=header) - key = self.regStr(nrsp.text, 'var key=\"(.*?)\"') - avalue = self.regStr(nrsp.text, 'value=\"(.*?)\"') - c = '' - for i in range(0, len(avalue)): - a = avalue[i] - b = ord(a) - c = c + str(b) - value = hashlib.md5(c.encode()).hexdigest() - session.get('https://czspp.com/a20be899_96a6_40b2_88ba_32f1f75f1552_yanzheng_ip.php?type=96c4e20a0e951f471d32dae103e83881&key={0}&value={1}'.format(key,value), headers=header) - return session - - def categoryContent(self, tid, pg, filter, extend): - result = {} - url = 'https://czspp.com/{0}/page/{1}'.format(tid,pg) - header = { - "Connection": "keep-alive", - "Referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" - } - session = self.getCookie(url,header) - rsp = session.get(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[contains(@class,'bt_img mi_ne_kd mrb')]/ul/li") - videos = [] - for a in aList: - name = a.xpath('./a/img/@alt')[0] - pic = a.xpath('./a/img/@data-original')[0] - mark = a.xpath(".//div[@class='jidi']/span/text()") - if mark ==[]: - mark = a.xpath("./div[@class='hdinfo']/span/text()") - mark = mark[0] - sid = a.xpath("./a/@href")[0] - sid = self.regStr(sid, "/movie/(\\S+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - 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 = 'https://czspp.com/movie/{0}.html'.format(tid) - header = { - "Connection": "keep-alive", - "Referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" - } - session = self.getCookie(url, header) - rsp = session.get(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - node = root.xpath("//div[@class='dyxingq']")[0] - pic = node.xpath(".//div[@class='dyimg fl']/img/@src")[0] - title = node.xpath('.//h1/text()')[0] - detail = root.xpath(".//div[@class='yp_context']//p/text()")[0] - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": detail - } - infoArray = node.xpath(".//ul[@class='moviedteail_list']/li") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('地区'): - tpyeare = '' - for inf in info: - tn = inf.text - tpyeare = tpyeare +'/'+'{0}'.format(tn) - vod['vod_area'] = tpyeare.strip('/') - if content.startswith('年份'): - vod['vod_year'] = content.replace("年份:","") - if content.startswith('主演'): - tpyeact = '' - for inf in info: - tn = inf.text - tpyeact = tpyeact +'/'+'{0}'.format(tn) - vod['vod_actor'] = tpyeact.strip('/') - if content.startswith('导演'): - tpyedire = '' - for inf in info: - tn = inf.text - tpyedire = tpyedire +'/'+'{0}'.format(tn) - vod['vod_director'] = tpyedire .strip('/') - vod_play_from = '$$$' - playFrom = ['厂长'] - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='paly_list_btn']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0].replace('\xa0','') - tId = self.regStr(href, '/v_play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://czspp.com/xssearch?q={0}'.format(urllib.parse.quote(key)) - header = { - "Connection": "keep-alive", - "Referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" - } - session = self.getCookie(url, header) - rsp = session.get(url, headers=header) - root = self.html(self.cleanText(rsp.text)) - vodList = root.xpath("//div[contains(@class,'mi_ne_kd')]/ul/li/a") - videos = [] - for vod in vodList: - name = vod.xpath('./img/@alt')[0] - pic = vod.xpath('./img/@data-original')[0] - href = vod.xpath('./@href')[0] - tid = self.regStr(href, 'movie/(\\S+).html') - res = vod.xpath('./div[@class="jidi"]/span/text()') - if len(res) == 0: - remark = '全1集' - else: - remark = vod.xpath('./div[@class="jidi"]/span/text()')[0] - videos.append({ - "vod_id": tid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": remark - }) - result = { - 'list': videos - } - return result - config = { - "player": {}, - "filter": {} - } - header = { - "Referer": "https://czspp.com/", - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" - } - def parseCBC(self, enc, key, iv): - keyBytes = key.encode("utf-8") - ivBytes = iv.encode("utf-8") - cipher = AES.new(keyBytes, AES.MODE_CBC, ivBytes) - msg = cipher.decrypt(enc) - paddingLen = msg[len(msg) - 1] - return msg[0:-paddingLen] - - def playerContent(self, flag, id, vipFlags): - result = {} - url = 'https://czspp.com/v_play/{0}.html'.format(id) - header = { - "Connection": "keep-alive", - "Referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36" - } - session = self.getCookie(url, header) - pat = '\\"([^\\"]+)\\";var [\\d\\w]+=function dncry.*md5.enc.Utf8.parse\\(\\"([\\d\\w]+)\\".*md5.enc.Utf8.parse\\(([\\d]+)\\)' - rsp = session.get(url, headers=header) - html = rsp.text - content = self.regStr(html, pat) - if content == '': - str3 = url - pars = 1 - header = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" - } - else: - key = self.regStr(html, pat, 2) - iv = self.regStr(html, pat, 3) - decontent = self.parseCBC(base64.b64decode(content), key, iv).decode() - urlPat = 'video: \\{url: \\\"([^\\\"]+)\\\"' - vttPat = 'subtitle: \\{url:\\\"([^\\\"]+\\.vtt)\\\"' - str3 = self.regStr(decontent, urlPat) - str4 = self.regStr(decontent, vttPat) - self.loadVtt(str3) - pars = 0 - header = '' - if len(str4) > 0: - result['subf'] = '/vtt/utf-8' - result['subt'] = '' - result = { - 'parse': pars, - 'playUrl': '', - 'url': str3, - 'header': header - } - return result - - - def loadVtt(self, url): - pass - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = {} - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_douban.py b/TVBox_PY/py_douban.py deleted file mode 100644 index 7ccd3f1..0000000 --- a/TVBox_PY/py_douban.py +++ /dev/null @@ -1,128 +0,0 @@ -#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=' + pg - 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", - "content-type": "application/json", - "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, ""] \ No newline at end of file diff --git a/TVBox_PY/py_douyu.py b/TVBox_PY/py_douyu.py deleted file mode 100644 index 3a5c2bb..0000000 --- a/TVBox_PY/py_douyu.py +++ /dev/null @@ -1,138 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json - -class Spider(Spider): - def getName(self): - return "斗鱼" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "热门游戏": "热门游戏", - "主机游戏": "主机游戏", - "原创IP": "原创IP" - } - 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 = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'http://live.yj1211.work/api/live/getRecommendByPlatformArea?platform=douyu&size=20&area={0}&page={1}'.format(tid, pg) - rsp = self.fetch(url) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data'] - for vod in vodList: - aid = (vod['roomId']).strip() - title = vod['roomName'].strip() - img = vod['roomPic'].strip() - remark = (vod['ownerName']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def detailContent(self,array): - aid = array[0] - url = "http://live.yj1211.work/api/live/getRoomInfo?platform=douyu&roomId={0}".format(aid) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['roomName'] - pic = jo['roomPic'] - desc = str(jo['online']) - dire = jo['ownerName'] - typeName = jo['categoryName'] - remark = jo['categoryName'] - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "", - "vod_remarks": remark, - "vod_actor": '在线人数:' + desc, - "vod_director": dire, - "vod_content": "" - } - playUrl = '原画' + '${0}#'.format(aid) - vod['vod_play_from'] = '斗鱼直播' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - def searchContent(self,key,quick): - result = {} - return result - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'http://live.yj1211.work/api/live/getRealUrl?platform=douyu&roomId={0}'.format(id) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - if len(jRoot['data']) == 0: - return {} - jo = jRoot['data'] - ja = jo['OD'] - url = ja - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - 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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - config = { - "player": {}, - "filter": {} - } - header = {} - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_freezb.py b/TVBox_PY/py_freezb.py deleted file mode 100644 index e956f0c..0000000 --- a/TVBox_PY/py_freezb.py +++ /dev/null @@ -1,161 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import re -import math - -class Spider(Spider): - def getName(self): - return "体育直播" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - 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): - result = {} - return result - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'http://www.freezb.live/' - rsp = self.fetch(url) - html = self.html(rsp.text) - aList = html.xpath("//tr[@class='match_main']") - videos = [] - img = 'https://s1.ax1x.com/2022/10/07/x3NPUO.png' - for a in aList: - urlList = a.xpath("./td[@class='update_data live_link']/a") - stat = a.xpath("./td[contains(@style, 'font-weight:bold')]/sapn/@title")[0] - time = a.xpath("./td[contains(@style, 'font-weight:bold')]/sapn/text()")[0] - if '比分' not in urlList[0].xpath("./text()")[0] and stat == '直播中': - remark = a.xpath(".//p[@class='raceclass matchcolor']/@title")[0].replace('直播','') + '|' + time - name = a.xpath("string(./td[4])").replace(' ','').replace('\tVS','VS') - if 'VS' not in name: - names = name.split('\t') - remark = names[0] + '|' + time - name = names[-1].replace('vs','VS') - aid = '' - for url in urlList: - title = url.xpath("./text()")[0] - aurl = url.xpath("./@href")[0] - aurl = self.regStr(reg=r'/tv/(.*?).html', src=aurl) - if '比分' not in title: - aid = aid + title + '@@@' + aurl + '#' - videos.append({ - "vod_id": name + '###' + remark.split('|')[0] + '###' + aid, - "vod_name": name, - "vod_pic": img, - "vod_remarks": remark - }) - numvL = len(videos) - pgc = math.ceil(numvL/15) - result['list'] = videos - result['page'] = pg - result['pagecount'] = pgc - result['limit'] = numvL - result['total'] = numvL - return result - - def detailContent(self,array): - aid = array[0] - aids = aid.split('###') - name = aids[0] - typeName = aids[1] - tus = aids[2].strip('#').split('#') - pic = 'https://s1.ax1x.com/2022/10/07/x3NPUO.png' - vod = { - "vod_id": name, - "vod_name": name, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "", - "vod_remarks": '', - "vod_actor": '', - "vod_director":'', - "vod_content": '' - } - purl = '' - for tu in tus: - title = tu.split('@@@')[0] - uid = tu.split('@@@')[1] - url = "http://www.freezb.live/tv/{0}.html".format(uid) - rsp = self.fetch(url) - root = self.html(rsp.text) - phpurl = root.xpath("//div[@class='media']/iframe/@src")[0] - purl = purl + '{0}${1}@@@{2}'.format(title,phpurl,uid) + '#' - vod['vod_play_from'] = '体育直播' - vod['vod_play_url'] = purl - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self,key,quick): - result = {} - return result - - def playerContent(self,flag,id,vipFlags): - result = {} - ids = id.split('@@@') - url = ids[0] - vid = ids[1] - headers = { - "referer": "http://www.freezb.live/tv/{0}.html".format(vid), - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" - } - rsp = self.fetch(url,headers=headers) - aurl = self.regStr(reg=r'\"../(.*?)\"', src=rsp.text) - if aurl =='': - url = self.regStr(reg=r"url: \'(.*?)\'", src=rsp.text) - else: - pheaders = { - "referer": url, - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" - } - purl = self.regStr(reg=r'(.*)/', src=url) + '/' + aurl - prsp = self.fetch(purl, headers=pheaders) - url = self.regStr(reg=r"url: \'(.*?)\'", src=prsp.text) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_genmov.py b/TVBox_PY/py_genmov.py deleted file mode 100644 index b00249b..0000000 --- a/TVBox_PY/py_genmov.py +++ /dev/null @@ -1,202 +0,0 @@ -#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 isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - # genmov - # https://www.genmov.com/v/yinyue.html - result = {} - cateManual = { - "电影":"dianying", - "连续剧":"lianxuju", - "动漫":"dongman", - "综艺":"zongyi", - "少儿":"shaoer", - "音乐":"yinyue" - } - 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("https://www.genmov.com/",headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//div[@class='module module-wrapper']//div[@class='module-item']") - videos = [] - for a in aList: - name = a.xpath(".//div[@class='module-item-pic']/a/@title")[0] - pic = a.xpath(".//div[@class='module-item-pic']/img/@data-src")[0] - mark = a.xpath("./div[@class='module-item-text']/text()")[0] - sid = a.xpath(".//div[@class='module-item-pic']/a/@href")[0] - sid = self.regStr(sid,"/video/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] - urlParams[0] = tid - urlParams[8] = pg - for key in extend: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams) - url = 'https://www.genmov.com/vodshow/{0}.html'.format(params) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//div[@class='module-items']/div[@class='module-item']") - videos = [] - for a in aList: - name = a.xpath(".//div[@class='module-item-pic']/a/@title")[0] - pic = a.xpath(".//div[@class='module-item-pic']/img/@data-src")[0] - mark = a.xpath("./div[@class='module-item-text']/text()")[0] - sid = a.xpath(".//div[@class='module-item-pic']/a/@href")[0] - sid = self.regStr(sid,"/video/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def detailContent(self,array): - # video-info-header - tid = array[0] - url = 'https://www.genmov.com/video/{0}.html'.format(tid) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - title = root.xpath(".//h1[@class='page-title']/text()")[0] - pic = root.xpath(".//div[@class='video-cover']//img/@data-src")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - infoArray = root.xpath(".//div[@class='video-info-items']") - for info in infoArray: - content = info.xpath('string(.)') - # if content.startswith('类型'): - # vod['type_name'] = content - # if content.startswith('年份'): - # vod['vod_year'] = content - # if content.startswith('地区'): - # vod['vod_area'] = content - if content.startswith('集数'): - vod['vod_remarks'] = content - if content.startswith('主演'): - vod['vod_actor'] = content - if content.startswith('导演'): - vod['vod_director'] = content - if content.startswith('剧情'): - vod['vod_content'] = content - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath(".//main[@id='main']//div[@class='module-heading']//div[contains(@class,'module-tab-item')]/span/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath(".//main[@id='main']//div[contains(@class,'module-list')]//div[@class='sort-item']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./span/text()')[0] - tId = self.regStr(href,'/play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = {} - return result - def playerContent(self,flag,id,vipFlags): - # https://www.genmov.com/play/301475-1-1.html - # https://www.genmov.com/static/js/playerconfig.js - url = 'https://www.genmov.com/play/{0}.html'.format(id) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - result = {} - parseUrl = "" - playerConfig = self.config['player'] - if jo['from'] in self.config['player']: - parser = self.config['player'][jo['from']] - originUrl = jo['url'] - parseUrl = parser['parse'] - - result["parse"] = parser['ps'] - result["playUrl"] = parseUrl - result["url"] = originUrl - result["header"] = '' - return result - - cookie = {} - config = { - "player": {"dplayer":{"show":"默认","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"qqy":{"show":"预告专用","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"qiyi":{"show":"爱奇艺","des":"qiyi.com","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"youku":{"show":"优酷","des":"youku.com","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"qq":{"show":"腾讯","des":"qq.com","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"mgtv":{"show":"芒果","des":"mgtv.com","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"letv":{"show":"乐视","des":"","ps":"1","parse":"https://jx.quanmingjiexi.com/?url="},"m1905":{"show":"电影网","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"bilibili":{"show":"哔哩哔哩","des":"","ps":"1","parse":"https://jx.bozrc.com:4433/player/?url="},"sohu":{"show":"搜狐","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"lzm3u8":{"show":"量子资源1","des":"支持手机电脑在线播放","ps":"0","parse":""},"ss4m3u8":{"show":"松鼠资源4","des":"支持手机电脑在线播放","ps":"0","parse":""},"ss3m3u8":{"show":"松鼠资源3","des":"支持手机电脑在线播放","ps":"0","parse":""},"ss2m3u8":{"show":"松鼠资源2","des":"支持手机电脑在线播放","ps":"0","parse":""},"ss1m3u8":{"show":"松鼠资源1","des":"支持手机电脑在线播放","ps":"0","parse":""},"jinyingm3u8":{"show":"金鹰资源②","des":"支持手机电脑在线播放","ps":"0","parse":""},"cmpyun":{"show":"冠军资源①","des":"支持手机电脑在线播放","ps":"0","parse":""},"kcm3u8":{"show":"快车资源①","des":"支持手机电脑在线播放","ps":"0","parse":""},"xlm3u8":{"show":"新浪资源2","des":"支持手机电脑在线播放","ps":"0","parse":""},"ssyun":{"show":"神速资源1","des":"支持手机电脑在线播放","ps":"0","parse":""},"ssm3u8":{"show":"神速资源2","des":"支持手机电脑在线播放","ps":"0","parse":""},"wolong":{"show":"卧龙资源","des":"支持手机电脑在线播放","ps":"1","parse":"https://vip.2ktvb.com/?url="},"ptzy":{"show":"葡萄资源","des":"支持手机电脑在线播放","ps":"0","parse":""},"zgzy":{"show":"猪哥播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"ukm3u8":{"show":"U酷点播","des":"支持手机电脑在线播放","ps":"0","parse":""},"fsm3u8":{"show":"飞速播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"mim3u8":{"show":"大米播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"if101":{"show":"if101播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"sgm3u8":{"show":"速更播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"kdm3u8":{"show":"酷点播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"xiuse":{"show":"秀色播放","des":"支持手机电脑在线播放","ps":"0","parse":""},"swm3u8":{"show":"丝袜播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"bdxm3u8":{"show":"北斗星m3u8","des":"支持手机电脑在线播放","ps":"0","parse":""},"hjm3u8":{"show":"花椒播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"kbzy":{"show":"快播云播","des":"支持手机电脑在线播放","ps":"0","parse":""},"88zym3u8":{"show":"88在线","des":"支持手机电脑在线播放","ps":"0","parse":""},"lezy":{"show":"乐库云播","des":"支持手机电脑在线播放","ps":"0","parse":""},"kkyun":{"show":"酷酷云播","des":"支持手机电脑在线播放","ps":"0","parse":""},"kkm3u8":{"show":"KK在线","des":"支持手机电脑在线播放","ps":"0","parse":""},"tpm3u8":{"show":"淘片播放器","des":"支持手机电脑在线播放","ps":"0","parse":""},"ckm3u8":{"show":"ck资源","des":"支持手机电脑在线播放","ps":"0","parse":""},"bjyun":{"show":"八戒云播","des":"支持手机电脑在线播放","ps":"0","parse":""},"gsm3u8":{"show":"光速云资源②","des":"支持手机电脑在线播放","ps":"0","parse":""},"m3u8":{"show":"m3u8在线","des":"支持手机电脑在线播放","ps":"0","parse":""},"videojs":{"show":"videojs-H5播放器","des":"videojs.com","ps":"0","parse":""},"iva":{"show":"iva-H5播放器","des":"videojj.com","ps":"0","parse":""},"iframe":{"show":"外链数据","des":"iframe外链数据","ps":"0","parse":""},"link":{"show":"外链数据","des":"外部网站播放链接","ps":"0","parse":""},"swf":{"show":"Flash文件","des":"swf","ps":"0","parse":""},"flv":{"show":"Flv文件","des":"flv","ps":"0","parse":""},"pptv":{"show":"PPTV","des":"pptv","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"migu":{"show":"咪咕","des":"migu","ps":"0","parse":"https://vip.2ktvb.com/player/sg.php?url="},"cctv":{"show":"cctv","des":"cctv","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"cntv":{"show":"cntv","des":"cntv","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"funshion":{"show":"风行","des":"funshion","ps":"1","parse":"hhttps://vip.2ktvb.com/player/sg.php?url="},"wasu":{"show":"华数","des":"wasu","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"605m3u8":{"show":"605线","des":"支持手机电脑在线播放","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"bjm3u8":{"show":"八戒","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"dbm3u8":{"show":"百度线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"hnm3u8":{"show":"牛牛线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"igen":{"show":"爱跟线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"kbm3u8":{"show":"快播线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"lajiao":{"show":"辣椒","des":"","ps":"1","parse":"https://lajiaoapi.com/watch?url="},"tkm3u8":{"show":"天空线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"tsm3u8":{"show":"Ts线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"wjm3u8":{"show":"无尽线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"xigua":{"show":"西瓜线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/sg.php?url="},"xkm3u8":{"show":"想看线","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"jhyun":{"show":"聚合云","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"sdm3u8":{"show":"闪电线","des":"支持手机电脑在线播放","ps":"1","parse":"https://vip.2ktvb.com/player/?url="},"ddzy":{"show":"极速多线","des":"","ps":"1","parse":"https://bo.dd520.cc//xmplayer/?url="},"jscq":{"show":"极速超清","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?xf=languang&url="},"jslg":{"show":"极速蓝光","des":"","ps":"1","parse":"https://vip.2ktvb.com/player/?xf=languang&url="}}, - "filter": {"dianying":[{"key":3,"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":"情色"}]},{"key":1,"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":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"德语","v":"德语"},{"n":"其它","v":"其它"}]},{"key":11,"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","v":"2004"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"lianxuju":[{"key":3,"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":"仙侠"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"大陆"},{"n":"韩国","v":"韩国"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"},{"n":"日本","v":"日本"},{"n":"美国","v":"美国"},{"n":"泰国","v":"泰国"},{"n":"英国","v":"英国"},{"n":"新加坡","v":"新加坡"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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","v":"2004"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"dongman":[{"key":3,"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":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"大陆"},{"n":"日本","v":"日本"},{"n":"欧美","v":"欧美"},{"n":"其他","v":"其他"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"zongyi":[{"key":3,"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":"音乐MV","v":"音乐MV"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"大陆"},{"n":"韩国","v":"韩国"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"},{"n":"美国","v":"美国"},{"n":"其它","v":"其它"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"shaoer":[{"key":3,"name":"分类","value":[{"n":"全部","v":""},{"n":"历险","v":"历险"},{"n":"奇幻","v":"奇幻"},{"n":"教育","v":"教 育"},{"n":"搞笑","v":"搞笑"},{"n":"教育","v":"教育"},{"n":"益智","v":"益智"}]},{"key":1,"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":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"法语","v":"法语"},{"n":"德语","v":"德语"},{"n":"其它","v":"其它"}]},{"key":11,"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","v":"2004"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"yinyue":[{"key":3,"name":"分类","value":[{"n":"全部","v":""},{"n":"MV","v":"MV"},{"n":"演唱会","v":"演唱会"},{"n":"音频","v":"音频"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"大陆"},{"n":"韩国","v":"韩国"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"}]},{"key":4,"name":"语言","value":[{"n":"全部","v":""},{"n":"韩语","v":"韩语"},{"n":"粤语","v":"粤语"},{"n":"日语","v":"日语"},{"n":"英语","v":"英语"},{"n":"泰语","v":"泰语"},{"n":"国语","v":"国语"}]},{"key":11,"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"}]},{"key":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}]} - } - header = { - 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.47' - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_gimytv.py b/TVBox_PY/py_gimytv.py deleted file mode 100644 index 669fced..0000000 --- a/TVBox_PY/py_gimytv.py +++ /dev/null @@ -1,216 +0,0 @@ -#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 isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - # https://gimytv.co/ - result = {} - cateManual = { - "电影": "movies", - "电视剧": "tvseries", - "综艺": "tv_show", - "动漫": "anime" - } - 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("https://gimytv.co/",headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='myui-vodlist clearfix']/li/div/a") - videos = [] - for a in aList: - name = a.xpath("./@title")[0] - pic = a.xpath("./@data-original")[0] - mark = a.xpath("./span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - urlParams = ["", "", "", ""] - urlParams[0] = tid - urlParams[3] = pg - suffix = '' - for key in extend: - if key == 4: - suffix = '/by/'+extend[key] - else: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams)+suffix - # https://gimytv.co/genre/tvseries--2022-/by/hits_month.html - url = 'https://gimytv.com/genre/{0}.html'.format(params) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='myui-vodlist clearfix']/li/div/a") - videos = [] - for a in aList: - name = a.xpath("./@title")[0] - pic = a.xpath("./@data-original")[0] - mark = a.xpath("./span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - 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 = 'https://gimytv.co/{0}.html'.format(tid) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - node = root.xpath("//div[@class='container']")[0] - title = node.xpath(".//div[@class='myui-content__thumb']/a/@title")[0] - pic = node.xpath(".//div[@class='myui-content__thumb']/a/img/@data-original")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - infoArray = node.xpath(".//div[@class='myui-content__detail']/p") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('分類'): - vod['type_name'] = content - # if content.startswith('年份'): - # vod['vod_year'] = content - # if content.startswith('地区'): - # vod['vod_area'] = content - if content.startswith('狀態'): - vod['vod_remarks'] = content - if content.startswith('主演'): - vod['vod_actor'] = content - if content.startswith('導演'): - vod['vod_director'] = content - # if content.startswith('剧情'): - # vod['vod_content'] = content - vod['vod_content'] = node.xpath(".//div[contains(@class,'col-pd')]/p/text()")[0] - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath(".//div[@class='myui-panel_hd']/div/h3/text()[2]") - for v in vodHeader: - playFrom.append(v.strip()) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath(".//ul[contains(@class,'myui-content__list')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./li/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href,'/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = "https://gimytv.co/search/-------------.html?wd={0}".format(key) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[contains(@class,'myui-vodlist__media')]/li") - videos = [] - for a in aList: - name = a.xpath(".//a/@title")[0] - pic = a.xpath(".//a/@data-original")[0] - mark = a.xpath(".//span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath(".//a/@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def playerContent(self,flag,id,vipFlags): - url = 'https://gimytv.co/{0}.html'.format(id) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - url = jo['url'] - result = {} - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - cookie = {} - config = { - "player": {}, - "filter": {"movies":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"劇情片","v":"drama"},{"n":"動作片","v":"action"},{"n":"科幻片","v":"scifi"},{"n":"喜劇片","v":"comedymovie"},{"n":"愛情片","v":"romance"},{"n":"戰爭片","v":"war"},{"n":"恐怖片","v":"horror"},{"n":"動畫電影","v":"animation"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"大陸","v":"大陸"},{"n":"中國大陸","v":"中國大陸"},{"n":"韓國","v":"韓國"},{"n":"香港","v":"香港"},{"n":"日本","v":"日本"},{"n":"英國","v":"英國"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"tvseries":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"陸劇","v":"cn"},{"n":"韓劇","v":"kr"},{"n":"美劇","v":"us"},{"n":"日劇","v":"jp"},{"n":"台劇","v":"tw"},{"n":"港劇","v":"hks"},{"n":"海外劇","v":"ot"},{"n":"紀錄片","v":"documentary"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"anime":[{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"日本","v":"日本"},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"大陸","v":"大陸"},{"n":"臺灣","v":"臺灣"},{"n":"香港","v":"香港"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"tv_show":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"纪录片","v":"28"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陸","v":"大陸"},{"n":"中國大陸","v":"中國大陸"},{"n":"韓國","v":"韓國"},{"n":"臺灣","v":"臺灣"},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"日本","v":"日本"},{"n":"香港","v":"香港"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}]} - } - header = { - 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.47' - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_gitcafe.py b/TVBox_PY/py_gitcafe.py deleted file mode 100644 index 7f4c2f1..0000000 --- a/TVBox_PY/py_gitcafe.py +++ /dev/null @@ -1,136 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import requests -import json - -class Spider(Spider): - def getDependence(self): - return ['py_ali'] - def getName(self): - return "py_gitcafe" - def init(self,extend): - self.ali = extend[0] - print("============py_gitcafe============") - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "华语电视" :"hyds", - "日韩电视" :"rhds", - "欧美电视" :"omds", - "其他电视" :"qtds", - "华语电影" :"hydy", - "日韩电影" :"rhdy", - "欧美电影" :"omdy", - "其他电影" :"qtdy", - "华语动漫" :"hydm", - "日韩动漫" :"rhdm", - "欧美动漫" :"omdm", - "纪录片" :"jlp", - "综艺片" :"zyp", - "教育培训" :"jypx", - "其他视频" :"qtsp", - "华语音乐" :"hyyy", - "日韩音乐" :"rhyy", - "欧美音乐" :"omyy", - "其他音乐" :"qtyy" - } - classes = [] - for k in cateManual: - classes.append({ - 'type_name':k, - 'type_id':cateManual[k] - }) - result['class'] = classes - if filter: - result['filter'] = self.config['filter'] - return result - def homeVideoContent(self): - result = {} - if len(self.homeData.keys()) == 0: - url = self.baseUrl+'/alipaper/home.json' - self.homeData = self.fetch(url,headers=self.header).json() - cateList = self.homeData['data'] - videos = [] - for cate in cateList: - if cate['info']['code'] in self.category: - vodList = cate['data'] - for vod in vodList: - videos.append({ - "vod_id":"https://www.aliyundrive.com/s/" + vod['key'], - "vod_name":vod['title'], - "vod_pic":'https://txc.gtimg.com/data/375895/2022/0214/d6b96cc3799b6417d30e4715d2973f64.png', - "vod_remarks":'' - }) - result['list']=videos - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = self.baseUrl+'/tool/alipaper/' - form = { - "action": "viewcat", - "cat": tid, - "num":pg - } - - rsp = requests.post(url,headers=self.header,data=form) - vodList = json.loads(self.cleanText(rsp.text)) - videos = [] - for vod in vodList: - videos.append({ - "vod_id": 'https://www.aliyundrive.com/s/'+vod["key"], - "vod_name": vod["title"], - "vod_pic": "https://txc.gtimg.com/data/375895/2022/0214/d6b96cc3799b6417d30e4715d2973f64.png", - "vod_remarks": vod['cat'] - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - category = ['hydm','hyds','hydy','omdm','omds','omdy','rhdm','rhds','rhdy','qtds','qtdy','qtsp','jlp','zyp'] - def detailContent(self,array): - return self.ali.detailContent(array) - def searchContent(self,key,quick): - result = {} - url = self.baseUrl+'/tool/alipaper/' - form = { - "action": "search", - "keyword": key - } - vodList = requests.post(url,headers=self.header,data=form).json() - videos = [] - for vod in vodList: - videos.append({ - "vod_id": 'https://www.aliyundrive.com/s/'+vod["key"], - "vod_name": vod["title"], - "vod_pic": "https://txc.gtimg.com/data/375895/2022/0214/d6b96cc3799b6417d30e4715d2973f64.png", - "vod_remarks": vod['cat'] - }) - result = { - 'list':videos - } - return result - def playerContent(self,flag,id,vipFlags): - return self.ali.playerContent(flag,id,vipFlags) - - homeData = {} - baseUrl = 'https://gitcafe.net' - config = { - "player": {}, - "filter": {} - } - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36", - "Referer": "https://u.gitcafe.net/" - } - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_huya.py b/TVBox_PY/py_huya.py deleted file mode 100644 index 0f126e5..0000000 --- a/TVBox_PY/py_huya.py +++ /dev/null @@ -1,140 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json - -class Spider(Spider): - def getName(self): - return "虎牙" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - 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): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'http://live.yj1211.work/api/live/getRecommendByPlatformArea?platform=huya&size=20&area={0}&page={1}'.format(tid, pg) - rsp = self.fetch(url) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data'] - for vod in vodList: - aid = (vod['roomId']).strip() - title = vod['roomName'].strip() - img = vod['roomPic'].strip() - remark = (vod['ownerName']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - def detailContent(self,array): - aid = array[0] - url = "http://live.yj1211.work/api/live/getRoomInfo?platform=huya&roomId={0}".format(aid) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - jo = jRoot['data'] - title = jo['roomName'] - pic = jo['roomPic'] - desc = str(jo['online']) - dire = jo['ownerName'] - typeName = jo['categoryName'] - remark = jo['categoryName'] - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "", - "vod_remarks": remark, - "vod_actor": '在线人数:' + desc, - "vod_director": dire, - "vod_content": "" - } - playUrl = '原画' + '${0}#'.format(aid) - vod['vod_play_from'] = '虎牙直播' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - def searchContent(self,key,quick): - result = {} - return result - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'https://mp.huya.com/cache.php?m=Live&do=profileRoom&roomid={0}'.format(id) - rsp = self.fetch(url) - jRoot = json.loads(rsp.text) - if jRoot['data']['liveStatus'] != 'ON': - return {} - jo = jRoot['data'] - ja = jo['stream']['baseSteamInfoList'][0]['sStreamName'] - url = 'http://txtest-xp2p.p2p.huya.com/src/' + ja + '.xs?ratio=4000' - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - 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" - } - result["contentType"] = 'video/x-flv' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - config = { - "player": {}, - "filter": {} - } - header = {} - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_if101.py b/TVBox_PY/py_if101.py deleted file mode 100644 index c124a6e..0000000 --- a/TVBox_PY/py_if101.py +++ /dev/null @@ -1,86 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import urllib.parse - -class Spider(Spider): - def getName(self): - return "IF101影视" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - - classes = [{"type_id":20,"type_name":"电影"},{"type_id":21,"type_name":"电视剧"},{"type_id":22,"type_name":"动漫"},{"type_id":23,"type_name":"综艺"},{"type_id":24,"type_name":"体育"},{"type_id":25,"type_name":"纪录片"},{"type_id":26,"type_name":"明星资讯"},{"type_id":28,"type_name":"冒险片"},{"type_id":29,"type_name":"剧情片"},{"type_id":30,"type_name":"动作片"},{"type_id":31,"type_name":"动画电影"},{"type_id":32,"type_name":"同性片"},{"type_id":33,"type_name":"喜剧片"},{"type_id":34,"type_name":"奇幻片"},{"type_id":35,"type_name":"恐怖片"},{"type_id":36,"type_name":"悬疑片"},{"type_id":37,"type_name":"惊悚片"},{"type_id":38,"type_name":"歌舞片"},{"type_id":39,"type_name":"灾难片"},{"type_id":40,"type_name":"爱情片"},{"type_id":41,"type_name":"犯罪片"},{"type_id":42,"type_name":"科幻片"},{"type_id":43,"type_name":"经典片"},{"type_id":44,"type_name":"网络电影"},{"type_id":117,"type_name":"战争片"},{"type_id":119,"type_name":"欧美剧"},{"type_id":120,"type_name":"日剧"},{"type_id":121,"type_name":"韩剧"},{"type_id":122,"type_name":"国产剧"},{"type_id":123,"type_name":"泰剧"},{"type_id":124,"type_name":"港剧"},{"type_id":125,"type_name":"台剧"},{"type_id":126,"type_name":"新马剧"},{"type_id":127,"type_name":"其他剧"},{"type_id":128,"type_name":"欧美综艺"},{"type_id":129,"type_name":"日本综艺"},{"type_id":130,"type_name":"韩国综艺"},{"type_id":131,"type_name":"国产综艺"},{"type_id":132,"type_name":"新马泰综艺"},{"type_id":133,"type_name":"港台综艺"},{"type_id":134,"type_name":"其他综艺"},{"type_id":135,"type_name":"欧美动漫"},{"type_id":136,"type_name":"日本动漫"},{"type_id":137,"type_name":"韩国动漫"},{"type_id":138,"type_name":"国产动漫"},{"type_id":139,"type_name":"新马泰动漫"},{"type_id":140,"type_name":"港台动漫"},{"type_id":142,"type_name":"其他动漫"}] - - result['class'] = classes - return result - def homeVideoContent(self): - rsp = self.fetch("https://api.8a5.cn/parse/if101/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 = 'https://api.8a5.cn/parse/if101/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 = 'https://api.8a5.cn/parse/if101/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 = 'https://api.8a5.cn/parse/if101/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 = {} - id = 'https://api.8a5.cn/parse/if101/get.php?url=' + urllib.parse.quote(id) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = id - return result - - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] diff --git a/TVBox_PY/py_ikan.py b/TVBox_PY/py_ikan.py deleted file mode 100644 index c9adeed..0000000 --- a/TVBox_PY/py_ikan.py +++ /dev/null @@ -1,206 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import base64 -import math -import json -import requests - -class Spider(Spider): - def getName(self): - return "爱看影视" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "电影": "1", - "剧集": "2", - "综艺": "3", - "动漫": "4", - "美剧": "16", - "日韩剧": "15", - } - 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 = {} - return result - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://ikan6.vip/vodtype/{0}-{1}/'.format(tid,pg) - rsp = self.fetch(url) - html = self.html(rsp.text) - aList = html.xpath("//ul[contains(@class, 'myui-vodlist')]/li") - videos = [] - numvL = len(aList) - pgc = math.ceil(numvL/15) - for a in aList: - aid = a.xpath("./div[contains(@class, 'myui-vodlist__box')]/a/@href")[0] - aid = self.regStr(reg=r'/voddetail/(.*?)/', src=aid) - img = a.xpath(".//div[contains(@class, 'myui-vodlist__box')]/a/@data-original")[0] - name = a.xpath(".//div[contains(@class, 'myui-vodlist__box')]/a/@title")[0] - remark = a.xpath(".//span[contains(@class, 'pic-text text-right')]/text()")[0] - videos.append({ - "vod_id": aid, - "vod_name": name, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = pgc - result['limit'] = numvL - result['total'] = numvL - return result - - def detailContent(self,array): - aid = array[0] - url = 'https://ikan6.vip/voddetail/{0}/'.format(aid) - rsp = self.fetch(url) - html = self.html(rsp.text) - node = html.xpath("//div[@class='myui-content__detail']")[0] - title = node.xpath("./h1/text()")[0] - pic = html.xpath("//a[@class='myui-vodlist__thumb picture']/img/@src")[0] - cont = html.xpath("//div[@class='col-pd text-collapse content']/span[@class='data']/p/text()")[0].replace('\u3000','') - infoList = node.xpath("./p[@class='data']") - for info in infoList: - content = info.xpath('string(.)').replace('\t','').replace('\r','').replace('\n','').strip() - if content.startswith('导演:'): - dir = content.replace('导演:','').strip() - if content.startswith('主演:'): - act = content.replace('主演:','').replace('\xa0','/').strip() - if content.startswith('分类:'): - infos = content.split(':') - for i in range(0, len(infos)): - if infos[i] == '分类': - typeName = infos[i + 1][:-2] - if infos[i][-2:] == '地区': - area = infos[i + 1][:-2] - if infos[i][-2:] == '年份': - year = infos[i + 1] - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": year, - "vod_area": area, - "vod_remarks": '', - "vod_actor": act, - "vod_director": dir, - "vod_content": cont - } - urlList = html.xpath("//div[@class='tab-content myui-panel_bd']/div/ul/li") - playUrl = '' - for url in urlList: - purl = url.xpath("./a/@href")[0] - purl = self.regStr(reg=r'/vodplay/(.*?)/', src=purl) - name = url.xpath("./a/text()")[0] - playUrl = playUrl + '{0}${1}#'.format(name, purl) - vod['vod_play_from'] = '爱看影视' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def verifyCode(self): - retry = 10 - 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"} - while retry: - try: - session = requests.session() - img = session.get('https://ikan6.vip/index.php/verify/index.html?', headers=header).content - code = session.post('https://api.nn.ci/ocr/b64/text', data=base64.b64encode(img).decode()).text - res = session.post(url=f"https://ikan6.vip/index.php/ajax/verify_check?type=search&verify={code}", - headers=header).json() - if res["msg"] == "ok": - return session - except Exception as e: - print(e) - finally: - retry = retry - 1 - - def searchContent(self,key,quick): - result = {} - url = 'https://ikan6.vip/vodsearch/-------------/?wd={0}&submit='.format(key) - session = self.verifyCode() - rsp = session.get(url) - root = self.html(rsp.text) - vodList = root.xpath("//ul[@class='myui-vodlist__media clearfix']/li") - videos = [] - for vod in vodList: - name = vod.xpath("./div/h4/a/text()")[0] - pic = vod.xpath("./div[@class='thumb']/a/@data-original")[0] - mark = vod.xpath("./div[@class='thumb']/a/span[@class='pic-text text-right']/text()")[0] - sid = vod.xpath("./div[@class='thumb']/a/@href")[0] - sid = self.regStr(sid,"/voddetail/(\\S+)/") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list': videos - } - - return result - - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'https://ikan6.vip/vodplay/{0}/'.format(id) - rsp = self.fetch(url) - info = json.loads(self.regStr(reg=r'var player_data=(.*?)', src=rsp.text)) - if info['encrypt'] == 1: - str = info['url'].replace('%u', '\\u').encode('utf-8').decode('unicode_escape') - elif info['encrypt'] == 2: - str = base64.b64decode(info['url'].replace('%u', '\\u').encode('utf-8').decode('unicode_escape')).decode( - 'UTF-8') - elif info['encrypt'] == 3: - string = info['url'][8:len(info['url'])] - substr = base64.b64decode(string).decode('UTF-8') - str = substr[8:len(substr) - 8].split('_')[-1] - purl = 'https://weiyunsha.ikan6.vip/tsjmjson/play.php?sign={0}'.format(str) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = purl - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_jrskbs.py b/TVBox_PY/py_jrskbs.py deleted file mode 100644 index c11dd72..0000000 --- a/TVBox_PY/py_jrskbs.py +++ /dev/null @@ -1,158 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import re -import math - -class Spider(Spider): - def getName(self): - return "企鹅体育" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - 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): - result = {} - return result - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://m.jrskbs.com' - rsp = self.fetch(url) - html = self.html(rsp.text) - aList = html.xpath("//div[contains(@class, 'contentList')]/a") - videos = [] - numvL = len(aList) - pgc = math.ceil(numvL/15) - for a in aList: - aid = a.xpath("./@href")[0] - aid = self.regStr(reg=r'/live/(.*?).html', src=aid) - img = a.xpath(".//div[@class='contentLeft']/p/img/@src")[0] - home = a.xpath(".//div[@class='contentLeft']/p[@class='false false']/text()")[0] - away = a.xpath(".//div[@class='contentRight']/p[@class='false false']/text()")[0] - infoArray = a.xpath(".//div[@class='contentCenter']/p") - remark = '' - for info in infoArray: - content = info.xpath('string(.)').replace(' ','') - remark = remark + '|' + content - videos.append({ - "vod_id": aid, - "vod_name": home + 'vs' + away, - "vod_pic": img, - "vod_remarks": remark.strip('|') - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = pgc - result['limit'] = numvL - result['total'] = numvL - return result - - def detailContent(self,array): - aid = array[0] - url = "http://m.jrskbs.com/live/{0}.html".format(aid) - rsp = self.fetch(url) - root = self.html(rsp.text) - divContent = root.xpath("//div[@class='today']")[0] - home = divContent.xpath(".//p[@class='onePlayer homeTeam']/text()")[0] - away = divContent.xpath(".//div[3]/text()")[0].strip() - title = home + 'vs' + away - pic = divContent.xpath(".//img[@class='gameLogo1 homeTeam_img']/@src")[0] - typeName = divContent.xpath(".//div/p[@class='name1 matchTime_wap']/text()")[0] - remark = divContent.xpath(".//div/p[@class='time1 matchTitle']/text()")[0].replace(' ','') - url = divContent.xpath("//div[@class='liveCotainer']/iframe[@id='pp']/@src")[0] - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "", - "vod_remarks": remark, - "vod_actor": '', - "vod_director":'', - "vod_content": '' - } - playUrl = '{0}${1}#'.format(title, url) - vod['vod_play_from'] = '体育直播' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self,key,quick): - result = {} - return result - - def playerContent(self,flag,id,vipFlags): - result = {} - url = id - rsp = self.fetch(url) - html = rsp.text - strList = re.findall(r"eval\((.*?)\);", html) - fuctList = strList[1].split('+') - scrpit = '' - for fuc in fuctList: - if fuc.endswith(')'): - append = fuc.split(')')[-1] - else: - append = '' - Unicode = int(self.regStr(reg=r'l\((.*?)\)', src=fuc)) - char = chr(Unicode%256) - char = char + append - scrpit = scrpit + char - par= self.regStr(reg=r'/(.*)/', src=scrpit).replace(')','') - pars= par.split('/') - infoList = strList[2].split('+') - str = '' - for info in infoList: - if info.startswith('O'): - Unicode = int(int(self.regStr(reg=r'O\((.*?)\)', src=info))/int(pars[0])/int(pars[1])) - char = chr(Unicode % 256) - str = str +char - url = self.regStr(reg=r"play_url=\'(.*?)\'", src=str) - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_jumi.py b/TVBox_PY/py_jumi.py deleted file mode 100644 index 669fced..0000000 --- a/TVBox_PY/py_jumi.py +++ /dev/null @@ -1,216 +0,0 @@ -#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 isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - # https://gimytv.co/ - result = {} - cateManual = { - "电影": "movies", - "电视剧": "tvseries", - "综艺": "tv_show", - "动漫": "anime" - } - 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("https://gimytv.co/",headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='myui-vodlist clearfix']/li/div/a") - videos = [] - for a in aList: - name = a.xpath("./@title")[0] - pic = a.xpath("./@data-original")[0] - mark = a.xpath("./span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - urlParams = ["", "", "", ""] - urlParams[0] = tid - urlParams[3] = pg - suffix = '' - for key in extend: - if key == 4: - suffix = '/by/'+extend[key] - else: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams)+suffix - # https://gimytv.co/genre/tvseries--2022-/by/hits_month.html - url = 'https://gimytv.com/genre/{0}.html'.format(params) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='myui-vodlist clearfix']/li/div/a") - videos = [] - for a in aList: - name = a.xpath("./@title")[0] - pic = a.xpath("./@data-original")[0] - mark = a.xpath("./span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - 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 = 'https://gimytv.co/{0}.html'.format(tid) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - node = root.xpath("//div[@class='container']")[0] - title = node.xpath(".//div[@class='myui-content__thumb']/a/@title")[0] - pic = node.xpath(".//div[@class='myui-content__thumb']/a/img/@data-original")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - infoArray = node.xpath(".//div[@class='myui-content__detail']/p") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('分類'): - vod['type_name'] = content - # if content.startswith('年份'): - # vod['vod_year'] = content - # if content.startswith('地区'): - # vod['vod_area'] = content - if content.startswith('狀態'): - vod['vod_remarks'] = content - if content.startswith('主演'): - vod['vod_actor'] = content - if content.startswith('導演'): - vod['vod_director'] = content - # if content.startswith('剧情'): - # vod['vod_content'] = content - vod['vod_content'] = node.xpath(".//div[contains(@class,'col-pd')]/p/text()")[0] - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath(".//div[@class='myui-panel_hd']/div/h3/text()[2]") - for v in vodHeader: - playFrom.append(v.strip()) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath(".//ul[contains(@class,'myui-content__list')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./li/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href,'/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = "https://gimytv.co/search/-------------.html?wd={0}".format(key) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - aList = root.xpath("//ul[contains(@class,'myui-vodlist__media')]/li") - videos = [] - for a in aList: - name = a.xpath(".//a/@title")[0] - pic = a.xpath(".//a/@data-original")[0] - mark = a.xpath(".//span[contains(@class, 'pic-text')]/text()")[0] - sid = a.xpath(".//a/@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def playerContent(self,flag,id,vipFlags): - url = 'https://gimytv.co/{0}.html'.format(id) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - url = jo['url'] - result = {} - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - cookie = {} - config = { - "player": {}, - "filter": {"movies":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"劇情片","v":"drama"},{"n":"動作片","v":"action"},{"n":"科幻片","v":"scifi"},{"n":"喜劇片","v":"comedymovie"},{"n":"愛情片","v":"romance"},{"n":"戰爭片","v":"war"},{"n":"恐怖片","v":"horror"},{"n":"動畫電影","v":"animation"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"大陸","v":"大陸"},{"n":"中國大陸","v":"中國大陸"},{"n":"韓國","v":"韓國"},{"n":"香港","v":"香港"},{"n":"日本","v":"日本"},{"n":"英國","v":"英國"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"tvseries":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"陸劇","v":"cn"},{"n":"韓劇","v":"kr"},{"n":"美劇","v":"us"},{"n":"日劇","v":"jp"},{"n":"台劇","v":"tw"},{"n":"港劇","v":"hks"},{"n":"海外劇","v":"ot"},{"n":"紀錄片","v":"documentary"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"anime":[{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"日本","v":"日本"},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"大陸","v":"大陸"},{"n":"臺灣","v":"臺灣"},{"n":"香港","v":"香港"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}],"tv_show":[{"key":0,"name":"分类","value":[{"n":"全部","v":""},{"n":"纪录片","v":"28"}]},{"key":1,"name":"地区","value":[{"n":"全部","v":""},{"n":"大陸","v":"大陸"},{"n":"中國大陸","v":"中國大陸"},{"n":"韓國","v":"韓國"},{"n":"臺灣","v":"臺灣"},{"n":"美國","v":"美國"},{"n":"歐美","v":"歐美"},{"n":"日本","v":"日本"},{"n":"香港","v":"香港"}]},{"key":2,"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"}]},{"key":4,"name":"排序","value":[{"n":"按更新","v":"time"},{"n":"周人气","v":"hits_week"},{"n":"月人气","v":"hits_month"}]}]} - } - header = { - 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.47' - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_kunyu77.py b/TVBox_PY/py_kunyu77.py deleted file mode 100644 index b4c15fa..0000000 --- a/TVBox_PY/py_kunyu77.py +++ /dev/null @@ -1,175 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json - -class Spider(Spider): - def getName(self): - return "77" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def homeContent(self,filter): - result = {} - url = 'http://api.kunyu77.com/api.php/provide/filter' - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - classes = [] - jData = jo['data'] - for cKey in jData.keys(): - classes.append({ - 'type_name':jData[cKey][0]['cat'], - 'type_id':cKey - }) - result['class'] = classes - if(filter): - result['filters'] = self.config['filter'] - return result - def homeVideoContent(self): - url = 'http://api.kunyu77.com/api.php/provide/homeBlock?type_id=0' - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - blockList = jo['data']['blocks'] - videos = [] - for block in blockList: - vodList = block['contents'] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - if 'type_id' not in extend.keys(): - extend['type_id'] = tid - extend['pagenum'] = pg - filterParams = ["type_id", "pagenum"] - params = ["", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = '&'+filterParams[idx]+'='+extend[fp] - suffix = ''.join(params) - url = 'http://api.kunyu77.com/api.php/provide/searchFilter?pagesize=24{0}'.format(suffix) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data']['result'] - videos = [] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - 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://api.kunyu77.com/api.php/provide/videoDetail?devid=453CA5D864457C7DB4D0EAA93DE96E66&package=com.sevenVideo.app.android&version=1.8.7&ids={0}'.format(tid) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - node = jo['data'] - vod = { - "vod_id":node['id'], - "vod_name":node['videoName'], - "vod_pic":node['videoCover'], - "type_name":node['subCategory'], - "vod_year":node['year'], - "vod_area":node['area'], - "vod_remarks":node['msg'], - "vod_actor":node['actor'], - "vod_director":node['director'], - "vod_content":node['brief'].strip() - } - listUrl = 'http://api.kunyu77.com/api.php/provide/videoPlaylist?devid=453CA5D864457C7DB4D0EAA93DE96E66&package=com.sevenVideo.app.android&version=1.8.7&ids={0}'.format(tid) - listRsp = self.fetch(listUrl,headers=self.header) - listJo = json.loads(listRsp.text) - playMap = {} - episodes = listJo['data']['episodes'] - for ep in episodes: - playurls = ep['playurls'] - for playurl in playurls: - source = playurl['playfrom'] - if source not in playMap.keys(): - playMap[source] = [] - playMap[source].append(playurl['title'].strip() + '$' + playurl['playurl']) - - playFrom = [] - playList = [] - for key in playMap.keys(): - playFrom.append(key) - playList.append('#'.join(playMap[key])) - - vod_play_from = '$$$' - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - vod_play_url = vod_play_url.join(playList) - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - - def searchContent(self,key,quick): - url = 'http://api.kunyu77.com/api.php/provide/searchVideo?searchName={0}'.format(key) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data'] - videos = [] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['videoName'], - "vod_pic":vod['videoCover'], - "vod_remarks":vod['msg'] - }) - result = { - 'list':videos - } - return result - - config = { - "player": {}, - "filter": {} - } - header = { - "User-Agent":"Dalvik/2.1.0" - } - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'http://api.kunyu77.com/api.php/provide/parserUrl?url={0}'.format(id) - jo = self.fetch(url,headers=self.header).json() - result = { - 'parse':0, - 'jx':0, - 'playUrl':'', - 'url':id, - 'header':'' - } - if flag in vipFlags: - result['parse'] = 1 - result['jx'] = 1 - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_lezhutv.py b/TVBox_PY/py_lezhutv.py deleted file mode 100644 index c30e0ec..0000000 --- a/TVBox_PY/py_lezhutv.py +++ /dev/null @@ -1,238 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import base64 -import hashlib - - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "LeZhuTV" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "电影": "1", - "连续剧": "2", - "动漫": "4", - "综艺": "3", - "韩剧": "14", - "美剧": "15" - } - 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://www.lezhutv.com") - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='tbox_m2']/li") - videos = [] - for a in aList: - name = a.xpath('.//@title')[0] - pic = a.xpath('.//@data-original')[0] - mark = a.xpath(".//span/text()")[0] - sid = a.xpath(".//@href")[0] - sid = self.regStr(sid, "/detail/(\\d+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - - ext = extend.get("by","") - url = 'http://www.lezhutv.com/list/{0}_{1}_desc_{2}_0_0___.html'.format(tid,pg,ext) - rsp = self.fetch(url) - root = self.html(rsp.text) - aList = root.xpath("//ul[@class='tbox_m2']/li") - videos = [] - for a in aList: - name = a.xpath('.//@title')[0] - pic = a.xpath('.//@data-original')[0] - mark = a.xpath(".//span/text()")[0] - sid = a.xpath(".//@href")[0] - sid = self.regStr(sid, "/detail/(\\d+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - 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://www.lezhutv.com/detail/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(rsp.text) - node = root.xpath(".//div[@class='dbox']")[0] - nodes = root.xpath(".//div[@class='tbox2']")[0] - pic = node.xpath(".//div/@data-original")[0] - title = node.xpath('.//h4/text()')[0] - detail = nodes.xpath(".//div[@class='tbox_js']/text()")[0] - yac = node.xpath(".//p[@class='yac']/text()")[0] - yac = yac.split('/') - yacs = yac[0].strip() - type_name = yac[1].strip() - actor = node.xpath(".//p[@class='act']/text()")[0] - director = node.xpath(".//p[@class='dir']/text()")[0] - - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": type_name, - "vod_year": yacs, - "vod_area": "", - "vod_remarks": "", - "vod_actor": actor, - "vod_director": director, - "vod_content": detail - } - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath(".//div[@class='tbox2 tabs']/div/h3/text()") - i=1 - for v in vodHeader: - playFrom.append("线路" + str(i)) - i = i+1 - vod_play_from = vod_play_from.join(playFrom) - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='tbox2 tabs']") - - for vl in vodList: - vodItems = [] - aList = vl.xpath(".//ul/li/a") - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href, '/play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'http://www.lezhutv.com/search-pg-1-wd-{0}.html'.format(key) - rsp = self.fetch(url) - root = self.html(rsp.text) - seaArray = root.xpath("//ul[@class='tbox_m']/li") - seaList = [] - for vod in seaArray: - name = vod.xpath('.//@title')[0] - pic = vod.xpath('.//@data-original')[0] - mark = vod.xpath(".//span/text()")[0] - sid = vod.xpath(".//@href")[0] - sid = self.regStr(sid, "/detail/(\\d+).html") - seaList.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': seaList - } - return result - - config = { - "player":{}, - "filter":{"1":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}],"2":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}],"3":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}],"4":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}],"14":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}],"15":[{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"score"},{"n":"评分","v":"hits"}]}]} - } - header = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36" - } - - def get_md5(self,value): - b64 = base64.b64encode((base64.b64encode(value.encode()).decode() + "NTY2").encode()).decode() - md5 = hashlib.md5(b64.encode()).hexdigest() - return "".join(char if char.isdigit() else "zyxwvutsrqponmlkjihgfedcba"["abcdefghijklmnopqrstuvwxyz".find(char)] for char in md5) - - def playerContent(self, flag, id, vipFlags): - result = {} - url = 'http://www.lezhutv.com/play/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - scripts = scripts[1].replace('\n', '') - nid = self.regStr(scripts, 'view_path = \'(.*?)\';') - - md5url = 'http://www.lezhutv.com/hls2/index.php?url={0}'.format(nid) - rsp = self.fetch(md5url) - root = self.html(rsp.text) - value = root.xpath(".//input[@id='hdMd5']/@value") - value = ''.join(value) - md5s = self.get_md5(str(value)) - data = { - "id": nid, - "type": "vid", - "siteuser": "", - "md5": md5s, - "referer": url, - "hd": "", - "lg": "" - } - payUrl = 'http://www.lezhutv.com/hls2/url.php' - parseRsp = self.post(payUrl,data,headers=self.header) - parseRsps = json.loads(parseRsp.text) - realUrl = parseRsps['media']['url'] - if len(realUrl) > 0: - result["parse"] = 0 - result["playUrl"] = "" - result["url"] = realUrl - result["header"] = "" - else: - result["parse"] = 1 - result["playUrl"] = "" - result["url"] = url - result["header"] = json.dumps(self.header) - return result - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_libvio.py b/TVBox_PY/py_libvio.py deleted file mode 100644 index 77b5f78..0000000 --- a/TVBox_PY/py_libvio.py +++ /dev/null @@ -1,234 +0,0 @@ -# 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 "Libvio" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "电影": "1", - "剧集": "2", - "动漫": "4", - "即将上线": "27", - "日韩剧": "15", - "欧美剧": "16" - } - 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("https://www.libvio.me") - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='stui-pannel__bd']/ul/li/div/a") - - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./span[2]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid, "/detail/(\\d+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - result = { - 'list': videos - } - return result - - def categoryContent(self, tid, pg, filter, extend): - result = {} - - urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] - urlParams[0] = tid - urlParams[8] = pg - for key in extend: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams) - url = 'https://www.libvio.me/show/{0}.html'.format(params) - print(url) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//div[@class='stui-pannel__bd clearfix']/ul/li/div/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./span[2]/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid, "/detail/(\\d+).html") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - - 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 = 'https://www.libvio.me/detail/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - node = root.xpath("//div[@class='stui-pannel__bd']")[0] - pic = node.xpath(".//img/@data-original")[0] - title = node.xpath('.//h1/text()')[0] - detail = node.xpath(".//span[@class='detail-content']/text()")[0] - douban = node.xpath(".//span[@class='douban']/text()")[0] - - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_douban_score": format(douban.rstrip("分")), - "vod_content": detail - } - - infoArray = node.xpath(".//div[@class='stui-content__detail']/p") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('类型'): - vod['type_name'] = content - if content.startswith('主演'): - vod['vod_actor'] = content.replace('\n', '').replace('\t', '') - if content.startswith('导演'): - vod['vod_director'] = content.replace('\n', '').replace('\t', '') - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath("//div[@class='stui-pannel__head clearfix']/h3/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//div[@class='stui-vodlist__head']") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./ul/li/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href, '/play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - url = 'https://www.libvio.me/index.php/ajax/suggest?mid=1&wd={0}'.format(key) - # getHeader() - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - result = {} - jArray = [] - if jo['total'] > 0: - for j in jo['list']: - jArray.append({ - "vod_id": j['id'], - "vod_name": j['name'], - "vod_pic": j['pic'], - "vod_remarks": "" - }) - result = { - 'list': jArray - } - return result - - config = { - "player":{"LINE405":{"show":"LINE405","des":"更多极速线路请访问APP","ps":"0","parse":""},"duoduozy":{"show":"LINE100","des":"","ps":"0","parse":""},"LINE407":{"show":"LINE400","des":"","ps":"0","parse":""},"LINE408":{"show":"LINE408","des":"","ps":"0","parse":""},"p300":{"show":"LINE300","des":"","ps":"0","parse":""},"p301":{"show":"LINE301","des":"","ps":"0","parse":""},"line402-日语":{"show":"LINE402","des":"","ps":"0","parse":""},"LINE400":{"show":"LINE400","des":"","ps":"0","parse":""},"line401":{"show":"LINE401","des":"","ps":"0","parse":""},"iframe268":{"show":"LINE268","des":"","ps":"0","parse":""},"iframe290":{"show":"LINE290","des":"","ps":"0","parse":""},"iframe291":{"show":"LINE291","des":"","ps":"0","parse":""},"iframe296":{"show":"LINE296","des":"","ps":"0","parse":""},"iframe297":{"show":"LINE297","des":"","ps":"0","parse":""},"iframe307":{"show":"LINE307","des":"","ps":"0","parse":""},"iframe308":{"show":"LINE308","des":"","ps":"0","parse":""},"iframe309":{"show":"LINE309","des":"","ps":"0","parse":""},"line301":{"show":"LINE333","des":"","ps":"0","parse":""},"line302":{"show":"LINE302","des":"","ps":"0","parse":""},"LINE409":{"show":"LINE409","des":"","ps":"0","parse":""},"banquan":{"show":"已下架","des":"","ps":"0","parse":""},"iframe261":{"show":"LINE261","des":"","ps":"0","parse":""},"iframe265":{"show":"LINE265","des":"","ps":"0","parse":""},"iframe278":{"show":"LINE278","des":"","ps":"0","parse":""},"iframe306":{"show":"LINE306","des":"","ps":"0","parse":""},"iframe317":{"show":"LINE317","des":"","ps":"0","parse":""},"iframe257":{"show":"LINE257","des":"","ps":"0","parse":""},"iframe263":{"show":"LINE263","des":"","ps":"0","parse":""},"iframe258":{"show":"LINE258","des":"","ps":"0","parse":""},"iframe267":{"show":"LINE267","des":"","ps":"0","parse":""},"iframe":{"show":"LINE200","des":"","ps":"0","parse":""},"iframe262":{"show":"LINE262","des":"","ps":"0","parse":""},"iframe266":{"show":"LINE266","des":"","ps":"0","parse":""},"LINE406":{"show":"LINE406","des":"","ps":"0","parse":""},"dplayer3":{"show":"播放线路3","des":"","ps":"0","parse":""}}, - "filter":{"1":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"2":[{"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":"其他"}]},{"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"}]}],"3":[{"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":"求职"}]},{"key":"area","name":"地区","value":[{"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"}]}],"4":[{"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":"其他"}]},{"key":"area","name":"地区","value":[{"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"}]}],"6":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"7":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"8":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"9":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"10":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"11":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"12":[{"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":"网络电影"}]},{"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":"泰国"},{"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"}]}],"13":[{"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":"其他"}]},{"key":"area","name":"地区","value":[{"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"}]}],"14":[{"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":"网络电影"}]},{"key":"area","name":"地区","value":[{"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"}]}],"15":[{"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":"其他"}]},{"key":"area","name":"地区","value":[{"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"}]}],"16":[{"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":"网络电影"}]},{"key":"area","name":"地区","value":[{"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"}]}]} - } - header = { - "Referer": "https://www.libvio.me", - "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" - } - - def playerContent(self, flag, id, vipFlags): - result = {} - url = 'https://www.libvio.me/play/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if (script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - nid = str(jo['nid']) - scriptUrl = 'https://www.libvio.me/static/player/{0}.js'.format(jo['from']) - scriptRsp = self.fetch(scriptUrl) - parseUrl = self.regStr(scriptRsp.text, 'src="(\\S+url=)') - if len(parseUrl) > 0: - path = jo['url'] + '&next=' + jo['link_next'] + '&id=' + jo['id'] + '&nid=' + nid - parseRsp = self.fetch(parseUrl + path,headers=self.header) - realUrl = self.regStr(parseRsp.text, "(?<=urls\\s=\\s').*?(?=')", 0) - if len(realUrl) > 0: - result["parse"] = 0 - result["playUrl"] = "" - result["url"] = realUrl - result["header"] = "" - else: - result["parse"] = 1 - result["playUrl"] = "" - result["url"] = jo['url'] - result["header"] = json.dumps(self.header) - return result - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_mac.py b/TVBox_PY/py_mac.py deleted file mode 100644 index aeadbff..0000000 --- a/TVBox_PY/py_mac.py +++ /dev/null @@ -1,82 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import requests - -class Spider(Spider): - def getDependence(self): - return ['py_ali'] - def getName(self): - return "py_mac" - def init(self,extend): - self.ali = extend[0] - print("============py_mac============") - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36", - "Referer": "http://ali.546326.xyz" - } - def detailContent(self,array): - tid = array[0] - #print(tid) - #print(self.getName()) - url="http://ali.546326.xyz/api.php/provide/vod/?ac=detail&ids={0}".format(tid) - vods=requests.get(url=url, headers=self.header, verify=False).json()["list"][0] - playurl = vods['vod_play_url'] - playArray = playurl.split("#") - newArray =[] - for vod in playArray: - if vod: - vds = vod.split("$") - playurl = vds[1].replace(" ","") - pattern = '(https://www.aliyundrive.com/s/[^\"]+)' - url = self.regStr(playurl, pattern) - if len(url) > 0: - newArray.append(playurl) - if len(newArray) == 0: - return "" - #print(newArray) - return self.ali.detailContent(newArray) - - def searchContent(self,key,quick): - url = "http://ali.546326.xyz/api.php/provide/vod/?wd={0}".format(key) - vodList = requests.get(url=url, headers=self.header, verify=False).json()["list"] - videos = [] - for vod in vodList: - videos.append({ - "vod_id": vod["vod_id"], - "vod_name": vod["vod_name"], - "vod_pic": "https://img0.baidu.com/it/u=603086994,1727626977&fm=253&fmt=auto?w=500&h=667",#字段不存在 - "vod_remarks": vod["vod_remarks"] - }) - result = { - 'list':videos - } - return result - - def playerContent(self,flag,id,vipFlags): - return self.ali.playerContent(flag,id,vipFlags) - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_pansou.py b/TVBox_PY/py_pansou.py deleted file mode 100644 index 54fab0f..0000000 --- a/TVBox_PY/py_pansou.py +++ /dev/null @@ -1,92 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider - -class Spider(Spider): - def getDependence(self): - return ['py_ali'] - def getName(self): - return "py_pansou" - def init(self,extend): - self.ali = extend[0] - print("============py_pansou============") - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - - def detailContent(self,array): - tid = array[0] - print(self.getName()) - pattern = '(https:\\/\\/www.aliyundrive.com\\/s\\/[^\\\"]+)' - url = self.regStr(tid,pattern) - if len(url) > 0: - return self.ali.detailContent(array) - - rsp = self.fetch('https://www.alipansou.com'+tid) - url = self.regStr(rsp.text,pattern) - if len(url) == 0: - return "" - url = url.replace('\\','') - newArray = [url] - print(newArray) - return self.ali.detailContent(newArray) - - - def searchContent(self,key,quick): - map = { - '7':'文件夹', - '1':'视频' - } - ja = [] - for tKey in map.keys(): - url = "https://www.alipansou.com/search?k={0}&t={1}".format(key,tKey) - rsp = self.fetch(url) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//van-row/a") - for a in aList: - title = '' - # title = a.xpath('string(.//template/div)') - # title = self.cleanText(title).strip() - - divList = a.xpath('.//template/div') - for div in divList: - t = div.xpath('string(.)') - t = self.cleanText(t).strip() - title = title + t - if key in title: - pic = 'https://www.alipansou.com'+ self.xpText(a,'.//van-card/@thumb') - jo = { - 'vod_id': a.xpath('@href')[0], - 'vod_name': '[{0}]{1}'.format(key,title), - 'vod_pic': pic - } - ja.append(jo) - result = { - 'list':ja - } - return result - - def playerContent(self,flag,id,vipFlags): - return self.ali.playerContent(flag,id,vipFlags) - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_qie.py b/TVBox_PY/py_qie.py deleted file mode 100644 index fb847cc..0000000 --- a/TVBox_PY/py_qie.py +++ /dev/null @@ -1,137 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import math - -class Spider(Spider): - def getName(self): - return "企鹅体育" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "全部": "", - "足球": "Football", - "篮球": "Basketball", - "NBA": "NBA", - "台球": "Billiards", - "搏击": "Fight", - "网排": "Tennis", - "游戏": "Game", - "其他": "Others", - "橄棒冰": "MLB" - } - 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 = {} - return result - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://live.qq.com/api/live/vlist?page_size=60&shortName={0}&page={1}'.format(tid, pg) - rsp = self.fetch(url) - content = rsp.text - jo = json.loads(content) - videos = [] - vodList = jo['data']['result'] - numvL = len(vodList) - pgc = math.ceil(numvL/15) - for vod in vodList: - aid = (vod['room_id']) - title = vod['room_name'].strip() - img = vod['room_src'] - remark = (vod['game_name']).strip() - videos.append({ - "vod_id": aid, - "vod_name": title, - "vod_pic": img, - "vod_remarks": remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = pgc - result['limit'] = numvL - result['total'] = numvL - return result - - def detailContent(self,array): - aid = array[0] - url = "https://m.live.qq.com/{0}".format(aid) - rsp = self.fetch(url) - html = self.cleanText(rsp.text) - if self.regStr(reg=r'\"show_status\":\"(\d)\"', src=html) == '1': - title = self.regStr(reg=r'\"room_name\":\"(.*?)\"', src=html) - pic = self.regStr(reg=r'\"room_src\":\"(.*?)\"', src=html) - typeName = self.regStr(reg=r'\"game_name\":\"(.*?)\"', src=html) - remark = self.regStr(reg=r'\"nickname\":\"(.*?)\"', src=html) - purl = self.regStr(reg=r'\"hls_url\":\"(.*?)\"', src=html) - else: - return {} - vod = { - "vod_id": aid, - "vod_name": title, - "vod_pic": pic, - "type_name": typeName, - "vod_year": "", - "vod_area": "", - "vod_remarks": remark, - "vod_actor": '', - "vod_director":'', - "vod_content": '' - } - playUrl = '{0}${1}#'.format(typeName, purl) - vod['vod_play_from'] = '企鹅体育' - vod['vod_play_url'] = playUrl - - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self,key,quick): - result = {} - return result - def playerContent(self,flag,id,vipFlags): - result = {} - url = id - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_voflix.py b/TVBox_PY/py_voflix.py deleted file mode 100644 index 1f60675..0000000 --- a/TVBox_PY/py_voflix.py +++ /dev/null @@ -1,228 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "Voflix" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - # https://meijuchong.cc/ - result = {} - cateManual = { - "电影": "1", - "剧集": "2", - "综艺": "3", - "动漫": "4" - } - 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("https://www.voflix.com/",headers=self.header) - root = self.html(rsp.text) - vodList = root.xpath("//div[@class='module']/div[contains(@class,'tab-list')]//a") - videos = [] - for vod in vodList: - name = vod.xpath("./@title")[0] - pic = vod.xpath(".//img/@data-original")[0] - mark = vod.xpath(".//div[@class='module-item-note']/text()")[0] - sid = vod.xpath("./@href")[0] - sid = self.regStr(sid,"/detail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - if 'id' not in extend.keys(): - extend['id'] = tid - extend['page'] = pg - filterParams = ["id", "area", "by", "class", "", "", "", "", "page", "", "", "year"] - params = ["", "", "", "", "", "", "", "", "", "", "", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = extend[fp] - suffix = '-'.join(params) - url = 'https://www.voflix.com/show/{0}.html'.format(suffix) - - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - vodList = root.xpath("//div[contains(@class, 'module-items')]/a") - videos = [] - for vod in vodList: - name = vod.xpath("./@title")[0] - pic = vod.xpath(".//img/@data-original")[0] - mark = vod.xpath(".//div[contains(@class,'module-item-note')]/text()")[0] - sid = vod.xpath("./@href")[0] - sid = self.regStr(sid,"/detail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - 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 = 'https://www.voflix.com/detail/{0}.html'.format(tid) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - node = root.xpath("//div[@class='main']")[0] - title = node.xpath(".//div[@class='module-info-heading']/h1/text()")[0] - pic = root.xpath(".//div[@class='module-item-pic']/img/@data-original")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - infoArray = node.xpath(".//div[@class='module-info-item']") - for info in infoArray: - content = info.xpath('string(.)') - # if content.startswith('分類'): - # vod['type_name'] = content - # if content.startswith('年份'): - # vod['vod_year'] = content - # if content.startswith('地区'): - # vod['vod_area'] = content - if content.startswith('片长'): - vod['vod_remarks'] = content.replace('\n','').replace('\t','') - if content.startswith('主演'): - vod['vod_actor'] = content.replace('\n','').replace('\t','') - if content.startswith('导演'): - vod['vod_director'] = content.replace('\n','').replace('\t','') - # if content.startswith('剧情'): - # vod['vod_content'] = content.replace('\n','').replace('\t','') - vod['vod_content'] = node.xpath(".//div[contains(@class,'module-info-introduction-content')]/p/text()")[0].replace('\n','').replace('\t','') - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath(".//div[contains(@class,'module-tab-items-box')]/div/span/text()") - for v in vodHeader: - playFrom.append(v.strip()) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath(".//div[contains(@class,'module-play-list-content')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('.//span/text()')[0] - tId = self.regStr(href,'/play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = "https://www.voflix.com/index.php/ajax/suggest?mid=1&wd={0}".format(key) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['list'] - videos = [] - for vod in vodList: - name = vod['name'] - pic = vod['pic'] - mark = '' - sid = vod['id'] - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def playerContent(self,flag,id,vipFlags): - # https://meijuchong.cc/static/js/playerconfig.js - result = {} - url = 'https://www.voflix.com/play/{0}.html'.format(id) - rsp = self.fetch(url,headers=self.header) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - - parseUrl = 'https://play.shtpin.com/xplay/?url={0}'.format(jo['url']) - parseRsp = self.fetch(parseUrl,headers={'referer':'https://www.voflix.com/'}) - - configStr = self.regStr(parseRsp.text,'var config = ({[\\s\\S]+})') - configJo = json.loads(configStr) - playUrl = 'https://play.shtpin.com/xplay/555tZ4pvzHE3BpiO838.php?tm={0}&url={1}&vkey={2}&token={3}&sign=F4penExTGogdt6U8' - playUrl.format(time.time(),configJo['url'],configJo['vkey'],configJo['token']) - playRsp = self.fetch(playUrl.format(time.time(),configJo['url'],configJo['vkey'],configJo['token']) - ,headers={'referer':'https://www.voflix.com/'}) - playJo = json.loads(playRsp.text) - b64 = playJo['url'][8:] - targetUrl = base64.b64decode(b64)[8:-8].decode() - - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = targetUrl - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {"1":[{"key":"id","name":"类型","value":[{"n":"全部","v":"1"},{"n":"动作","v":"6"},{"n":"喜剧","v":"7"},{"n":"爱情","v":"8"},{"n":"科幻","v":"9"},{"n":"恐怖","v":"10"},{"n":"剧情","v":"11"},{"n":"战争","v":"12"},{"n":"动画","v":"23"}]},{"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":"网络电影"}]},{"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":"泰国"},{"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"}]},{"key":"by","name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"2":[{"key":"id","name":"类型","value":[{"n":"全部","v":"2"},{"n":"国产剧","v":"13"},{"n":"港台剧","v":"14"},{"n":"日韩剧","v":"15"},{"n":"欧美剧","v":"16"},{"n":"纪 录片","v":"21"},{"n":"泰国剧","v":"24"}]},{"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":"其他"}]},{"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":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004","v":"2004"}]},{"key":"by","name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"3":[{"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":"求职"}]},{"key":"area","name":"地区","value":[{"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"}]},{"key":"by","name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"4":[{"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":"其他"}]},{"key":"area","name":"地区","value":[{"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"}]},{"key":"by","name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}]} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_wmkk.py b/TVBox_PY/py_wmkk.py deleted file mode 100644 index b01572c..0000000 --- a/TVBox_PY/py_wmkk.py +++ /dev/null @@ -1,176 +0,0 @@ -# coding=utf-8 -# !/usr/bin/python -import sys -import re -sys.path.append('..') -from base.spider import Spider - - - -class Spider(Spider): # 元类 默认的元类 type - def getName(self): - return "完美看看" - - def init(self, extend=""): - print("============{0}============".format(extend)) - pass - - def homeContent(self, filter): - result = {} - cateManual = { - "电影": "1", - "国产剧": "5", - "欧美剧": "2", - "韩剧": "3", - "泰剧": "9", - "日剧": "4", - "动漫": "6", - "综艺": "7", - "纪录片": "10" - } - 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 - - def categoryContent(self, tid, pg, filter, extend): - result = {} - url = 'https://www.wanmeikk.film/category/{0}-{1}.html'.format(tid, pg) - rsp = self.fetch(url) - root = self.html(rsp.text) - aList = root.xpath("//div[@class='stui-pannel_bd']/ul[1]/li") - videos = [] - for a in aList: - name = a.xpath('./div/a/@title')[0] - pic = a.xpath('./div/a/@data-original')[0] - mark = a.xpath("./div/a/span[@class='pic-text text-right']/text()")[0] - sid = a.xpath("./div/a/@href")[0].replace("/", "").replace("project", "").replace(".html", "") - videos.append({ - "vod_id": sid, - "vod_name": name, - "vod_pic": pic, - "vod_remarks": mark - }) - 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 = 'https://www.wanmeikk.film/project/{0}.html'.format(tid) - header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - rsp = self.fetch(url, headers=header) - root = self.html(rsp.content) - divContent = root.xpath("//div[@class='col-lg-wide-75 col-xs-1']")[0] - title = divContent.xpath(".//h1[@class='title']/text()")[0] - pic = divContent.xpath(".//a[@class='stui-vodlist__thumb picture v-thumb']/img/@data-original")[0] - detail = divContent.xpath(".//p[@class='desc detail hidden-xs']/span[@class='detail-content']/text()")[0] - vod = { - "vod_id": tid, - "vod_name": title, - "vod_pic": pic, - "type_name": "", - "vod_year": "", - "vod_area": "", - "vod_remarks": "", - "vod_actor": "", - "vod_director": "", - "vod_content": detail - } - infoArray = divContent.xpath(".//div[@class='stui-content__detail']/p[@class='data']") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('类型'): - infon = content.split('\xa0') - for inf in infon: - if inf.startswith('类型'): - vod['type_name'] = inf.replace("类型:", "") - if inf.startswith('地区'): - vod['vod_area'] = inf.replace("地区:", "") - if inf.startswith('年份'): - vod['vod_year'] = inf.replace("年份:", "") - if content.startswith('主演'): - vod['vod_actor'] = content.replace("\xa0", "/").replace("主演:", "") - if content.startswith('导演'): - vod['vod_director'] = content.replace("\xa0", "").replace("导演:", "") - vod_play_url = '$$$' - vod['vod_play_from'] = '完美看看' - purl = divContent.xpath(".//div[@class='stui-pannel_bd col-pd clearfix']/ul/li") - playList = [] - vodItems = [] - for plurl in purl: - plaurl = plurl.xpath(".//a/@href")[0] - name = plurl.xpath(".//a/text()")[0] - tId = self.regStr(plaurl, '/play/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - vod['vod_play_url'] = vod_play_url - result = { - 'list': [ - vod - ] - } - return result - - def searchContent(self, key, quick): - result = {} - return result - - def playerContent(self, flag, id, vipFlags): - result = {} - url = 'https://www.wanmeikk.film/play/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(rsp.text) - scripts = root.xpath("//div[@class='stui-player__video embed-responsive embed-responsive-16by9 clearfix']/script/text()")[0] - key = scripts.split("url")[1].replace('"', "").replace(':', "").replace(',', "").replace("'", "") - surl = 'https://www.wanmeikk.film/dplayer.php?url={0}'.format(key) - srsp = self.fetch(surl) - sroot = self.html(srsp.text) - murl = sroot.xpath("//script[@type='text/javascript']/text()")[0] - mp4url = re.findall(r"var urls = '(.*)';", murl)[0] - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = mp4url - result["header"] = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - def isVideoFormat(self, url): - pass - - def manualVideoCheck(self): - pass - - def localProxy(self, param): - action = { - 'url': '', - 'header': '', - 'param': '', - 'type': 'string', - 'after': '' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_xmaomi.py b/TVBox_PY/py_xmaomi.py deleted file mode 100644 index 83e6b7f..0000000 --- a/TVBox_PY/py_xmaomi.py +++ /dev/null @@ -1,258 +0,0 @@ -#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 "x小猫咪" - def init(self,extend=""): - print("============{0}============".format(extend)) - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "电影":"1", - "电视剧":"2", - "综艺":"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): - tmpRsp = self.fetch("https://xmaomi.net/") - suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") - url = "https://xmaomi.net"+suffix - # self.cookie = rsp.cookies - rsp = self.fetch(url,cookies=tmpRsp.cookies) - root = self.html(rsp.text) - print(rsp.text[0]) - print(root) - aList = root.xpath("//ul[contains(@class,'hl-vod-list')]/li/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./div[@class='hl-pic-text']/span/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - - urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] - urlParams[0] = tid - urlParams[8] = pg - for key in extend: - urlParams[int(key)] = extend[key] - params = '-'.join(urlParams) - url = 'https://xmaomi.net/vod_____show/{0}.html'.format(params) - tmpRsp = self.fetch(url) - suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") - url = 'https://xmaomi.net'+suffix - rsp = self.fetch(url,cookies=tmpRsp.cookies) - root = self.html(rsp.text) - print(rsp.text[0]) - print(root) - aList = root.xpath("//ul[contains(@class,'hl-vod-list')]/li/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./div[@class='hl-pic-text']/span/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - 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 = 'https://xmaomi.net/{0}.html'.format(tid) - tmpRsp = self.fetch(url) - suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") - url = "https://xmaomi.net"+suffix - rsp = self.fetch(url,cookies=tmpRsp.cookies) - root = self.html(rsp.text) - print(rsp.text[0]) - print(root) - divContent = root.xpath("//div[contains(@class,'hl-full-box')]")[0] - title = divContent.xpath("./div[@class='hl-item-pic']/span/@title")[0] - pic = divContent.xpath("./div[@class='hl-item-pic']/span/@data-original")[0] - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - liArray = divContent.xpath(".//li") - for li in liArray: - content = li.xpath('string(.)') - if content.startswith('类型'): - vod['type_name'] = content - if content.startswith('年份'): - vod['vod_year'] = content - if content.startswith('地区'): - vod['vod_area'] = content - if content.startswith('状态'): - vod['vod_remarks'] = content - if content.startswith('主演'): - vod['vod_actor'] = content - if content.startswith('导演'): - vod['vod_director'] = content - if content.startswith('简介'): - vod['vod_content'] = content - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath("//div[contains(@class,'hl-rb-tips')]//span[@class='hl-text-site']/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath(".//div[contains(@class,'hl-play-source')]//ul") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./li/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('string(.)') - tId = self.regStr(href,'/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - url = 'https://xmaomi.net/v_search/{0}-------------.html'.format(key) - tmpRsp = self.fetch(url) - suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") - url = "https://xmaomi.net"+suffix - rsp = self.fetch(url,cookies=tmpRsp.cookies) - root = self.html(rsp.text) - print(rsp.text[0]) - print(root) - aList = root.xpath("//ul[contains(@class,'hl-one-list')]/li//a[contains(@class,'hl-item-thumb')]") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - print(name) - pic = a.xpath('./@data-original')[0] - print(pic) - mark = a.xpath("./div[@class='hl-pic-text']/span/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def playerContent(self,flag,id,vipFlags): - url = 'https://xmaomi.net/{0}.html'.format(id) - tmpRsp = self.fetch(url) - suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") - url = "https://xmaomi.net"+suffix - rsp = self.fetch(url,cookies=tmpRsp.cookies) - root = self.html(rsp.text) - print(rsp.text[0]) - print(root) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - parseUrl = "" - print(jo) - htmlUrl = 'https://play.fositv.com/?url={0}&tm={1}&key={2}&next=&title='.format(jo['url'],jo['tm'],jo['key']) - htmlRsp = self.fetch(htmlUrl) - htmlRoot = self.html(htmlRsp.text) - configScripts = htmlRoot.xpath("//script/text()") - configJo = {} - for script in configScripts: - if(script.strip().startswith("var config")): - target = script[script.index('{'):(script.index('}')+1)] - configJo = json.loads(target) - break; - param = { - 'url': configJo['url'], - 'time': configJo['time'], - 'key': configJo['key'] - } - postRsp = self.post('https://play.fositv.com/API.php',param) - resultJo = json.loads(postRsp.text) - result = { - 'parse':0, - 'playUrl':'', - 'url':resultJo['url'], - 'header':{ - 'User-Agent':resultJo['ua'] - } - } - return result - - cookie = {} - config = { - "player": {}, - "filter": {"1":[{"key":0,"name":"分类","value":[{"n":"全部","v":"1"},{"n":"动作","v":"101"},{"n":"喜剧","v":"102"},{"n":"爱情","v":"103"},{"n":"科幻","v":"104"},{"n":"剧情","v":"105"},{"n":"悬疑","v":"106"},{"n":"惊悚","v":"107"},{"n":"恐怖","v":"108"},{"n":"犯罪","v":"109"},{"n":"谍战","v":"110"},{"n":"冒险","v":"111"},{"n":"奇幻","v":"112"},{"n":"灾难","v":"113"},{"n":"战争","v":"114"},{"n":"动画","v":"115"},{"n":"歌舞","v":"116"},{"n":"历史","v":"117"},{"n":"传记","v":"118"},{"n":"纪录","v":"119"},{"n":"其他","v":"120"}]},{"key":1,"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":"其他"}]},{"key":11,"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":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"2":[{"key":0,"name":"分类","value":[{"n":"全部","v":"2"},{"n":"武侠","v":"201"},{"n":"喜剧","v":"202"},{"n":"爱情","v":"203"},{"n":"剧情","v":"204"},{"n":"青春","v":"205"},{"n":"悬疑","v":"206"},{"n":"科幻","v":"207"},{"n":"军事","v":"208"},{"n":"警匪","v":"209"},{"n":"谍战","v":"210"},{"n":"奇幻","v":"211"},{"n":"偶 像","v":"212"},{"n":"年代","v":"213"},{"n":"乡村","v":"214"},{"n":"都市","v":"215"},{"n":"家庭","v":"216"},{"n":"古装","v":"217"},{"n":"历史","v":"218"},{"n":"神话","v":"219"},{"n":"其他","v":"220"}]},{"key":1,"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":"其他"}]},{"key":11,"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":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"3":[{"key":0,"name":"分类","value":[{"n":"全部","v":"3"},{"n":"脱口秀","v":"301"},{"n":"真人秀","v":"302"},{"n":"搞笑","v":"303"},{"n":"访谈","v":"304"},{"n":"生活","v":"305"},{"n":"晚会","v":"306"},{"n":"美食","v":"307"},{"n":"游戏","v":"308"},{"n":"亲子","v":"309"},{"n":"旅游","v":"310"},{"n":"文化","v":"311"},{"n":"体育","v":"312"},{"n":"时尚","v":"313"},{"n":"纪实","v":"314"},{"n":"益智","v":"315"},{"n":"演艺","v":"316"},{"n":"歌舞","v":"317"},{"n":"音乐","v":"318"},{"n":"播报","v":"319"},{"n":"其他","v":"320"}]},{"key":1,"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":"其他"}]},{"key":11,"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":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"4":[{"key":0,"name":"分类","value":[{"n":"全部","v":"4"},{"n":"热血","v":"401"},{"n":"格斗","v":"402"},{"n":"恋爱","v":"403"},{"n":"美少女","v":"404"},{"n":"校园","v":"405"},{"n":"搞笑","v":"406"},{"n":"LOLI","v":"407"},{"n":"神魔","v":"408"},{"n":"机战","v":"409"},{"n":"科幻","v":"410"},{"n":"真人","v":"411"},{"n":"青春","v":"412"},{"n":"魔法","v":"413"},{"n":"神话","v":"414"},{"n":"冒险","v":"415"},{"n":"运动","v":"416"},{"n":"竞技","v":"417"},{"n":"童话","v":"418"},{"n":"亲子","v":"419"},{"n":"教育","v":"420"}]},{"key":1,"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":"其他"}]},{"key":11,"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":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}],"5":[{"key":0,"name":"分类","value":[{"n":"全部","v":"5"},{"n":"人物","v":"501"},{"n":"军事","v":"502"},{"n":"历史","v":"503"},{"n":"自然","v":"504"},{"n":"探险","v":"505"},{"n":"科技","v":"506"},{"n":"文化","v":"507"},{"n":"刑侦","v":"508"},{"n":"社会","v":"509"},{"n":"旅游","v":"510"},{"n":"其他","v":"511"}]},{"key":1,"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":"其他"}]},{"key":11,"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":5,"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"},{"n":"0-9","v":"0-9"}]},{"key":2,"name":"排序","value":[{"n":"最新","v":"time"},{"n":"最热","v":"hits"},{"n":"评分","v":"score"}]}]} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_yangshi.py b/TVBox_PY/py_yangshi.py deleted file mode 100644 index 0fa51f2..0000000 --- a/TVBox_PY/py_yangshi.py +++ /dev/null @@ -1,149 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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 = { - "等着我": "TOPC1451378757637200", - "我爱发明": "TOPC1569314345479107", - "动物世界": "TOPC1451378967257534", - "探索发现": "TOPC1451557893544236", - "创新进行时": "TOPC1570875218228998", - "我爱发明2021": "TOPC1451557970755294", - "经典咏流传 第五季":"VIDAIiNbDQzOjE5mLl3T4t2B220403" - } - 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 - def categoryContent(self,tid,pg,filter,extend): - result = {} - extend['id'] = tid - extend['p'] = pg - filterParams = ["id", "p", "d"] - params = ["", "", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = '{0}={1}'.format(filterParams[idx],extend[fp]) - suffix = '&'.join(params) - url = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix) - if not tid.startswith('TOPC'): - url = 'https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix) - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - vodList = jo['data']['list'] - videos = [] - for vod in vodList: - guid = vod['guid'] - title = vod['title'] - img = vod['image'] - brief = vod['brief'] - videos.append({ - "vod_id":guid+"###"+img, - "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] - url = "https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid={0}".format(tid) - - rsp = self.fetch(url,headers=self.header) - jo = json.loads(rsp.text) - title = jo['title'].strip() - link = jo['hls_url'].strip() - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":aid[1], - "type_name":'', - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":"" - } - vod['vod_play_from'] = 'CCTV' - vod['vod_play_url'] = title+"$"+link - - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - result = {} - rsp = self.fetch(id,headers=self.header) - content = rsp.text.strip() - arr = content.split('\n') - urlPrefix = self.regStr(id,'(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": {"TOPC1451557970755294": [{"key": "d", "name": "年份", "value": [{"n": "全部", "v": ""}, {"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"}]}]} - } - 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" - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_yangshiquanji.py b/TVBox_PY/py_yangshiquanji.py deleted file mode 100644 index e716003..0000000 --- a/TVBox_PY/py_yangshiquanji.py +++ /dev/null @@ -1,218 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -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): - result['filters'] = self.config['filter'] - return result - def homeVideoContent(self): - result = { - 'list':[] - } - 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 + '=' + 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 detailContent(self,array): - # aid = array[0].split('###') - # tid = aid[0] - # logo = aid[2] - # webSite = aid[1] - # date = aid[0] - # rsp = self.fetch(webSite,headers=self.header) - # topicId = '' - # root = self.html(rsp.text) - # topicId = self.regStr(rsp.text,"(TOPC[0-9]{16})") - # title = root.xpath('.//title/text()')[0] - # if len(topicId) <= 0: - # return {} - # 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 = '近期' - # vod = { - # "vod_id":array[0], - # "vod_name":date +" "+title, - # "vod_pic":logo, - # "type_name":'', - # "vod_year":date, - # "vod_area":"", - # "vod_remarks":date, - # "vod_actor":"", - # "vod_director":"", - # "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":"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":"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, ""] \ No newline at end of file diff --git a/TVBox_PY/py_yiso.py b/TVBox_PY/py_yiso.py deleted file mode 100644 index 4ce5f65..0000000 --- a/TVBox_PY/py_yiso.py +++ /dev/null @@ -1,63 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import requests - -class Spider(Spider): - def getDependence(self): - return ['py_ali'] - def getName(self): - return "py_yiso" - def init(self,extend): - self.ali = extend[0] - print("============py_yiso============") - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - header = { - "User-Agent": "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36", - "Referer": "https://yiso.fun/" - } - def detailContent(self,array): - return self.ali.detailContent(array) - - def searchContent(self,key,quick): - url = "https://yiso.fun/api/search?name={0}&from=ali".format(key) - vodList = requests.get(url=url, headers=self.header, verify=False).json()["data"]["list"] - videos = [] - for vod in vodList: - videos.append({ - "vod_id": vod["url"], - "vod_name": vod["fileInfos"][0]["fileName"], - "vod_pic": "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000", - "vod_remarks": vod['gmtCreate'] - }) - result = { - 'list':videos - } - return result - - def playerContent(self,flag,id,vipFlags): - return self.ali.playerContent(flag,id,vipFlags) - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_yixi.py b/TVBox_PY/py_yixi.py deleted file mode 100644 index 788166e..0000000 --- a/TVBox_PY/py_yixi.py +++ /dev/null @@ -1,126 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json -import time -import base64 - -class Spider(Spider): - 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 = {} - url = 'https://yixi.tv/api/site/category/?_=1' - jo = self.fetch(url,headers=self.header).json() - category = jo['data']['items'] - classes = [] - classes.append({ - 'type_name':'全部', - 'type_id':'' - }) - for cat in category: - classes.append({ - 'type_name':cat['title'], - 'type_id':cat['id'] - }) - result['class'] = classes - if(filter): - result['filters'] = self.config['filter'] - return result - def homeVideoContent(self): - # url = 'https://yixi.tv/api/site/album/?page=1&page_size=4&_=1' - url = 'https://yixi.tv/api/site/album/22/detail/?page=1&page_size=24&_=1' - jo = self.fetch(url,headers=self.header).json() - videos = [] - vodList = jo['data']['items'] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['cover'], - "vod_remarks":vod['time'] - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://yixi.tv/api/site/speech/?page={1}&page_size=12&category_id={0}&order_by=0&_=1'.format(tid,pg) - jo = self.fetch(url,headers=self.header).json() - videos = [] - vodList = jo['data']['items'] - for vod in vodList: - videos.append({ - "vod_id":vod['id'], - "vod_name":vod['title'], - "vod_pic":vod['cover'], - "vod_remarks":vod['time'] - }) - 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 = "https://yixi.tv/api/site/speech/{0}/detail/?_=1".format(tid) - jo = self.fetch(url,headers=self.header).json() - - vod = { - "vod_id":jo['data']['speech']['id'], - "vod_name":jo['data']['speech']['title'], - "vod_pic":jo['data']['speech']['cover'], - "type_name":jo['data']['speech']['first_category'], - "vod_year":"", - "vod_area":"", - "vod_remarks":jo['data']['speech']['date'], - "vod_actor":"", - "vod_director":"", - "vod_content":jo['data']['speech']['titlelanguage'] - } - - vod['vod_play_from'] = '一席' - pList = [] - for vUrl in jo['data']['speech']['video_url']: - pList.append(vUrl['type_name']+"$"+vUrl['video_url']) - vod['vod_play_url'] = '#'.join(pList) - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = { - 'list':[] - } - return result - def playerContent(self,flag,id,vipFlags): - result = {} - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = id - result["header"] = '' - return result - - config = { - "player": {}, - "filter": {} - } - 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" - } - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_yytv.py b/TVBox_PY/py_yytv.py deleted file mode 100644 index c58a3c9..0000000 --- a/TVBox_PY/py_yytv.py +++ /dev/null @@ -1,136 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider -import json - -class Spider(Spider): - def getName(self): - return "体育直播" - def init(self,extend=""): - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - cateManual = { - "全部": "0", - "足球": "1", - "篮球": "2", - "其他": "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): - result = {} - return result - - def categoryContent(self,tid,pg,filter,extend): - result = {} - url = 'https://json.cranemarsh.com/all_live_rooms.json' - rsp = self.fetch(url) - pat = 'all_live_rooms\\((.*)\\)' - Root = self.regStr(rsp.text, pat) - jRoot = json.loads(Root) - videos = [] - vodList = jRoot['data'][tid] - for vod in vodList: - aid = vod['roomNum'] - title = vod['title'].strip() - img = vod['cover'].strip() - remark = vod['anchor']['nickName'].strip() - videos.append({ - "vod_id":aid, - "vod_name":title, - "vod_pic":img, - "vod_remarks":remark - }) - result['list'] = videos - result['page'] = pg - result['pagecount'] = 9999 - result['limit'] = 90 - result['total'] = 999999 - return result - - def detailContent(self,array): - aid = array[0] - url = "https://json.cranemarsh.com/room/{0}/detail.json".format(aid) - rsp = self.fetch(url,headers=self.header) - pat = 'detail\\((.*)\\)' - Root = self.regStr(rsp.text, pat) - jRoot = json.loads(Root) - jo = jRoot['data']['room'] - id = jo['roomNum'] - title = jo['title'] - pic = jo['cover'] - vod = { - "vod_id":id, - "vod_name":title, - "vod_pic":pic, - "type_name":'', - "vod_year":"", - "vod_area":'', - "vod_remarks":'', - "vod_actor":"", - "vod_director":"", - "vod_content":'' - } - ja = jRoot['data']['stream'] - flv = ja['flv'] - hdFlv = ja['hdFlv'] - m3u8 = ja['m3u8'] - hdM3u8 = ja['hdM3u8'] - playUrl = 'FLV' + '$' + flv + '#' + '高清FLV' + '$' + hdFlv + '#' + 'M3U8' + '$' + m3u8 + '#' + '高清M3U8' + '$' + hdM3u8 + '#' - vod['vod_play_from'] = '体育直播' - vod['vod_play_url'] = playUrl - result = { - 'list':[ - vod - ] - } - return result - def searchContent(self,key,quick): - result = {} - return result - def playerContent(self,flag,id,vipFlags): - result = {} - url = id - result["parse"] = 0 - result["playUrl"] = '' - result["url"] = url - result["header"] = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"} - - return result - - config = { - "player": {}, - "filter": {} - } - header = {} - - config = { - "player": {}, - "filter": {} - } - header = {} - def localProxy(self,param): - action = { - 'url':'', - 'header':'', - 'param':'', - 'type':'string', - 'after':'' - } - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_zhaozy.py b/TVBox_PY/py_zhaozy.py deleted file mode 100644 index f2039e0..0000000 --- a/TVBox_PY/py_zhaozy.py +++ /dev/null @@ -1,85 +0,0 @@ -#coding=utf-8 -#!/usr/bin/python -import sys -sys.path.append('..') -from base.spider import Spider - -class Spider(Spider): - def getDependence(self): - return ['py_ali'] - def getName(self): - return "py_zhaozy" - def init(self,extend): - self.ali = extend[0] - print("============py_zhaozy============") - pass - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def homeContent(self,filter): - result = {} - return result - def homeVideoContent(self): - result = {} - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - return result - 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", - "Referer": "https://zhaoziyuan.me/" - } - def detailContent(self,array): - tid = array[0] - print(self.getName()) - pattern = '(https://www.aliyundrive.com/s/[^\"]+)' - url = self.regStr(tid,pattern) - if len(url) > 0: - return self.ali.detailContent(array) - - rsp = self.fetch('https://zhaoziyuan.me/'+tid) - url = self.regStr(rsp.text,pattern) - if len(url) == 0: - return "" - newArray = [url] - print(newArray) - return self.ali.detailContent(newArray) - - def searchContent(self,key,quick): - map = { - '7':'文件夹', - '1':'视频' - } - ja = [] - for tKey in map.keys(): - url = "https://zhaoziyuan.me/so?filename={0}&t={1}".format(key,tKey) - rsp = self.fetch(url,headers=self.header) - root = self.html(self.cleanText(rsp.text)) - aList = root.xpath("//li[@class='clear']//a") - for a in aList: - # title = a.xpath('./h3/text()')[0] + a.xpath('./p/text()')[0] - title = self.xpText(a,'./h3/text()') + self.xpText(a,'./p/text()') - pic = 'https://img0.baidu.com/it/u=603086994,1727626977&fm=253&fmt=auto?w=500&h=667' - jo = { - 'vod_id': self.xpText(a,'@href'), - 'vod_name': '[{0}]{1}'.format(key,title), - 'vod_pic': pic - } - ja.append(jo) - result = { - 'list':ja - } - return result - - def playerContent(self,flag,id,vipFlags): - return self.ali.playerContent(flag,id,vipFlags) - - config = { - "player": {}, - "filter": {} - } - header = {} - - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/py_zxzj.py b/TVBox_PY/py_zxzj.py deleted file mode 100644 index aab5bb7..0000000 --- a/TVBox_PY/py_zxzj.py +++ /dev/null @@ -1,246 +0,0 @@ -#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 = { - "电影":"1", - "美剧":"2", - "韩剧":"3", - "日剧":"4", - "泰剧":"5", - "动漫":"6" - } - 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("https://zxzj.vip/") - root = self.html(rsp.text) - aList = root.xpath("//div[@class='stui-vodlist__box']/a") - - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./span[@class='pic-text text-right']/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/detail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - result = { - 'list':videos - } - return result - def categoryContent(self,tid,pg,filter,extend): - result = {} - if 'id' not in extend.keys(): - extend['id'] = tid - extend['page'] = pg - filterParams = ["id", "area", "by", "class", "lang", "", "", "", "page", "", "", "year"] - params = ["", "", "", "", "", "", "", "", "", "", "", ""] - for idx in range(len(filterParams)): - fp = filterParams[idx] - if fp in extend.keys(): - params[idx] = extend[fp] - suffix = '-'.join(params) - url = 'https://zxzj.vip/vodshow/{0}.html'.format(suffix) - rsp = self.fetch(url) - root = self.html(rsp.text) - aList = root.xpath("//div[@class='stui-vodlist__box']/a") - videos = [] - for a in aList: - name = a.xpath('./@title')[0] - pic = a.xpath('./@data-original')[0] - mark = a.xpath("./span[@class='pic-text text-right']/text()")[0] - sid = a.xpath("./@href")[0] - sid = self.regStr(sid,"/detail/(\\S+).html") - videos.append({ - "vod_id":sid, - "vod_name":name, - "vod_pic":pic, - "vod_remarks":mark - }) - - 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 = 'https://zxzj.vip/detail/{0}.html'.format(tid) - rsp = self.fetch(url) - root = self.html(rsp.text) - node = root.xpath("//div[@class='stui-content']")[0] - - pic = node.xpath(".//img/@data-original")[0] - title = node.xpath('.//h1/text()')[0] - detail = node.xpath(".//span[@class='detail-content']/text()")[0] - - vod = { - "vod_id":tid, - "vod_name":title, - "vod_pic":pic, - "type_name":"", - "vod_year":"", - "vod_area":"", - "vod_remarks":"", - "vod_actor":"", - "vod_director":"", - "vod_content":detail - } - - infoArray = node.xpath(".//div[@class='stui-content__detail']/p") - for info in infoArray: - content = info.xpath('string(.)') - if content.startswith('类型'): - vod['type_name'] = content - # if content.startswith('年份'): - # vod['vod_year'] = content - # if content.startswith('地区'): - # vod['vod_area'] = content - # if content.startswith('更新'): - # vod['vod_remarks'] = content.replace('\n','').replace('\t','') - if content.startswith('主演'): - vod['vod_actor'] = content.replace('\n','').replace('\t','') - if content.startswith('导演'): - vod['vod_director'] = content.replace('\n','').replace('\t','') - # if content.startswith('剧情'): - # vod['vod_content'] = content.replace('\n','').replace('\t','') - - vod_play_from = '$$$' - playFrom = [] - vodHeader = root.xpath("//div[@class='stui-vodlist__head']/h3/text()") - for v in vodHeader: - playFrom.append(v) - vod_play_from = vod_play_from.join(playFrom) - - vod_play_url = '$$$' - playList = [] - vodList = root.xpath("//ul[contains(@class,'stui-content__playlist')]") - for vl in vodList: - vodItems = [] - aList = vl.xpath('./li/a') - for tA in aList: - href = tA.xpath('./@href')[0] - name = tA.xpath('./text()')[0] - tId = self.regStr(href,'/video/(\\S+).html') - vodItems.append(name + "$" + tId) - joinStr = '#' - joinStr = joinStr.join(vodItems) - playList.append(joinStr) - vod_play_url = vod_play_url.join(playList) - - vod['vod_play_from'] = vod_play_from - vod['vod_play_url'] = vod_play_url - - result = { - 'list':[ - vod - ] - } - return result - - def searchContent(self,key,quick): - url = 'https://zxzj.vip/index.php/ajax/suggest?mid=1&wd={0}'.format(key) - # getHeader() - rsp = self.fetch(url) - jo = json.loads(rsp.text) - result = {} - jArray = [] - if int(jo['total']) > 0: - for j in jo['list']: - jArray.append({ - "vod_id": j['id'], - "vod_name": j['name'], - "vod_pic": j['pic'], - "vod_remarks": "" - }) - result = { - 'list':jArray - } - return result - - config = { - "player": { - "dpp": { - "sh": "DP播放", - "pu": "https://jx.zxzj.vip/dplayer.php?url=", - "sn": 1, - "or": 999 - } - }, - "filter": {"1": [{"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": "情色"}]}, {"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"}]}], "2": [{"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": "其他"}]}, {"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", "v": "2004"}]}, {"key": "lang", "name": "语言", "value": [{"n": "全部", "v": ""}, {"n": "英语", "v": "英语"}, {"n": "法语", "v": "法语"}]}, {"key": "by", "name": "排序", "value": [{"n": "最新", "v": "time"}, {"n": "最热", "v": "hits"}, {"n": "评分", "v": "score"}]}], "3": [{"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": "其他"}]}, {"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": "by", "name": "排序", "value": [{"n": "最新", "v": "time"}, {"n": "最热", "v": "hits"}, {"n": "评分", "v": "score"}]}], "4": [{"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": "其他"}]}, {"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": "by", "name": "排序", "value": [{"n": "最新", "v": "time"}, {"n": "最热", "v": "hits"}, {"n": "评分", "v": "score"}]}], "5": [{"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": "by", "name": "排序", "value": [{"n": "最新", "v": "time"}, {"n": "最热", "v": "hits"}, {"n": "评分", "v": "score"}]}], "6": [{"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": "其他"}]}, {"key": "area", "name": "地区", "value": [{"n": "全部", "v": ""}, {"n": "国产", "v": "国产"}, {"n": "日本", "v": "日本"}, {"n": "欧美", "v": "欧美"}, {"n": "其他", "v": "其他"}]}, {"key": "lang", "name": "语言", "value": [{"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": "by", "name": "排序", "value": [{"n": "最新", "v": "time"}, {"n": "最热", "v": "hits"}, {"n": "评分", "v": "score"}]}]} - } - header = { - "origin":"https://zxzj.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" - } - def playerContent(self,flag,id,vipFlags): - result = {} - url = 'https://zxzj.vip/video/{0}.html'.format(id) - rsp = self.fetch(url) - root = self.html(rsp.text) - scripts = root.xpath("//script/text()") - jo = {} - for script in scripts: - if(script.startswith("var player_")): - target = script[script.index('{'):] - jo = json.loads(target) - break; - parseUrl = '' - # src="(\S+url=) - # playerConfig = self.config['player'] - # if jo['from'] in self.config['player']: - # playerConfig = self.config['player'][jo['from']] - # parseUrl = playerConfig['pu'] + jo['url'] - scriptUrl = 'https://zxzj.vip/static/player/{0}.js'.format(jo['from']) - scriptRsp = self.fetch(scriptUrl) - parseUrl = self.regStr(scriptRsp.text,'src="(\\S+url=)') - if len(parseUrl) > 0: - parseRsp = self.fetch(parseUrl+jo['url']) - realUrl = self.regStr(parseRsp.text,"(?<=urls\\s=\\s').*?(?=')",0) - if len(realUrl) > 0 : - result["parse"] = 0 - result["playUrl"] = "" - result["url"] = realUrl - result["header"] = json.dumps(self.header) - else: - result["parse"] = 1 - result["playUrl"] = "" - result["url"] = jo['url'] - result["header"] = json.dumps(self.header) - return result - def isVideoFormat(self,url): - pass - def manualVideoCheck(self): - pass - def localProxy(self,param): - return [200, "video/MP2T", action, ""] \ No newline at end of file diff --git a/TVBox_PY/spider_77.py b/TVBox_PY/spider_77.py deleted file mode 100644 index 872157b..0000000 --- a/TVBox_PY/spider_77.py +++ /dev/null @@ -1,172 +0,0 @@ -from spider import Spider, SpiderCategory, SpiderVideo, SpiderEpisode -from proxy import get_proxy_main_url -from urllib.parse import urlparse -from danmaku import get_danmaku_url -import requests -import hashlib -import time - -base_params = { - 'pcode': '010110005', - 'version': '2.0.5', - 'devid': hashlib.md5(str(time.time()).encode()).hexdigest(), - 'sys': 'android', - 'sysver': 11, - 'brand': 'google', - 'model': 'Pixel_3_XL', - 'package': 'com.sevenVideo.app.android' -} - -base_headers = { - 'User-Agent': 'okhttp/3.12.0', -} - - -class Spider77(Spider): - - def name(self): - return '七七' - - def is_searchable(self): - return True - - def list_categories(self): - r = requests.get('http://api.kunyu77.com/api.php/provide/filter', - headers=base_headers.copy()) - data = r.json() - categories = [] - for category_id in data['data']: - category_name = data['data'][category_id][0]['cat'] - categories.append(SpiderCategory(category_id, category_name)) - return categories - - def list_videos(self, category_id, page): - r = requests.get('http://api.kunyu77.com/api.php/provide/searchFilter', - params={ - 'type_id': category_id, - 'pagenum': page, - 'pagesize': 50 - }, - headers=base_headers.copy()) - data = r.json() - videos = [] - for video in data['data']['result']: - videos.append( - SpiderVideo(id=video['id'], - name=video['title'], - cover=video['videoCover'])) - - has_next_page = page < data['data']['pagesize'] - return videos, has_next_page - - def list_episodes(self, video_id): - ts = int(time.time()) - params = base_params.copy() - params['ids'] = video_id - params['sj'] = ts - - headers = base_headers.copy() - headers['t'] = str(ts) - - url = 'http://api.kunyu77.com/api.php/provide/videoDetail' - headers['TK'] = self._get_tk(url, params, ts) - r = requests.get(url, params=params, headers=headers) - detail = r.json()['data'] - - url = 'http://api.kunyu77.com/api.php/provide/videoPlaylist' - headers['TK'] = self._get_tk(url, params, ts) - r = requests.get(url, params=params, headers=headers) - episodes = r.json()['data']['episodes'] - - mepisodes = [] - for episode in episodes: - - sources = [] - danmakus = [] - for playurl in episode['playurls']: - if playurl['playfrom'] in ['ppayun']: - sources.append({ - 'name': playurl['playfrom'], - 'params': { - 'url': playurl['playurl'], - } - }) - - if playurl['playfrom'] in [ - 'qq', 'mgtv', 'qiyi', 'youku', 'bilibili' - ]: - danmakus.append({ - 'name': playurl['playfrom'], - 'url': get_danmaku_url(playurl['playurl']), - }) - - mepisodes.append( - SpiderEpisode( - name=episode['title'], - sources=sources, - cover=detail['videoCover'], - description=detail['brief'], - cast=detail['actor'].split(' '), - director=detail['director'], - area=detail['area'], - year=int(detail['year']), - danmakus=danmakus, - )) - - return mepisodes - - def resolve_play_url(self, episode_params): - headers = base_headers.copy() - - r = requests.get('http://api.kunyu77.com/api.php/provide/parserUrl', - params={'url': episode_params['url']}, - headers=base_headers.copy()) - data = r.json()['data'] - if 'playHeader' in data: - for key in data['playHeader']: - headers[key] = data['playHeader'][key] - - r = requests.get(data['url']) - return get_proxy_main_url(r.json()['url'], headers) - - def search_videos(self, keyword): - url = 'http://api.kunyu77.com/api.php/provide/searchVideo' - - ts = int(time.time()) - params = base_params.copy() - params['sj'] = ts - params['searchName'] = keyword - params['pg'] = 1 - - headers = base_headers.copy() - headers['t'] = str(ts) - headers['TK'] = self._get_tk(url, params, ts) - - r = requests.get(url, params=params, headers=headers) - data = r.json() - videos = [] - for video in data['data']: - videos.append( - SpiderVideo( - id=video['id'], - name=video['videoName'], - cover=video['videoCover'], - description=video['brief'], - cast=video['starName'].split(','), - year=int(video['year']), - )) - return videos - - def _get_tk(self, url, params, ts): - keys = [] - for key in params: - keys.append(key) - keys.sort() - - src = urlparse(url).path - for key in keys: - src += str(params[key]) - src += str(ts) - src += 'XSpeUFjJ' - - return hashlib.md5(src.encode()).hexdigest() diff --git a/TVBox_PY/spider_alipansou.py b/TVBox_PY/spider_alipansou.py deleted file mode 100644 index 6b78a82..0000000 --- a/TVBox_PY/spider_alipansou.py +++ /dev/null @@ -1,58 +0,0 @@ -from spider import SpiderVideo -from spider_aliyundrive import SpiderAliyunDrive -from bs4 import BeautifulSoup -import requests -import re - - -class SpiderAliPanSou(SpiderAliyunDrive): - - regex_url = re.compile(r'https://www.aliyundrive.com/s/[^"]+') - - def name(self): - return '猫狸盘搜' - - def is_searchable(self): - return True - - def hide(self): - return False - - def list_categories(self): - return [] - - def list_videos(self, category_id, page): - return [], False - - def list_episodes(self, video_id): - r = requests.get('https://www.alipansou.com' + video_id) - m = self.regex_url.search(r.text) - url = m.group().replace('\\', '') - return super().list_episodes(url) - - def search_videos(self, keyword): - r = requests.get('https://www.alipansou.com/search', - params={ - 'k': keyword, - 't': 7, - }) - soup = BeautifulSoup(r.text, 'html.parser') - - items = soup.select('van-row > a') - videos = [] - for item in items: - name = self._remove_html_tags(item.find('template').__str__()) - #if keyword not in name: - # continue - videos.append(SpiderVideo( - id=item.get('href'), - name=name, - )) - - return videos - - def _remove_html_tags(self, text): - """Remove html tags from a string""" - import re - clean = re.compile('<.*?>') - return re.sub(clean, '', text) diff --git a/TVBox_PY/spider_aliyundrive.py b/TVBox_PY/spider_aliyundrive.py deleted file mode 100644 index aab2095..0000000 --- a/TVBox_PY/spider_aliyundrive.py +++ /dev/null @@ -1,426 +0,0 @@ -from spider import Spider, SpiderEpisode -from cache import get_cache, set_cache -from proxy import get_proxy_func_url, ProxyFuncResult -from downloader import get_download_url -import requests -import re -import json -import time -import xbmcaddon - -_ADDON = xbmcaddon.Addon() - -base_headers = { - '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', - 'Referer': 'https://www.aliyundrive.com/', -} - - -class SpiderAliyunDrive(Spider): - setting_key_refresh_token = 'aliyundrive_refresh_token' - setting_key_display_file_size_switch = 'aliyundrive_display_file_size_switch' - setting_key_downloder_switch = 'downloader_switch' - regex_share_id = re.compile( - r'www.aliyundrive.com\/s\/([^\/]+)(\/folder\/([^\/]+))?') - cache = {} - - def name(self): - return '阿里云盘' - - def is_searchable(self): - return False - - def hide(self): - return True - - def list_categories(self): - return [] - - def list_videos(self, category_id, page): - return [], False - - def list_episodes(self, video_id): - m = self.regex_share_id.search(video_id) - share_id = m.group(1) - file_id = m.group(3) - - r = requests.post( - 'https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous', - json={'share_id': share_id}) - share_info = r.json() - - if len(share_info['file_infos']) == 0: - return [] - - file_info = None - if file_id: - for fi in share_info['file_infos']: - if fi['file_id'] == file_id: - file_info = fi - break - if file_info is None: - return [] - else: - file_info = share_info['file_infos'][0] - file_id = file_info['file_id'] - - parent_file_id = None - if file_info['type'] == 'folder': - parent_file_id = file_id - elif file_info['type'] == 'file' and file_info['category'] == 'video': - parent_file_id = 'root' - else: - return [] - - share_token = self._get_share_token(share_id) - - video_file_infos = [] - subtitle_file_infos = [] - self._list_files(video_file_infos, subtitle_file_infos, share_id, - share_token, parent_file_id) - video_file_infos.sort(key=lambda x: x['name']) - - subtitles = [] - for file_info in subtitle_file_infos: - subtitles.append({ - 'name': - file_info['name'], - 'url': - get_proxy_func_url( - SpiderAliyunDrive.__name__, - self.proxy_download_url.__name__, - { - 'share_id': file_info['share_id'], - 'file_id': file_info['file_id'], - 'drive_id': file_info['drive_id'], - }, - ) - }) - - episodes = [] - display_file_size = _ADDON.getSettingBool( - self.setting_key_display_file_size_switch) - for file_info in video_file_infos: - if display_file_size: - name = '[{}] {}'.format( - self._sizeof_fmt(file_info['size']), - file_info['name'], - ) - else: - name = file_info['name'] - - sources = [{ - 'name': '原画', - 'params': { - 'template_id': '', - 'share_id': file_info['share_id'], - 'file_id': file_info['file_id'], - 'drive_id': file_info['drive_id'], - }, - }, { - 'name': '超高清', - 'params': { - 'template_id': 'FHD', - 'share_id': file_info['share_id'], - 'file_id': file_info['file_id'], - 'drive_id': file_info['drive_id'], - }, - }, { - 'name': '高清', - 'params': { - 'template_id': 'HD', - 'share_id': file_info['share_id'], - 'file_id': file_info['file_id'], - 'drive_id': file_info['drive_id'], - }, - }, { - 'name': '标清', - 'params': { - 'template_id': 'SD', - 'share_id': file_info['share_id'], - 'file_id': file_info['file_id'], - 'drive_id': file_info['drive_id'], - }, - }] - - episodes.append( - SpiderEpisode( - name=name, - sources=sources, - cover=share_info['avatar'], - description=video_id, - subtitles=subtitles, - )) - - return episodes - - def resolve_play_url(self, episode_params): - if len(episode_params['template_id']) == 0: - downloader_switch = _ADDON.getSettingBool( - self.setting_key_downloder_switch) - if downloader_switch: - return get_download_url( - spider_class=SpiderAliyunDrive.__name__, - func_name=self.proxy_download_url.__name__, - params=episode_params) - else: - return get_proxy_func_url(SpiderAliyunDrive.__name__, - self.proxy_download_url.__name__, - episode_params) - else: - return get_proxy_func_url(SpiderAliyunDrive.__name__, - self.proxy_preview_m3u8.__name__, - episode_params) - - def search_videos(self, keyword): - return [] - - def _get_refresh_token(self): - token_or_url = _ADDON.getSettingString(self.setting_key_refresh_token) - if token_or_url.startswith('http://') or token_or_url.startswith( - 'https://'): - return requests.get(token_or_url).text.strip() - else: - return token_or_url - - def _get_access_token(self): - key = 'aliyundrive:access_token' - data = self._get_cache(key) - if data: - return data['access_token'] - - r = requests.post('https://api.aliyundrive.com/token/refresh', - json={ - 'refresh_token': self._get_refresh_token(), - }) - data = r.json() - - access_token = '{} {}'.format(data['token_type'], data['access_token']) - expires_at = int(time.time()) + int(data['expires_in'] / 2) - self._set_cache(key, { - 'access_token': access_token, - 'expires_at': expires_at - }) - return access_token - - def _get_share_token(self, share_id, share_pwd=''): - key = 'aliyundrive:share_token' - data = self._get_cache(key) - if data: - if data['share_id'] == share_id and data['share_pwd'] == share_pwd: - return data['share_token'] - - r = requests.post( - 'https://api.aliyundrive.com/v2/share_link/get_share_token', - json={ - 'share_id': share_id, - 'share_pwd': share_pwd - }) - data = r.json() - - share_token = data['share_token'] - expires_at = int(time.time()) + int(data['expires_in'] / 2) - self._set_cache( - key, { - 'share_token': share_token, - 'expires_at': expires_at, - 'share_id': share_id, - 'share_pwd': share_pwd - }) - return share_token - - def _list_files(self, video_file_infos, subtitle_file_infos, share_id, - share_token, parent_file_id): - marker = '' - headers = base_headers.copy() - headers['x-share-token'] = share_token - for page in range(1, 51): - if page >= 2 and len(marker) == 0: - break - - r = requests.post( - 'https://api.aliyundrive.com/adrive/v3/file/list', - json={ - "image_thumbnail_process": - "image/resize,w_160/format,jpeg", - "image_url_process": "image/resize,w_1920/format,jpeg", - "limit": 200, - "order_by": "updated_at", - "order_direction": "DESC", - "parent_file_id": parent_file_id, - "share_id": share_id, - "video_thumbnail_process": - "video/snapshot,t_1000,f_jpg,ar_auto,w_300", - 'marker': marker, - }, - headers=headers) - data = r.json() - - for item in data['items']: - if item['type'] == 'folder': - self._list_files(video_file_infos, subtitle_file_infos, - share_id, share_token, item['file_id']) - elif item['type'] == 'file' and item['category'] == 'video': - video_file_infos.append(item) - elif item['type'] == 'file' and item['file_extension'] in [ - 'srt', 'ass', 'nfo', 'vtt' - ]: - subtitle_file_infos.append(item) - - marker = data['next_marker'] - - def _get_m3u8_cache(self, share_id, file_id, template_id): - key = 'aliyundrive:m3u8' - data = self._get_cache(key) - if data: - if data['share_id'] == share_id and data[ - 'file_id'] == file_id and data[ - 'template_id'] == template_id: - return data['m3u8'], data['media_urls'] - - access_token = self._get_access_token() - share_token = self._get_share_token(share_id) - - headers = base_headers.copy() - headers['x-share-token'] = share_token - headers['Authorization'] = access_token - r = requests.post( - 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info', - json={ - 'share_id': share_id, - 'category': 'live_transcoding', - 'file_id': file_id, - 'template_id': '', - }, - headers=headers, - ) - - preview_url = '' - for t in r.json( - )['video_preview_play_info']['live_transcoding_task_list']: - if t['template_id'] == template_id: - preview_url = t['url'] - break - - r = requests.get(preview_url, - headers=base_headers.copy(), - allow_redirects=False) - preview_url = r.headers['Location'] - - lines = [] - media_urls = [] - r = requests.get(preview_url, headers=base_headers.copy(), stream=True) - media_id = 0 - for line in r.iter_lines(): - line = line.decode() - if 'x-oss-expires' in line: - media_url = preview_url[:preview_url.rindex('/') + 1] + line - media_urls.append(media_url) - line = get_proxy_func_url( - SpiderAliyunDrive.__name__, - self.proxy_preview_media.__name__, { - 'share_id': share_id, - 'file_id': file_id, - 'template_id': template_id, - 'media_id': media_id - }) - media_id += 1 - lines.append(line) - m3u8 = '\n'.join(lines) - - self._set_cache( - key, { - 'share_id': share_id, - 'file_id': file_id, - 'template_id': template_id, - 'm3u8': m3u8, - 'media_urls': media_urls, - 'expires_at': int(time.time()) + 300, - }) - - return m3u8, media_urls - - def proxy_preview_m3u8(self, params): - share_id = params['share_id'] - file_id = params['file_id'] - template_id = params['template_id'] - m3u8, _ = self._get_m3u8_cache(share_id, file_id, template_id) - return ProxyFuncResult( - body=m3u8, - headers={'Content-Type': 'application/vnd.apple.mpegurl'}) - - def proxy_preview_media(self, params): - share_id = params['share_id'] - file_id = params['file_id'] - template_id = params['template_id'] - media_id = params['media_id'] - - _, media_urls = self._get_m3u8_cache(share_id, file_id, template_id) - media_url = media_urls[media_id] - return ProxyFuncResult(url=media_url, headers=base_headers.copy()) - - def proxy_download_url(self, params): - share_id = params['share_id'] - file_id = params['file_id'] - - key = 'aliyundrive:download_url:{}:{}'.format(share_id, file_id) - data = self._get_cache(key) - if data: - return ProxyFuncResult(url=data['download_url'], - headers=base_headers.copy()) - - access_token = self._get_access_token() - share_token = self._get_share_token(share_id) - - headers = base_headers.copy() - headers['x-share-token'] = share_token - headers['Authorization'] = access_token - r = requests.post( - 'https://api.aliyundrive.com/v2/file/get_share_link_download_url', - json={ - 'share_id': share_id, - 'file_id': file_id, - 'expires_sec': 7200, - }, - headers=headers) - data = r.json() - - r = requests.get(data['download_url'], - headers=base_headers.copy(), - allow_redirects=False) - download_url = r.headers['Location'] - self._set_cache( - key, { - 'download_url': download_url, - 'expires_at': int(time.time()) + 300, - 'share_id': share_id, - 'file_id': file_id, - }) - - return ProxyFuncResult(url=download_url, headers=base_headers.copy()) - - def _sizeof_fmt(self, num, suffix="B"): - for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]: - if num < 1024.0: - return f"{num:3.1f} {unit}{suffix}" - num /= 1024.0 - return f"{num:.1f}Yi{suffix}" - - def _get_cache(self, key): - if key in self.cache: - data = self.cache[key] - if data['expires_at'] >= int(time.time()): - return data - - data = get_cache(key) - if data: - data = json.loads(data) - if data['expires_at'] >= int(time.time()): - return data - - return None - - def _set_cache(self, key, value): - set_cache(key, json.dumps(value)) - self.cache[key] = value diff --git a/TVBox_PY/spider_gitcafe.py b/TVBox_PY/spider_gitcafe.py deleted file mode 100644 index 565b302..0000000 --- a/TVBox_PY/spider_gitcafe.py +++ /dev/null @@ -1,70 +0,0 @@ -from spider import SpiderCategory, SpiderVideo -from spider_aliyundrive import SpiderAliyunDrive -import requests - - -class SpiderGitCafe(SpiderAliyunDrive): - - def name(self): - return '小纸条' - - def is_searchable(self): - return True - - def hide(self): - return False - - def list_categories(self): - categories = [] - categories.append(SpiderCategory('hydm', '华语动漫')) - categories.append(SpiderCategory("hyds", '华语电视')) - categories.append(SpiderCategory("hydy", '华语电影')) - categories.append(SpiderCategory("omdm", '欧美动漫')) - categories.append(SpiderCategory("omds", '欧美电视')) - categories.append(SpiderCategory("omdy", '欧美电影')) - categories.append(SpiderCategory("rhdm", '日韩动漫')) - categories.append(SpiderCategory("rhds", '日韩电视')) - categories.append(SpiderCategory("rhdy", '日韩电影')) - categories.append(SpiderCategory("qtds", '其他电视')) - categories.append(SpiderCategory("qtdy", '其他电影')) - categories.append(SpiderCategory("qtsp", '其他视频')) - categories.append(SpiderCategory("jlp", '纪录片')) - categories.append(SpiderCategory("zyp", '综艺片')) - return categories - - def list_videos(self, category_id, page): - r = requests.post('https://gitcafe.net/tool/alipaper/', - data={ - 'action': 'viewcat', - 'cat': category_id, - 'num': page, - }) - data = r.json() - - videos = [] - for video in data: - videos.append( - SpiderVideo( - id='https://www.aliyundrive.com/s/' + video['key'], - name=video['title'], - )) - - return videos, len(videos) >= 50 - - def search_videos(self, keyword): - r = requests.post('https://gitcafe.net/tool/alipaper/', - data={ - 'action': 'search', - 'keyword': keyword, - }) - data = r.json() - - videos = [] - for video in data: - videos.append( - SpiderVideo( - id='https://www.aliyundrive.com/s/' + video['key'], - name=video['title'], - )) - - return videos diff --git a/TVBox_PY/spider_zhaoziyuan.py b/TVBox_PY/spider_zhaoziyuan.py deleted file mode 100644 index f8c9b41..0000000 --- a/TVBox_PY/spider_zhaoziyuan.py +++ /dev/null @@ -1,52 +0,0 @@ -from spider import SpiderVideo -from spider_aliyundrive import SpiderAliyunDrive -from bs4 import BeautifulSoup -import requests -import re - - -class SpiderZhaoZiYuan(SpiderAliyunDrive): - - regex_url = re.compile(r'https://www.aliyundrive.com/s/[^"]+') - - def name(self): - return '找资源' - - def is_searchable(self): - return True - - def hide(self): - return False - - def list_categories(self): - return [] - - def list_videos(self, category_id, page): - return [], False - - def list_episodes(self, video_id): - r = requests.get('https://zhaoziyuan.la/' + video_id) - print(r.text) - m = self.regex_url.search(r.text) - url = m.group().replace('\\', '') - return super().list_episodes(url) - - def search_videos(self, keyword): - r = requests.get('https://zhaoziyuan.la/so', - params={ - 'filename': keyword, - }) - soup = BeautifulSoup(r.text, 'html.parser') - - items = soup.select('div.news_text > a') - videos = [] - for item in items: - name = item.find('h3').text - #if keyword not in name: - # continue - videos.append(SpiderVideo( - id=item.get('href'), - name=name, - )) - - return videos