From e8dfab361a30daecd299f2d3635f1bc384521238 Mon Sep 17 00:00:00 2001 From: qcfree <6529067+qcfree@user.noreply.gitee.com> Date: Sun, 6 Aug 2023 13:00:36 +0000 Subject: [PATCH] 1 Signed-off-by: qcfree <6529067+qcfree@user.noreply.gitee.com> --- py/plugin/中医药.py | 272 +++++++++++++++++++++++++++++++++++ py/plugin/中国文化.py | 274 +++++++++++++++++++++++++++++++++++ py/plugin/体育健身.py | 291 +++++++++++++++++++++++++++++++++++++ py/plugin/女团热舞.py | 312 ++++++++++++++++++++++++++++++++++++++++ py/plugin/小学教育.py | 276 +++++++++++++++++++++++++++++++++++ py/plugin/幼儿教育.py | 273 +++++++++++++++++++++++++++++++++++ py/plugin/戏曲合集.py | 303 ++++++++++++++++++++++++++++++++++++++ py/plugin/球队球星.py | 289 +++++++++++++++++++++++++++++++++++++ py/plugin/相声小品.py | 282 ++++++++++++++++++++++++++++++++++++ py/plugin/美女热舞.py | 292 +++++++++++++++++++++++++++++++++++++ py/plugin/美食合集.json | 4 + py/plugin/美食合集.py | 305 +++++++++++++++++++++++++++++++++++++++ py/plugin/软件教程.py | 279 +++++++++++++++++++++++++++++++++++ py/plugin/音乐合集.py | 282 ++++++++++++++++++++++++++++++++++++ 14 files changed, 3734 insertions(+) create mode 100644 py/plugin/中医药.py create mode 100644 py/plugin/中国文化.py create mode 100644 py/plugin/体育健身.py create mode 100644 py/plugin/女团热舞.py create mode 100644 py/plugin/小学教育.py create mode 100644 py/plugin/幼儿教育.py create mode 100644 py/plugin/戏曲合集.py create mode 100644 py/plugin/球队球星.py create mode 100644 py/plugin/相声小品.py create mode 100644 py/plugin/美女热舞.py create mode 100644 py/plugin/美食合集.json create mode 100644 py/plugin/美食合集.py create mode 100644 py/plugin/软件教程.py create mode 100644 py/plugin/音乐合集.py diff --git a/py/plugin/中医药.py b/py/plugin/中医药.py new file mode 100644 index 0000000..c60b965 --- /dev/null +++ b/py/plugin/中医药.py @@ -0,0 +1,272 @@ +#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 = { + "中医药":"中医药", + "中医基础":"中医基础", + "中药基础":"中药基础", + "伤寒论":"伤寒论", + "难经":"难经", + "神农本草经":"神农本草经", + "金匮要略":"金匮要略", + "脉经":"脉经", + "中藏经":"中藏经", + "针灸甲乙经":"针灸甲乙经", + "濒湖脉学":"濒湖脉学", + "本草纲目":"本草纲目", + "汤头歌诀":"汤头歌诀", + "药性赋":"药性赋" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/中国文化.py b/py/plugin/中国文化.py new file mode 100644 index 0000000..1ca4321 --- /dev/null +++ b/py/plugin/中国文化.py @@ -0,0 +1,274 @@ +#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 = { + "庄子":"庄子", + "论语":"论语", + "博通":"博通", + "丹道":"丹道", + "九宫八卦":"九宫八卦", + "河图洛书":"河图洛书", + "道德经":"道德经", + "奇门遁甲":"奇门遁甲", + "大六壬":"大六壬", + "梅花易数":"梅花易数", + "易经":"易经", + "黄帝内经":"黄帝内经", + "山海经":"山海经", + "南华经":"南华经", + "冲虚经":"冲虚经", + "文始真经":"文始真经" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/体育健身.py b/py/plugin/体育健身.py new file mode 100644 index 0000000..a494252 --- /dev/null +++ b/py/plugin/体育健身.py @@ -0,0 +1,291 @@ +#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 = { + "自由泳":"自由泳", + "广场舞":"广场舞", + "蛙泳":"蛙泳", + "乒乓球":"乒乓球", + "围棋":"围棋", + "足球":"足球", + "手球":"手球", + "篮球":"篮球", + "排球":"排球", +"羽毛球":"羽毛球", + "网球":"网球", +"高尔夫球":"高尔夫球", +"冰球":"冰球", + "沙滩排球":"沙滩排球", + "棒球":"棒球", + "垒球":"垒球", + "藤球":"藤球", + "毽球":"毽球", + "台球":"台球", + "鞠蹴":"鞠蹴", + "板球":"板球", +"壁球":"壁球", + "砂壶":"砂壶", + "冰壶":"冰壶", +"克郎球":"克郎球", + "橄榄球":"橄榄球", + "曲棍球":"曲棍球", +"水球":"水球", + "马球":"马球", + "保龄球":"保龄球", +"健身球":"健身球", + "门球":"门球", + "弹球":"弹球" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/女团热舞.py b/py/plugin/女团热舞.py new file mode 100644 index 0000000..5b32b3c --- /dev/null +++ b/py/plugin/女团热舞.py @@ -0,0 +1,312 @@ +#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 = { + "中国女团":"中国女团4K", +"日本女团":"日本女团4K", +"韩国女团":"韩国女团4K", +"SNH48":"SNH48MV合集", +"S.H.E":"S.H.EMV合集", +"Twins":"TwinsMV合集", +"火箭少女101":"火箭少女101MV合集", +"BY2":"BY2MV合集", +"S.I.N.G":"S.I.N.GMV合集", +"3unshine":"3unshineMV合集", +"蜜蜂少女队":"蜜蜂少女队MV合集", +"七朵组合":"七朵组合MV合集", +"GNZ48":"GNZ48MV合集", +"TWICE":"TWICEMV合集", +"4MINUTE":"4MINUTEMV合集", +"EXID":"EXIDMV合集", +"KARA":"KARAMV合集", +"TARA":"TARAMV合集", +"BLACKPINK":"BLACKPINKMV合集", +"LOONA":"LOONAMV合集", +"ITZY":"ITZYMV合集", +"RedVelvet":"RedVelvetMV合集", +"Everglow":"EverglowMV合集", +"Mamamoo":"MamamooMV合集", +"少女时代":"少女时代MV合集", +"S.E.S":"S.E.SMV合集", +"FIN.K.L":"FIN.K.LMV合集", +"2NE1":"2NE1MV合集", +"WonderGirls":"WonderGirlsMV合集", +"IZ*ONE":"IZ*ONEMV合集", +"Sistar":"SistarMV合集", +"Apink":"ApinkMV合集", +"AOA":"AOAMV合集", +"GFRIEND":"GFRIENDMV合集", +"f(x)":"f(x)MV合集", +"(G)I-DLE":"(G)I-DLEMV合集", +"Itzy":"ItzyMV合集", +"Oh!GG":"Oh!GGMV合集", +"GirlCrush":"GirlCrushMV合集", +"AKB48":"AKB48MV合集", +"SKE48":"SKE48MV合集", +"NMB48":"NMB48MV合集", +"JKT48":"JKT48MV合集", +"HKT48":"HKT48MV合集", +"AKB48TeamTP":"AKB48TeamTPMV合集", +"Perfume":"PerfumeMV合集", +"桃色幸运草Z":"桃色幸运草ZMV合集", +"乃木坂46乃":"乃木坂46乃MV合集", +"樱坂46":"樱坂46MV合集", +"日向坂46":"日向坂46MV合集", +"E-girls":"E-girlsMV合集", +"NiziU":"NiziUMV合集", +"BiSH":"BiSHMV合集", +"早安少女组":"早安少女组MV合集" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/小学教育.py b/py/plugin/小学教育.py new file mode 100644 index 0000000..b7058af --- /dev/null +++ b/py/plugin/小学教育.py @@ -0,0 +1,276 @@ +#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 = { + "1年级语文":"1年级语文", +"1年级数学":"1年级数学", + "1年级英语":"1年级英语", +"2年级语文":"2年级语文", +"2年级数学":"2年级数学", + "2年级英语":"2年级英语", +"3年级语文":"3年级语文", +"3年级数学":"3年级数学", + "3年级英语":"3年级英语", +"4年级语文":"4年级语文", +"4年级数学":"4年级数学", + "4年级英语":"4年级英语", +"5年级语文":"5年级语文", +"5年级数学":"5年级数学", + "5年级英语":"5年级英语", +"6年级语文":"6年级语文", +"6年级数学":"6年级数学", + "6年级英语":"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): + result = { + 'list':[] + } + return result + cookies = '' + def getCookie(self): + import requests + import http.cookies + # 这里填cookie + raw_cookie_line = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/幼儿教育.py b/py/plugin/幼儿教育.py new file mode 100644 index 0000000..925c4cd --- /dev/null +++ b/py/plugin/幼儿教育.py @@ -0,0 +1,273 @@ +#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 = { + "儿童早教": "儿童早教", + "儿童启蒙故事": "儿童启蒙故事", + "儿童英语启蒙": "儿童英语启蒙", + "儿童歌曲": "儿童歌曲", + "儿童玩具": "儿童玩具", + "儿童绘画": "儿童绘画", + "睡前故事": "睡前故事", + "儿童动画": "儿童动画", + "儿童音乐": "儿童音乐", + "儿童安全教育": "儿童安全教育", + "贝瓦儿歌": "贝瓦儿歌", + "悟空识字": "悟空识字", + "宝宝巴士": "宝宝巴士", + "儿歌多多": "儿歌多多", + "学而思": "学而思" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/戏曲合集.py b/py/plugin/戏曲合集.py new file mode 100644 index 0000000..07c7c20 --- /dev/null +++ b/py/plugin/戏曲合集.py @@ -0,0 +1,303 @@ +#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 = { + "京剧":"京剧超清", + "越剧":"越剧超清", + "蒲剧":"蒲剧超清", + "眉户":"眉户超清", + "吕剧":"吕剧超清", + "楚剧":"楚剧超清", + "歌仔戏":"歌仔戏超清", + "黄梅戏":"黄梅戏超清", + "评剧":"评剧超清", + "豫剧":"豫剧超清", + "花鼓戏":"花鼓戏超清", + "布袋戏":"布袋戏合集超清", + "沪剧":"沪剧超清", + "昆曲":"昆曲超清", + "潮剧":"潮剧超清", + "超清潮剧":"超清潮剧超清", +"百花潮剧院":"百花潮剧院超清", + "香港潮剧":"香港潮剧超清", + "潮剧院":"潮剧院超清", + "潮剧团":"潮剧团超清", + "潮剧全剧":"潮剧全剧超清", + "潮剧选段":"潮剧选段超清", + "名家潮剧":"名家潮剧超清", + "潮汕小品":"潮汕小品超清", + "潮汕讲古":"潮汕讲古超清", + "绍兴莲花落":"绍兴莲花落超清", +"河北梆子":"河北梆子超清", + "梆子腔":"梆子腔超清", + "晋剧":"晋剧超清", + "龙江剧":"龙江剧超清", + "越调":"越调超清", + "河南曲剧":"河南曲剧超清", + "山东梆子":"山东梆子超清", + "淮剧":"淮剧超清", + "滑稽戏":"滑稽戏超清", + "婺剧":"婺剧超清", + "绍剧":"绍剧超清", + "徽剧":"徽剧超清", + "雁剧":"雁剧超清", + "上党梆子":"上党梆子超清", + "秦腔":"秦腔超清", + "武安平调":"武安平调超清", + "二人台":"二人台超清", + "吉剧":"吉剧超清", + "高腔":"高腔超清" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/球队球星.py b/py/plugin/球队球星.py new file mode 100644 index 0000000..b87e340 --- /dev/null +++ b/py/plugin/球队球星.py @@ -0,0 +1,289 @@ +#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 = { + "梅西":"梅西", +"C罗":"C罗", +"天下足球":"天下足球", + "罗纳尔多":"罗纳尔多", + "亨利":"亨利", + "小罗":"小罗", + "齐达内":"齐达内", + "贝克汉姆":"贝克汉姆", + "内马尔":"内马尔", + "德布劳内":"德布劳内", + "欧冠":"欧冠", + "世界杯":"世界杯", + "西甲":"西甲", + "英超":"英超", + "意甲":"意甲", + "德甲":"德甲", + "国米":"国米", + "皇马":"皇马", + "巴萨":"巴萨", + "巴黎圣日耳曼":"巴黎圣日耳曼", + "曼联":"曼联", + "曼城":"曼城", + "NBA":"NBA", + "詹姆斯":"詹姆斯", + "库里":"库里", + "杜兰特":"杜兰特", + "UFC":"UFC", + "斯诺克":"斯诺克", + "网球":"网球", + "F1":"F1", + "高尔夫":"高尔夫" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/相声小品.py b/py/plugin/相声小品.py new file mode 100644 index 0000000..49675f9 --- /dev/null +++ b/py/plugin/相声小品.py @@ -0,0 +1,282 @@ +#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 = { + "单口相声":"单口相声", + "群口相声":"群口相声", + "德云社":"德云社", + "青曲社":"青曲社", + "郭德纲":"郭德纲", + "岳云鹏":"岳云鹏", + "曹云金":"曹云金", + "评书":"评书", + "小曲":"小曲", + "二人转":"二人转", + "春晚小品":"春晚小品", + "赵本山":"赵本山", + "陈佩斯":"陈佩斯", + "冯巩":"冯巩", + "宋小宝":"宋小宝", + "赵丽蓉":"赵丽蓉", + "郭达":"郭达", + "潘长江":"潘长江", + "郭冬临":"郭冬临", + "严顺开":"严顺开", + "文松":"文松", + "开心麻花":"开心麻花", + "屌丝男士":"屌丝男士", + "喜剧综艺":"喜剧综艺" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/美女热舞.py b/py/plugin/美女热舞.py new file mode 100644 index 0000000..644d3b0 --- /dev/null +++ b/py/plugin/美女热舞.py @@ -0,0 +1,292 @@ +#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 = { + "古风舞蹈":"古风舞蹈", +"印度歌舞":"印度歌舞", +"明星舞蹈":"明星舞蹈", +"韩舞":"韩舞", +"古典舞":"古典舞", +"翻跳":"翻跳", +"中国舞":"中国舞", +"古风舞":"古风舞", +"现代舞":"现代舞", +"爵士舞":"爵士舞", +"芭蕾":"芭蕾", +"编舞":"编舞", +"POPPING":"POPPING", +"极乐净土":"极乐净土", +"桃源恋歌":"桃源恋歌", +"新宝岛":"新宝岛", +"拉丁舞":"拉丁舞", +"蹦迪":"蹦迪", +"民族舞":"民族舞", +"抖肩舞":"抖肩舞", +"齐舞":"齐舞", +"机械舞":"机械舞", +"广场舞":"广场舞", +"BDF":"BDF", +"抖音合集":"抖音合集", +"快手美女合集":"快手美女合集", +"练习室":"练习室", +"美女舞蹈":"美女舞蹈", +"牛仔裤":"牛仔裤", +"黑丝":"黑丝", +"超短裤":"超短裤", +"超短裙":"超短裙", +"舞蹈综合":"舞蹈综合", +"舞蹈教程":"舞蹈教程" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/美食合集.json b/py/plugin/美食合集.json new file mode 100644 index 0000000..721c682 --- /dev/null +++ b/py/plugin/美食合集.json @@ -0,0 +1,4 @@ +{"classes":[ +{"type_name":"美食","type_id":"美食超清"},{"type_name":"披萨","type_id":"披萨超清"},{"type_name":"火锅","type_id":"火锅超清"},{"type_name":"烧烤","type_id":"烧烤超清"},{"type_name":"烤鱼","type_id":"烤鱼超清"},{"type_name":"海鲜","type_id":"海鲜超清"},{"type_name":"津菜","type_id":"津菜超清"},{"type_name":"川菜","type_id":"川菜超清"},{"type_name":"湘菜","type_id":"湘菜超清"},{"type_name":"鲁菜","type_id":"鲁菜超清"},{"type_name":"苏菜","type_id":"苏菜超清"},{"type_name":"闽菜","type_id":"闽菜超清"},{"type_name":"粤菜","type_id":"粤菜"},{"type_name":"东北菜","type_id":"东北菜超清"},{"type_name":"冀菜","type_id":"冀菜超清"},{"type_name":"豫菜","type_id":"豫菜超清"},{"type_name":"鄂菜","type_id":"鄂菜超清"},{"type_name":"本帮菜","type_id":"本帮菜超清"},{"type_name":"客家菜","type_id":"客家菜超清"},{"type_name":"赣菜","type_id":"赣菜超清"},{"type_name":"京菜","type_id":"京菜超清"},{"type_name":"浙菜","type_id":"浙菜超清"},{"type_name":"徽菜","type_id":"徽菜超清"},{"type_name":"湘菜","type_id":"湘菜超清"},{"type_name":"凉菜","type_id":"凉菜超清"},{"type_name":"蒸菜","type_id":"蒸菜超清"},{"type_name":"日料","type_id":"日料超清"},{"type_name":"点心","type_id":"点心超清"},{"type_name":"面食","type_id":"面食超清"},{"type_name":"汉堡","type_id":"汉堡超清"},{"type_name":"小吃","type_id":"小吃超清"},{"type_name":"素食","type_id":"素食超清"},{"type_name":"韩国菜","type_id":"韩国菜超清"},{"type_name":"泰国菜","type_id":"泰国菜超清"},{"type_name":"穆斯林菜","type_id":"穆斯林菜超清"},{"type_name":"土耳其菜系","type_id":"土耳其菜系超清"},{"type_name":"法国菜","type_id":"法国菜超清"},{"type_name":"意大利菜","type_id":"意大利菜超清"},{"type_name":"希腊菜","type_id":"希腊菜超清"},{"type_name":"德国菜","type_id":"德国菜超清"},{"type_name":"西班牙菜","type_id":"西班牙菜超清"},{"type_name":"阿拉伯菜","type_id":"阿拉伯菜超清"},{"type_name":"伊朗菜","type_id":"伊朗菜超清"},{"type_name":"中亚菜","type_id":"中亚菜超清"},{"type_name":"糖尿病菜","type_id":"糖尿病菜超清"},{"type_name":"早餐","type_id":"早餐超清"}], + "cookie":"_uuid=5E4B2B98-1014A-84D8-FA33-EC210C5BEC10DA82367infoc; buvid3=E9D0A426-85E9-E6C7-C75E-206A3E1BEB4D81910infoc; b_nut=1666168082; buvid4=4FC87B9C-3540-2275-688C-8612D3EA719B81910-022101916-ZLe640jXRAMHySuaCe9aUw==; rpdid=|(k|u)YYm)uY0J'uYYYuY)uuu; i-wanna-go-back=-1; fingerprint=9c214a6da0197a48e576ccf22e9f0ac7; buvid_fp_plain=undefined; nostalgia_conf=-1; DedeUserID=3493076028885079; DedeUserID__ckMd5=60a8757a1f4d6ae9; buvid_fp=9c214a6da0197a48e576ccf22e9f0ac7; CURRENT_QUALITY=80; b_ut=5; PVID=2; bp_video_offset_3493076028885079=undefined; bsource=search_google; SESSDATA=42b8ada6,1683277266,4bd05*b2; bili_jct=2dbe39aea02b41324395630a24d4775f; sid=89gnel66; innersign=0; b_lsid=9EF63922_1844D55A286; CURRENT_FNVAL=4048", +"filter":{"美食":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]},{"key":"tid","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":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]}],"披萨":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]},{"key":"tid","name":"分类","value":[{"n":"全部","v":"披萨"},{"n":"选材","v":"披萨选材"},{"n":"制作","v":"披萨制作"}]}],"川菜":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]}],"日料":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]}],"湘菜":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]}],"早餐":[{"key":"order","name":"排序","value":[{"n":"综合排序","v":"0"},{"n":"最多点击","v":"click"},{"n":"最新发布","v":"pubdate"},{"n":"最多弹幕","v":"dm"},{"n":"最多收藏","v":"stow"}]},{"key":"duration","name":"时长","value":[{"n":"全部时长","v":"0"},{"n":"60分钟以上","v":"4"},{"n":"30~60分钟","v":"3"},{"n":"10~30分钟","v":"2"},{"n":"10分钟以下","v":"1"}]}]}} diff --git a/py/plugin/美食合集.py b/py/plugin/美食合集.py new file mode 100644 index 0000000..e3dcff0 --- /dev/null +++ b/py/plugin/美食合集.py @@ -0,0 +1,305 @@ +#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 = { +"美食":"美食", +"披萨":"披萨", +"火锅":"火锅", +"烧烤":"烧烤", +"烤鱼":"烤鱼", +"海鲜":"海鲜", +"津菜":"津菜", +"川菜":"川菜", +"湘菜":"湘菜", +"鲁菜":"鲁菜", +"苏菜":"苏菜", +"闽菜":"闽菜", +"粤菜":"粤菜", +"东北菜":"东北菜", +"冀菜":"冀菜", +"豫菜":"豫菜", +"鄂菜":"鄂菜", +"本帮菜":"本帮菜", +"客家菜":"客家菜", +"赣菜":"赣菜", +"京菜":"京菜", +"浙菜":"浙菜", +"徽菜":"徽菜", +"湘菜":"湘菜", +"凉菜":"凉菜", +"蒸菜":"蒸菜", +"日料":"日料", +"点心":"点心", +"面食":"面食", +"汉堡":"汉堡", +"小吃":"小吃", +"素食":"素食", +"韩国菜":"韩国菜", +"泰国菜":"泰国菜", +"穆斯林菜":"穆斯林菜", +"土耳其菜系":"土耳其菜系", +"法国菜":"法国菜", +"意大利菜":"意大利菜", +"希腊菜":"希腊菜", +"德国菜":"德国菜", +"西班牙菜":"西班牙菜", +"阿拉伯菜":"阿拉伯菜", +"伊朗菜":"伊朗菜", +"中亚菜":"中亚菜", +"糖尿病菜":"糖尿病菜", +"早餐":"早餐" + + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/软件教程.py b/py/plugin/软件教程.py new file mode 100644 index 0000000..4b77667 --- /dev/null +++ b/py/plugin/软件教程.py @@ -0,0 +1,279 @@ +#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 "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 = { + "WPS文字":"WPS文字", + "WPS表格":"WPS表格", + "WPS演示":"WPS演示", + "word":"word", + "PPT":"PPT", + "MT管理器":"MT管理器", +"网盘挂载":"网盘挂载", + "EXCEL":"EXCEL", +"Git入门到精通":"Git入门到精通", +"java":"java", +"phyton":"phyton", +"xml":"xml", +"PR":"PR", +"AE":"AE", +"C4D":"C4D", +"alist+WebDav":"alist+WebDav","Photoshop":"Photoshop", + "EXCEL":"EXCEL", + "office":"office", + "WPS":"WPS", + "Studioone":"Studioone", + "声卡调试":"声卡调试" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""] diff --git a/py/plugin/音乐合集.py b/py/plugin/音乐合集.py new file mode 100644 index 0000000..71d696b --- /dev/null +++ b/py/plugin/音乐合集.py @@ -0,0 +1,282 @@ +#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 "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 = { + "粤语":"粤语歌曲超清", + "2022年热榜":"2022年热们歌曲", + "经典老歌":"经典老歌", + "古风歌曲":"古风歌曲", + "闽南语歌曲":"闽南语歌曲", + "印度歌舞":"印度歌舞", + "8K":"8K", + "4K杜比视界":"4K杜比视界", + "4K":"4K", + "黑胶":"黑胶", + "MV":"MV", + "4K小姐姐":"4K小姐姐", + "超清小姐姐":"超清小姐姐", + "经典粤语":"经典粤语", + "经典老歌":"经典老歌", + "宝华音乐台":"宝华音乐台", + "翻唱":"翻唱", + "张学友":"张学友", + "伍佰":"伍佰", + "陈奕迅":"陈奕迅", + "演唱会":"演唱会", + "欧美金曲":"欧美金曲", + "日韩MV":"日韩MV", + "DJ":"DJ" + } + 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 = "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" + 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 = {} + + url= 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=all&page={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']['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 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 categoryContent(self,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) + 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": {} + } + header = {} + + def localProxy(self,param): + return [200, "video/MP2T", action, ""]