Merge pull request 'master' (#1) from comeonbaby0122/Q:master into master

Reviewed-on: https://agit.ai/zzzlllmmm1/Q/pulls/1
This commit is contained in:
zzzlllmmm1 2022-09-27 11:50:25 +00:00
commit 146388758c
6 changed files with 457 additions and 2444 deletions

1950
TV/Q.json

File diff suppressed because one or more lines are too long

View File

@ -543,95 +543,6 @@ SING女团】《风陵渡口》歌词版PV[640*360],https://vdse.bdstatic.com//a
怀旧金曲:刀郎《黄玫瑰》[960*544],https://vdse.bdstatic.com//893331fdfab5d04e5c93e2adbbf1e949.mp4 怀旧金曲:刀郎《黄玫瑰》[960*544],https://vdse.bdstatic.com//893331fdfab5d04e5c93e2adbbf1e949.mp4
《那一夜》谢军[640*360],https://vdse.bdstatic.com//da6d866213a8bce7b317f508cf702e2e.mp4 《那一夜》谢军[640*360],https://vdse.bdstatic.com//da6d866213a8bce7b317f508cf702e2e.mp4
狼爪•央视频道,#genre#
CCTV-1综合高清,rtsp://221.203.83.34:554/PLTV/88888888/224/0/3221226118/iptv65795.smil
CCTV-1综合高清,http://182.151.211.171:808/hls/1/index.m3u8$1920*1080
CCTV-1综合高清,http://183.207.249.15/PLTV/3/224/3221225530/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.32.101:6610/270000001111/1110000023/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://111.40.196.27/PLTV/88888888/224/3221225548/index.m3u8$1280*720
CCTV-1综合高清,http://111.40.196.9/PLTV/88888888/224/3221225548/index.m3u8$1280*720
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.58:18890/PLTV/88888910/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.32.101:6610/270000001111/1110000151/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://59.49.41.44/live.aishang.ctlcdn.com/00000110240127_1/playlist.m3u8?CONTENTID=00000110240127_1$1920*1080
CCTV-1综合高清,http://39.136.48.7:8089/PLTV/88888888/224/3221225859/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.66.110/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.136.48.18:8089/PLTV/88888888/224/3221225859/index.m3u8$1920*1080
CCTV-1综合高清,http://183.207.249.9/PLTV/3/224/3221225530/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.115.163:8080/PLTV/88888910/224/3221225630/index.m3u8$1280*720
CCTV-1综合高清,http://39.134.32.102:6610/270000001111/1110000301/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://115.182.96.25/gitv_live/CCTV-1-HD/CCTV-1-HD.m3u8?p=GITV&area=AH_CMCC$1920*1080
CCTV-1综合高清,http://39.134.32.103:6610/270000001111/1110000301/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://219.151.31.38/liveplay-kk.rtxapp.com/live/program/live/CCTV-1综合高清hd/4000000/mnf.m3u8$1920*1080
CCTV-1综合高清,http://39.136.48.5:8089/PLTV/88888888/224/3221225859/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.67.99/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.67.98/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.60:18890/PLTV/88888910/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://111.13.42.238/PLTV/88888888/224/3221226564/1.m3u8?icpid=88888888&from=1&hms_devid=461$1280*720
CCTV-1综合高清,http://39.134.115.163:8080/PLTV/88888910/224/3221225642/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.32.101:6610/270000001111/1110000301/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://39.134.65.181/PLTV/88888888/224/3221225816/1.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225630/index.m3u8$1280*720
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225918/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225642/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225762/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225762/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.32.103:6610/270000001111/1110000151/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://39.134.32.108:6610/270000001111/1110000301/index.m3u8?IASHttpSessionId=OTT$1920*1080
CCTV-1综合高清,http://183.207.249.9/PLTV/3/224/3221225530/1.m3u8$1920*1080
CCTV-1综合高清,http://39.136.48.2:8089/PLTV/88888888/224/3221225859/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225642/index.m3u8$1920*1080
CCTV-1综合高清,http://111.13.42.238/PLTV/88888888/224/3221226563/1.m3u8?icpid=88888888&from=1&hms_devid=461$1280*720
CCTV-1综合高清,http://120.253.104.16:808/hls/1/index.m3u8$1920*1080
CCTV-1综合高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225918/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.116.30:8080/PLTV/88888910/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.59:18890/PLTV/88888910/224/3221225918/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.65.141/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.67.226/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.116.30:8080/PLTV/88888910/224/3221225762/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.59:18890/PLTV/88888910/224/3221225642/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.116.30:8080/PLTV/88888910/224/3221225918/index.m3u8$1920*1080
CCTV-1综合高清,http://39.134.65.142/PLTV/88888888/224/3221225816/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.58:18890/PLTV/88888910/224/3221225762/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.59:18890/PLTV/88888910/224/3221225618/index.m3u8$1920*1080
CCTV-1综合高清,http://39.135.138.59:18890/PLTV/88888910/224/3221225630/index.m3u8$1280*720
CCTV-1综合高清,http://59.49.41.41/live.aishang.ctlcdn.com/00000110240127_1/playlist.m3u8?CONTENTID=00000110240127_1$1920*1080
CCTV-1综合高清,http://39.134.116.30:8080/PLTV/88888910/224/3221225630/index.m3u8$1280*720
CCTV-1综合高清,http://39.135.138.58:18890/PLTV/88888888/224/3221225762/index.m3u8$1920*1080
CCTV-2财经高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226584/10000100000000060000000000499223_0.smil
CCTV-3综艺高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226726/10000100000000060000000006489752_0.smil
CCTV-4中文国际高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226601/10000100000000060000000000755997_0.smil
CCTV-4欧洲高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226741/10000100000000060000000006582740_0.smil
CCTV-4美洲高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226762/10000100000000060000000006582745_0.smil
CCTV-5体育高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226707/10000100000000060000000006489753_0.smil
CCTV-6电影高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226728/10000100000000060000000006489754_0.smil
CCTV-7国防军事高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226531/10000100000000060000000000499224_0.smil
CCTV-8电视剧高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226730/10000100000000060000000006489755_0.smil
CCTV-9记录高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226588/10000100000000060000000000499231_0.smil
CCTV-10科教高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226586/10000100000000060000000000499225_0.smil
CCTV-11戏曲高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226727/10000100000000060000000006519577_0.smil
CCTV-12社会与法高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226533/10000100000000060000000000499226_0.smil
CCTV-13新闻高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226691/10000100000000060000000006385281_0.smil
CCTV-14少儿高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226529/10000100000000060000000000499222_0.smil
CCTV-15音乐高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226744/10000100000000060000000006519578_0.smil
CCTV-16奥林匹克高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226747/10000100000000060000000006758792_0.smil
CCTV-17农村农业高清,http://39.134.52.153/hwottcdn.ln.chinamobile.com/PLTV/88888888/224/3221226841/index.m3u8
CCTV-5+体育赛事高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226743/10000100000000060000000006603048_0.smil
CCTV-第一剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226698/10000100000000060000000006385142_0.smil
CCTV-怀旧剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226700/10000100000000060000000006385151_0.smil
CCTV-风云剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226671/10000100000000060000000006385152_0.smil
CCTV-风云音乐高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226718/10000100000000060000000006385496_0.smil
CCTV-女性时尚高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226675/10000100000000060000000006385156_0.smil
CCTV-风云足球高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226702/10000100000000060000000006385159_0.smil
CCTV-央视文化精品高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226677/10000100000000060000000006385162_0.smil
CCTV-兵器科技高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226704/10000100000000060000000006385167_0.smil
CCTV-央视台球高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226706/10000100000000060000000006385172_0.smil
CCTV-世界地理高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226679/10000100000000060000000006385175_0.smil
CCTV-电视指南高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226708/10000100000000060000000006385178_0.smil
CGTN-高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226756/10000100000000060000000006569861_0.smil
CGTN-记录频道高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226758/10000100000000060000000006569863_0.smil
狼爪•央视蓝光,#genre# 狼爪•央视蓝光,#genre#
CCTV1[1920•1080],http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225618/index.m3u8 CCTV1[1920•1080],http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225618/index.m3u8
CCTV1[1920•1080],http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225918/index.m3u8 CCTV1[1920•1080],http://hwrr.jx.chinamobile.com:8080/PLTV/88888888/224/3221225918/index.m3u8
@ -643,7 +554,6 @@ CCTV1[1920•1080],http://39.134.65.179/PLTV/88888888/224/3221225816/index.m3u8
CCTV1[1920•1080],http://39.134.65.181/PLTV/88888888/224/3221225816/index.m3u8 CCTV1[1920•1080],http://39.134.65.181/PLTV/88888888/224/3221225816/index.m3u8
CCTV1[1920•1080],http://39.134.67.7:80/ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226016/index.m3u8 CCTV1[1920•1080],http://39.134.67.7:80/ottrrs.hl.chinamobile.com/PLTV/88888888/224/3221226016/index.m3u8
CCTV1[1920•1080],http://117.148.179.155/PLTV/88888888/224/3221231468/1.m3u8 CCTV1[1920•1080],http://117.148.179.155/PLTV/88888888/224/3221231468/1.m3u8
CCTV2[1920•1080],http://39.135.138.58:18890/PLTV/88888888/224/3221225619/index.m3u8
CCTV2[1920•1080],http://117.148.179.147/PLTV/88888888/224/3221231678/1.m3u8 CCTV2[1920•1080],http://117.148.179.147/PLTV/88888888/224/3221231678/1.m3u8
CCTV-2财经高清,http://39.136.48.6:8089/PLTV/88888888/224/3221225751/index.m3u8$1920*1080 CCTV-2财经高清,http://39.136.48.6:8089/PLTV/88888888/224/3221225751/index.m3u8$1920*1080
CCTV-2财经高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225643/index.m3u8$1920*1080 CCTV-2财经高清,http://hwrr.jx.chinamobile.com:8080/PLTV/88888910/224/3221225643/index.m3u8$1920*1080
@ -941,6 +851,17 @@ CCTV17[1920•1080],http://39.134.66.46/PLTV/88888888/224/3221225708/index.m3u8
CCTV17[1920•1080],http://39.134.65.181/PLTV/88888888/224/3221225708/index.m3u8 CCTV17[1920•1080],http://39.134.65.181/PLTV/88888888/224/3221225708/index.m3u8
CCTV17[1920•1080],http://39.134.65.183/PLTV/88888888/224/3221225708/index.m3u8 CCTV17[1920•1080],http://39.134.65.183/PLTV/88888888/224/3221225708/index.m3u8
CCTV17[1920•1080],http://117.148.179.167/PLTV/88888888/224/3221231772/1.m3u8 CCTV17[1920•1080],http://117.148.179.167/PLTV/88888888/224/3221231772/1.m3u8
CCTV-第一剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226698/10000100000000060000000006385142_0.smil
CCTV-怀旧剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226700/10000100000000060000000006385151_0.smil
CCTV-风云剧场高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226671/10000100000000060000000006385152_0.smil
CCTV-风云音乐高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226718/10000100000000060000000006385496_0.smil
CCTV-女性时尚高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226675/10000100000000060000000006385156_0.smil
CCTV-风云足球高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226702/10000100000000060000000006385159_0.smil
CCTV-央视文化精品高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226677/10000100000000060000000006385162_0.smil
CCTV-兵器科技高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226704/10000100000000060000000006385167_0.smil
CCTV-央视台球高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226706/10000100000000060000000006385172_0.smil
CCTV-世界地理高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226679/10000100000000060000000006385175_0.smil
CCTV-电视指南高清,rtsp://221.203.83.34:554/PLTV/88888888/224/3221226708/10000100000000060000000006385178_0.smil
狼爪•香港频道,#genre# 狼爪•香港频道,#genre#
凤凰中文,http://play-live.ifeng.com/live/06OLEGEGM4G.m3u8 凤凰中文,http://play-live.ifeng.com/live/06OLEGEGM4G.m3u8

BIN
jar/LZ0328.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,405 +1,445 @@
#coding=utf-8 #coding=utf-8
#!/usr/bin/python #!/usr/bin/python
import sys import sys
sys.path.append('..') sys.path.append('..')
from base.spider import Spider from base.spider import Spider
import json import json
import requests import requests
import time import time
import re import re
class Spider(Spider): # 元类 默认的元类 type class Spider(Spider): # 元类 默认的元类 type
def getName(self): def getName(self):
return "阿里云盘" return "阿里云盘"
def init(self,extend=""): def init(self,extend=""):
print("============{0}============".format(extend)) print("============{0}============".format(extend))
pass pass
def homeContent(self,filter): def homeContent(self,filter):
result = {} result = {}
return result return result
def homeVideoContent(self): def homeVideoContent(self):
result = {} result = {}
return result return result
def categoryContent(self,tid,pg,filter,extend): def categoryContent(self,tid,pg,filter,extend):
result = {} result = {}
return result return result
def searchContent(self,key,quick): def searchContent(self,key,quick):
result = {} result = {}
return result return result
def isVideoFormat(self,url): def isVideoFormat(self,url):
pass pass
def manualVideoCheck(self): def manualVideoCheck(self):
pass pass
def playerContent(self,flag,id,vipFlags): def playerContent(self,flag,id,vipFlags):
if flag == 'AliYun': if flag == 'AliYun':
return self.originContent(flag,id,vipFlags) return self.originContent(flag,id,vipFlags)
elif flag == 'AliYun原画': elif flag == 'AliYun原画':
return self.fhdContent(flag,id,vipFlags) return self.fhdContent(flag,id,vipFlags)
else: else:
return {} return {}
def fhdContent(self,flag,id,vipFlags): def fhdContent(self,flag,id,vipFlags):
self.login() if not self.login():
ids = id.split('+') return {}
shareId = ids[0] ids = id.split('+')
shareToken = ids[1] shareId = ids[0]
fileId = ids[2] shareToken = ids[1]
category = ids[3] fileId = ids[2]
url = self.getDownloadUrl(shareId,shareToken,fileId,category) category = ids[3]
print(url) subtitle = ids[4]
url = self.getDownloadUrl(shareId,shareToken,fileId,category)
noRsp = requests.get(url,headers=self.header, allow_redirects=False,verify = False)
realUrl = '' noRsp = requests.get(url,headers=self.header, allow_redirects=False,verify = False)
if 'Location' in noRsp.headers: realUrl = ''
realUrl = noRsp.headers['Location'] if 'Location' in noRsp.headers:
if 'location' in noRsp.headers and len(realUrl) == 0 : realUrl = noRsp.headers['Location']
realUrl = noRsp.headers['location'] if 'location' in noRsp.headers and len(realUrl) == 0 :
newHeader = { realUrl = noRsp.headers['location']
"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36", newHeader = {
"referer":"https://www.aliyundrive.com/", "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36",
} "referer":"https://www.aliyundrive.com/",
result = { }
'parse':'0', subtitleUrl = self.subtitleContent(id)
'playUrl':'', result = {
'url':realUrl, 'parse':'0',
'header':newHeader 'playUrl':'',
} 'url':realUrl,
return result 'header':newHeader,
def originContent(self,flag,id,vipFlags): 'subt':subtitleUrl
self.login() }
ids = id.split('+') return result
shareId = ids[0] def subtitleContent(self,id):
shareToken = ids[1] ids = id.split('+')
fileId = ids[2] shareId = ids[0]
url = '{0}?do=push_agent&api=python&type=m3u8&share_id={1}&file_id={2}'.format(self.localProxyUrl,shareId,fileId) shareToken = ids[1]
fileId = ids[2]
result = { category = ids[3]
'parse':'0', subtitle = ids[4]
'playUrl':'', if len(subtitle) == 0:
'url':url, return ""
'header':''
} customHeader = self.header.copy()
customHeader['x-share-token'] = shareToken
# shareToken = self.getToken(shareId,'') customHeader['authorization'] = self.authorization
# self.getMediaSlice(shareId,shareToken,fileId)
jo = {
"expire_sec": 600,
# map = { "share_id": shareId,
# 'share_id':'p1GJYEqgeb2', "file_id": subtitle,
# 'file_id':'62ed1b95b1048d60ffc246669f5e0999e90b8c2f', "image_url_process": "image/resize,w_1920/format,jpeg",
# 'media_id':'1' "image_thumbnail_process": "image/resize,w_1920/format,jpeg",
# } "get_streams_url": True
# ,
# self.proxyMedia(map) # "drive_id": "183237630"
}
return result
downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url'
def detailContent(self,array): resultJo = requests.post(downloadUrl,json = jo,headers=customHeader).json()
tid = array[0] print(resultJo)
# shareId = self.regStr(href,'www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?') noRsp = requests.get(resultJo['download_url'],headers=self.header, allow_redirects=False,verify = False)
# todo ========================================================================================= realUrl = ''
m = re.search('www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?', tid) if 'Location' in noRsp.headers:
col = m.groups() realUrl = noRsp.headers['Location']
shareId = col[0] if 'location' in noRsp.headers and len(realUrl) == 0 :
fileId = col[2] realUrl = noRsp.headers['location']
return realUrl
infoUrl = 'https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous'
def originContent(self,flag,id,vipFlags):
infoForm = {'share_id':shareId} if not self.login():
infoRsp = requests.post(infoUrl,json = infoForm,headers=self.header) return {}
infoJo = json.loads(infoRsp.text) ids = id.split('+')
shareId = ids[0]
infoJa = [] shareToken = ids[1]
if 'file_infos' in infoJo: fileId = ids[2]
infoJa = infoJo['file_infos'] subtitle = ids[4]
if len(infoJa) <= 0 : url = '{0}?do=push_agent&api=python&type=m3u8&share_id={1}&file_id={2}'.format(self.localProxyUrl,shareId,fileId)
return '' subtitleUrl = self.subtitleContent(id)
fileInfo = {} newHeader = {
# todo "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36",
fileInfo = infoJa[0] "referer":"https://www.aliyundrive.com/",
print(fileId) }
if fileId == None or len(fileId) <= 0: result = {
fileId = fileInfo['file_id'] 'parse':'0',
'playUrl':'',
vodList = { 'url':url,
'vod_id':tid, 'header':newHeader,
'vod_name':infoJo['share_name'], 'subt':subtitleUrl
'vod_pic':infoJo['avatar'], }
'vod_content':tid, return result
'vod_play_from':'AliYun原画'
} def detailContent(self,array):
fileType = fileInfo['type'] tid = array[0]
if fileType != 'folder': m = re.search('www.aliyundrive.com\\/s\\/([^\\/]+)(\\/folder\\/([^\\/]+))?', tid)
if fileType != 'file' or fileInfo['category'] != video: col = m.groups()
return '' shareId = col[0]
fileId = 'root' fileId = col[2]
shareToken = self.getToken(shareId,'') infoUrl = 'https://api.aliyundrive.com/adrive/v3/share_link/get_share_by_anonymous'
hashMap = {}
self.listFiles(hashMap,shareId,shareToken,fileId) infoForm = {'share_id':shareId}
infoRsp = requests.post(infoUrl,json = infoForm,headers=self.header)
sortedMap = sorted(hashMap.items(), key=lambda x: x[0]) infoJo = json.loads(infoRsp.text)
arrayList = []
playList = [] infoJa = []
if 'file_infos' in infoJo:
for sm in sortedMap: infoJa = infoJo['file_infos']
arrayList.append(sm[0]+'$'+sm[1]) if len(infoJa) <= 0 :
playList.append('#'.join(arrayList)) return ''
playList.append('#'.join(arrayList)) fileInfo = {}
vodList['vod_play_url'] = '$$$'.join(playList)
fileInfo = infoJa[0]
result = {
'list':[vodList] if fileId == None or len(fileId) <= 0:
} fileId = fileInfo['file_id']
return result
vodList = {
authorization = '' 'vod_id':tid,
timeoutTick = 0 'vod_name':infoJo['share_name'],
localTime = 0 'vod_pic':infoJo['avatar'],
expiresIn = 0 'vod_content':tid,
shareTokenMap = {} 'vod_play_from':'AliYun$$$AliYun原画'
expiresMap = {} }
localMedia = {} fileType = fileInfo['type']
header = { if fileType != 'folder':
"Referer":"https://www.aliyundrive.com/", if fileType != 'file' or fileInfo['category'] != video:
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36" return ''
} fileId = 'root'
localProxyUrl = 'http://127.0.0.1:UndCover/proxy'
shareToken = self.getToken(shareId,'')
def redirectResponse(tUrl): hashMap = {}
rsp = requests.get(tUrl, allow_redirects=False,verify = False) self.listFiles(hashMap,shareId,shareToken,fileId)
if 'Location' in rsp.headers:
return redirectResponse(rsp.headers['Location']) sortedMap = sorted(hashMap.items(), key=lambda x: x[0])
else: arrayList = []
return rsp playList = []
def getDownloadUrl(self,shareId,token,fileId,category): for sm in sortedMap:
lShareId = shareId arrayList.append(sm[0]+'$'+sm[1])
lFileId = fileId playList.append('#'.join(arrayList))
params = { playList.append('#'.join(arrayList))
"share_id": lShareId, vodList['vod_play_url'] = '$$$'.join(playList)
"category": "live_transcoding",
"file_id": lFileId, result = {
"template_id": "" 'list':[vodList]
} }
customHeader = self.header.copy() return result
customHeader['x-share-token'] = token
customHeader['authorization'] = self.authorization authorization = ''
url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' timeoutTick = 0
if category == 'video': localTime = 0
rsp = requests.post(url,json = params,headers=customHeader) expiresIn = 0
rspJo = json.loads(rsp.text) shareTokenMap = {}
lShareId = rspJo['share_id'] expiresMap = {}
lFileId = rspJo['file_id'] localMedia = {}
jo = { header = {
"Referer":"https://www.aliyundrive.com/",
} "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36"
if category == 'video': }
jo['share_id'] = lShareId localProxyUrl = 'http://127.0.0.1:UndCover/proxy'
jo['file_id'] = lFileId
jo['expire_sec'] = 600 def redirectResponse(tUrl):
if category == 'audio': rsp = requests.get(tUrl, allow_redirects=False,verify = False)
jo['share_id'] = lShareId if 'Location' in rsp.headers:
jo['file_id'] = lFileId return redirectResponse(rsp.headers['Location'])
jo['get_audio_play_info'] = True else:
downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url' return rsp
downloadRsp = requests.post(downloadUrl,json = jo,headers=customHeader)
resultJo = json.loads(downloadRsp.text) def getDownloadUrl(self,shareId,token,fileId,category):
return resultJo['download_url'] lShareId = shareId
lFileId = fileId
def getMediaSlice(self,shareId,token,fileId): params = {
params = { "share_id": lShareId,
"share_id": shareId, "category": "live_transcoding",
"category": "live_transcoding", "file_id": lFileId,
"file_id": fileId, "template_id": ""
"template_id": "" }
} customHeader = self.header.copy()
customHeader = self.header.copy() customHeader['x-share-token'] = token
customHeader['x-share-token'] = token customHeader['authorization'] = self.authorization
customHeader['authorization'] = self.authorization url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info'
url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info' if category == 'video':
rsp = requests.post(url,json = params,headers=customHeader)
rsp = requests.post(url,json = params,headers=customHeader) rspJo = json.loads(rsp.text)
rspJo = json.loads(rsp.text) lShareId = rspJo['share_id']
lFileId = rspJo['file_id']
quality = ['FHD','HD','SD'] jo = {
videoList = rspJo['video_preview_play_info']['live_transcoding_task_list']
highUrl = '' }
for q in quality: if category == 'video':
if len(highUrl) > 0: jo['share_id'] = lShareId
break jo['file_id'] = lFileId
for video in videoList: jo['expire_sec'] = 600
if(video['template_id'] == q): if category == 'audio':
highUrl = video['url'] jo['share_id'] = lShareId
break jo['file_id'] = lFileId
if len(highUrl) == 0: jo['get_audio_play_info'] = True
highUrl = videoList[0]['url'] downloadUrl = 'https://api.aliyundrive.com/v2/file/get_share_link_download_url'
downloadRsp = requests.post(downloadUrl,json = jo,headers=customHeader)
noRsp = requests.get(highUrl,headers=self.header, allow_redirects=False,verify = False) resultJo = json.loads(downloadRsp.text)
m3u8Url = '' return resultJo['download_url']
if 'Location' in noRsp.headers:
m3u8Url = noRsp.headers['Location'] def getMediaSlice(self,shareId,token,fileId):
if 'location' in noRsp.headers and len(m3u8Url) == 0 : params = {
m3u8Url = noRsp.headers['location'] "share_id": shareId,
m3u8Rsp = requests.get(m3u8Url,headers=self.header) "category": "live_transcoding",
m3u8Content = m3u8Rsp.text "file_id": fileId,
"template_id": ""
tmpArray = m3u8Url.split('/')[0:-1] }
host = '/'.join(tmpArray) + '/' customHeader = self.header.copy()
customHeader['x-share-token'] = token
m3u8List = [] customHeader['authorization'] = self.authorization
mediaMap = {} url = 'https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info'
slices = m3u8Content.split("\n")
count = 0 rsp = requests.post(url,json = params,headers=customHeader)
for slice in slices: rspJo = json.loads(rsp.text)
tmpSlice = slice
if 'x-oss-expires' in tmpSlice: quality = ['FHD','HD','SD']
count = count + 1 videoList = rspJo['video_preview_play_info']['live_transcoding_task_list']
mediaMap[str(count)] = host+tmpSlice highUrl = ''
for q in quality:
tmpSlice = "{0}?do=push_agent&api=python&type=media&share_id={1}&file_id={2}&media_id={3}".format(self.localProxyUrl,shareId,fileId,count) if len(highUrl) > 0:
m3u8List.append(tmpSlice) break
for video in videoList:
self.localMedia[fileId] = mediaMap if(video['template_id'] == q):
highUrl = video['url']
return '\n'.join(m3u8List) break
if len(highUrl) == 0:
def proxyMedia(self,map): highUrl = videoList[0]['url']
shareId = map['share_id']
fileId = map['file_id'] noRsp = requests.get(highUrl,headers=self.header, allow_redirects=False,verify = False)
mediaId = map['media_id'] m3u8Url = ''
shareToken = self.getToken(shareId,'') if 'Location' in noRsp.headers:
m3u8Url = noRsp.headers['Location']
refresh = False if 'location' in noRsp.headers and len(m3u8Url) == 0 :
url = '' m3u8Url = noRsp.headers['location']
ts = 0 m3u8Rsp = requests.get(m3u8Url,headers=self.header)
if fileId in self.localMedia: m3u8Content = m3u8Rsp.text
fileMap = self.localMedia[fileId]
if mediaId in fileMap: tmpArray = m3u8Url.split('/')[0:-1]
url = fileMap[mediaId] host = '/'.join(tmpArray) + '/'
if len(url) > 0:
ts = int(self.regStr(url,"x-oss-expires=(\\d+)&")) m3u8List = []
mediaMap = {}
# url = self.localMedia[fileId][mediaId] slices = m3u8Content.split("\n")
count = 0
# ts = int(self.regStr(url,"x-oss-expires=(\\d+)&")) for slice in slices:
tmpSlice = slice
self.localTime = int(time.time()) if 'x-oss-expires' in tmpSlice:
count = count + 1
if ts - self.localTime <= 60: mediaMap[str(count)] = host+tmpSlice
self.getMediaSlice(shareId,shareToken,fileId)
url = self.localMedia[fileId][mediaId] tmpSlice = "{0}?do=push_agent&api=python&type=media&share_id={1}&file_id={2}&media_id={3}".format(self.localProxyUrl,shareId,fileId,count)
m3u8List.append(tmpSlice)
action = {
'url':url, self.localMedia[fileId] = mediaMap
'header':self.header,
'param':'', return '\n'.join(m3u8List)
'type':'stream',
'after':'' def proxyMedia(self,map):
} shareId = map['share_id']
print(action) fileId = map['file_id']
return [200, "video/MP2T", action, ""] mediaId = map['media_id']
shareToken = self.getToken(shareId,'')
def proxyM3U8(self,map):
shareId = map['share_id'] refresh = False
fileId = map['file_id'] url = ''
ts = 0
shareToken = self.getToken(shareId,'') if fileId in self.localMedia:
content = self.getMediaSlice(shareId,shareToken,fileId) fileMap = self.localMedia[fileId]
if mediaId in fileMap:
action = { url = fileMap[mediaId]
'url':'', if len(url) > 0:
'header':'', ts = int(self.regStr(url,"x-oss-expires=(\\d+)&"))
'param':'',
'type':'string', self.localTime = int(time.time())
'after':''
} if ts - self.localTime <= 60:
self.getMediaSlice(shareId,shareToken,fileId)
return [200, "application/octet-stream", action, content] url = self.localMedia[fileId][mediaId]
def localProxy(self,param): action = {
typ = param['type'] 'url':url,
if typ == "m3u8": 'header':self.header,
return self.proxyM3U8(param) 'param':'',
if typ == "media": 'type':'stream',
return self.proxyMedia(param) 'after':''
return None }
return [200, "video/MP2T", action, ""]
def getToken(self,shareId,sharePwd):
self.localTime = int(time.time()) def proxyM3U8(self,map):
shareToken = '' shareId = map['share_id']
if shareId in self.shareTokenMap: fileId = map['file_id']
shareToken = self.shareTokenMap[shareId]
# todo shareToken = self.getToken(shareId,'')
expire = self.expiresMap[shareId] content = self.getMediaSlice(shareId,shareToken,fileId)
if len(shareToken) > 0 and expire - self.localTime > 600:
return shareToken action = {
params = { 'url':'',
'share_id':shareId, 'header':'',
'share_pwd':sharePwd 'param':'',
} 'type':'string',
url = 'https://api.aliyundrive.com/v2/share_link/get_share_token' 'after':''
rsp = requests.post(url,json = params,headers=self.header) }
jo = json.loads(rsp.text)
newShareToken = jo['share_token'] return [200, "application/octet-stream", action, content]
self.expiresMap[shareId] = self.localTime + int(jo['expires_in'])
self.shareTokenMap[shareId] = newShareToken def localProxy(self,param):
if not self.login():
print(self.expiresMap) return {}
print(self.shareTokenMap) typ = param['type']
if typ == "m3u8":
return newShareToken return self.proxyM3U8(param)
if typ == "media":
def listFiles(self,map,shareId,shareToken,fileId): return self.proxyMedia(param)
url = 'https://api.aliyundrive.com/adrive/v3/file/list' return None
newHeader = self.header.copy()
newHeader['x-share-token'] = shareToken def getToken(self,shareId,sharePwd):
params = { self.localTime = int(time.time())
'image_thumbnail_process':'image/resize,w_160/format,jpeg', shareToken = ''
'image_url_process':'image/resize,w_1920/format,jpeg', if shareId in self.shareTokenMap:
'limit':200, shareToken = self.shareTokenMap[shareId]
'order_by':'updated_at', # todo
'order_direction':'DESC', expire = self.expiresMap[shareId]
'parent_file_id':fileId, if len(shareToken) > 0 and expire - self.localTime > 600:
'share_id':shareId, return shareToken
'video_thumbnail_process':'video/snapshot,t_1000,f_jpg,ar_auto,w_300' params = {
} 'share_id':shareId,
maker = '' 'share_pwd':sharePwd
arrayList = [] }
for i in range(1,51): url = 'https://api.aliyundrive.com/v2/share_link/get_share_token'
if i >= 2 and len(maker) == 0: rsp = requests.post(url,json = params,headers=self.header)
break jo = json.loads(rsp.text)
params['marker'] = maker newShareToken = jo['share_token']
rsp = requests.post(url,json = params,headers=newHeader) self.expiresMap[shareId] = self.localTime + int(jo['expires_in'])
jo = json.loads(rsp.text) self.shareTokenMap[shareId] = newShareToken
ja = jo['items']
for jt in ja: # print(self.expiresMap)
if jt['type'] == 'folder': # print(self.shareTokenMap)
arrayList.append(jt['file_id'])
else: return newShareToken
if 'video' in jt['mime_type'] or 'video' in jt['category']:
repStr = jt['name'].replace("#", "_").replace("$", "_") def listFiles(self,map,shareId,shareToken,fileId,subtitle={}):
map[repStr] = shareId + "+" + shareToken + "+" + jt['file_id'] + "+" + jt['category'] url = 'https://api.aliyundrive.com/adrive/v3/file/list'
# print(repStr,shareId + "+" + shareToken + "+" + jt['file_id']) newHeader = self.header.copy()
maker = jo['next_marker'] newHeader['x-share-token'] = shareToken
i = i + 1 params = {
'image_thumbnail_process':'image/resize,w_160/format,jpeg',
for item in arrayList: 'image_url_process':'image/resize,w_1920/format,jpeg',
self.listFiles(map,shareId,shareToken,item) 'limit':200,
'order_by':'updated_at',
def login(self): 'order_direction':'DESC',
self.localTime = int(time.time()) 'parent_file_id':fileId,
url = 'https://api.aliyundrive.com/token/refresh' 'share_id':shareId,
if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600: 'video_thumbnail_process':'video/snapshot,t_1000,f_jpg,ar_auto,w_300'
form = { }
'refresh_token':'3865f0ab8f124688ad786a262af9b940' maker = ''
} arrayList = []
rsp = requests.post(url,json = form,headers=self.header) for i in range(1,51):
jo = json.loads(rsp.text) if i >= 2 and len(maker) == 0:
self.authorization = jo['token_type'] + ' ' + jo['access_token'] break
self.expiresIn = int(jo['expires_in']) params['marker'] = maker
self.timeoutTick = self.localTime + self.expiresIn rsp = requests.post(url,json = params,headers=newHeader)
jo = json.loads(rsp.text)
# print(self.authorization) ja = jo['items']
# print(self.timeoutTick) for jt in ja:
# print(self.localTime) if jt['type'] == 'folder':
# print(self.expiresIn) arrayList.append(jt['file_id'])
else:
if 'video' in jt['mime_type'] or 'video' in jt['category']:
repStr = jt['name'].replace("#", "_").replace("$", "_").replace(jt['file_extension'],'')[0:-1]
map[repStr] = shareId + "+" + shareToken + "+" + jt['file_id'] + "+" + jt['category'] + "+"
elif 'others' == jt['category'] and ('srt' == jt['file_extension'] or 'ass' == jt['file_extension']):
repStr = jt['name'].replace("#", "_").replace("$", "_").replace(jt['file_extension'],'')[0:-1]
subtitle[repStr] = jt['file_id']
maker = jo['next_marker']
i = i + 1
for item in arrayList:
self.listFiles(map,shareId,shareToken,item,subtitle)
for key in map.keys():
for subKey in subtitle.keys():
if key in subKey and map[key][-1] == "+":
map[key]=map[key]+subtitle[subKey]
break
def login(self):
self.localTime = int(time.time())
url = 'https://api.aliyundrive.com/token/refresh'
if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600:
form = {
'refresh_token':'ab0b9a7555e84175bbc6f8e60310ae49'
}
rsp = requests.post(url,json = form,headers=self.header)
jo = json.loads(rsp.text)
if rsp.status_code == 200:
self.authorization = jo['token_type'] + ' ' + jo['access_token']
self.expiresIn = int(jo['expires_in'])
self.timeoutTick = self.localTime + self.expiresIn
return True
return False
else:
return True
# print(self.authorization)
# print(self.timeoutTick)
# print(self.localTime)
# print(self.expiresIn)