py_cctv1231.py 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. #coding=utf-8
  2. #!/usr/bin/python
  3. import sys
  4. sys.path.append('..')
  5. from base.spider import Spider
  6. import json
  7. import time
  8. import base64
  9. import re
  10. from urllib import request, parse
  11. import urllib
  12. import urllib.request
  13. # import ssl
  14. # ssl._create_default_https_context = ssl._create_unverified_context#全局取消证书验证
  15. class Spider(Spider): # 元类 默认的元类 type
  16. def getName(self):
  17. return "中央电视台"#可搜索
  18. def init(self,extend=""):
  19. print("============{0}============".format(extend))
  20. pass
  21. def isVideoFormat(self,url):
  22. pass
  23. def manualVideoCheck(self):
  24. pass
  25. def homeContent(self,filter):
  26. result = {}
  27. cateManual = {
  28. "电视剧8": "电视剧",
  29. "动画片": "动画片",
  30. "纪录片": "纪录片",
  31. "特别节目": "特别节目",
  32. "节目大全":"节目大全",
  33. '测试':'77'
  34. }
  35. classes = []
  36. for k in cateManual:
  37. classes.append({
  38. 'type_name':k,
  39. 'type_id':cateManual[k]
  40. })
  41. result['class'] = classes
  42. if(filter):
  43. result['filters'] = self.config['filter']
  44. return result
  45. def homeVideoContent(self):
  46. result = {
  47. 'list':[]
  48. }
  49. return result
  50. def categoryContent(self,tid,pg,filter,extend):
  51. result = {}
  52. month = ""#月
  53. year = ""#年
  54. area=''#地区
  55. channel=''#频道
  56. datafl=''#类型
  57. letter=''#字母
  58. pagecount=24
  59. if tid=='动画片':
  60. id=urllib.parse.quote(tid)
  61. if 'datadq-area' in extend.keys():
  62. area=urllib.parse.quote(extend['datadq-area'])
  63. if 'dataszm-letter' in extend.keys():
  64. letter=extend['dataszm-letter']
  65. if 'datafl-sc' in extend.keys():
  66. datafl=urllib.parse.quote(extend['datafl-sc'])
  67. url='https://api.cntv.cn/list/getVideoAlbumList?channelid=CHAL1460955899450127&area={0}&sc={4}&fc={1}&letter={2}&p={3}&n=24&serviceId=tvcctv&topv=1&t=json'.format(area,id,letter,pg,datafl)
  68. elif tid=='纪录片':
  69. id=urllib.parse.quote(tid)
  70. if 'datapd-channel' in extend.keys():
  71. channel=urllib.parse.quote(extend['datapd-channel'])
  72. if 'datafl-sc' in extend.keys():
  73. datafl=urllib.parse.quote(extend['datafl-sc'])
  74. if 'datanf-year' in extend.keys():
  75. year=extend['datanf-year']
  76. if 'dataszm-letter' in extend.keys():
  77. letter=extend['dataszm-letter']
  78. url='https://api.cntv.cn/list/getVideoAlbumList?channelid=CHAL1460955924871139&fc={0}&channel={1}&sc={2}&year={3}&letter={4}&p={5}&n=24&serviceId=tvcctv&topv=1&t=json'.format(id,channel,datafl,year,letter,pg)
  79. elif tid=='电视剧':
  80. id=urllib.parse.quote(tid)
  81. if 'datafl-sc' in extend.keys():
  82. datafl=urllib.parse.quote(extend['datafl-sc'])
  83. if 'datanf-year' in extend.keys():
  84. year=extend['datanf-year']
  85. if 'dataszm-letter' in extend.keys():
  86. letter=extend['dataszm-letter']
  87. url='https://api.cntv.cn/list/getVideoAlbumList?channelid=CHAL1460955853485115&area={0}&sc={1}&fc={2}&year={3}&letter={4}&p={5}&n=24&serviceId=tvcctv&topv=1&t=json'.format(area,datafl,id,year,letter,pg)
  88. elif tid=='特别节目':
  89. id=urllib.parse.quote(tid)
  90. if 'datapd-channel' in extend.keys():
  91. channel=urllib.parse.quote(extend['datapd-channel'])
  92. if 'datafl-sc' in extend.keys():
  93. datafl=urllib.parse.quote(extend['datafl-sc'])
  94. if 'dataszm-letter' in extend.keys():
  95. letter=extend['dataszm-letter']
  96. url='https://api.cntv.cn/list/getVideoAlbumList?channelid=CHAL1460955953877151&channel={0}&sc={1}&fc={2}&bigday=&letter={3}&p={4}&n=24&serviceId=tvcctv&topv=1&t=json'.format(channel,datafl,id,letter,pg)
  97. elif tid=='节目大全':
  98. cid=''#频道
  99. if 'cid' in extend.keys():
  100. cid=extend['cid']
  101. fc=''#分类
  102. if 'fc' in extend.keys():
  103. fc=extend['fc']
  104. fl=''#字母
  105. if 'fl' in extend.keys():
  106. fl=extend['fl']
  107. url = 'https://api.cntv.cn/lanmu/columnSearch?&fl={0}&fc={1}&cid={2}&p={3}&n=20&serviceId=tvcctv&t=json&cb=ko'.format(fl,fc,cid,pg)
  108. print(url)
  109. pagecount=20
  110. else:
  111. url = 'https://tv.cctv.com/epg/index.shtml'
  112. videos=[]
  113. htmlText =self.webReadFile(urlStr=url,header=self.header)
  114. if tid=='节目大全':
  115. index=htmlText.rfind(');')
  116. if index>-1:
  117. htmlText=htmlText[3:index]
  118. videos =self.get_list1(html=htmlText,tid=tid)
  119. else:
  120. videos =self.get_list(html=htmlText,tid=tid)
  121. result['list'] = videos
  122. result['page'] = pg
  123. result['pagecount'] = 9999 if len(videos)>=pagecount else pg
  124. result['limit'] = 90
  125. result['total'] = 999999
  126. return result
  127. def detailContent(self,array):
  128. result={}
  129. aid = array[0].split('###')
  130. tid = aid[0]
  131. logo = aid[3]
  132. lastVideo = aid[2]
  133. title = aid[1]
  134. if len(aid)>4:
  135. id= aid[4]
  136. vod_year= aid[5]
  137. actors= aid[6]
  138. brief= aid[7]
  139. else:
  140. id=''
  141. vod_year=''
  142. actors=''
  143. brief=''
  144. fromId='CCTV'
  145. urlList=[]#地址集,央视他好像也是挨个试
  146. VID=self.get_RegexGetText(Text=lastVideo,RegexText=r"/(VID.+?)\.",Index=1)
  147. if VID!='':
  148. urlList.append("https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?id={0}&serviceId=tvcctv&pub=1&mode=0&p=页数&n=100".format(VID))
  149. urlList.append("https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?id={0}&serviceId=tvcctv&pub=1&mode=1&p=页数&n=100".format(VID))
  150. if tid=="特殊":
  151. tid='栏目'
  152. title=title+'[TOPC]'
  153. urlList.append(lastVideo)
  154. elif self.get_RegexGetText(Text=lastVideo,RegexText=r"/(lm)/",Index=1)!='':
  155. Url= self.custom_complexSituation(urlStr=lastVideo)
  156. if Url!='':
  157. tid='栏目'
  158. #TOPC
  159. Url='https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&p=页数&d=1&n=100&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(Url)
  160. array[0]="{0}###{1}###{2}###{3}".format('特殊',title,Url,logo)
  161. urlList.append(Url)
  162. if self.get_RegexGetText(Text=id,RegexText=r"(VID.+?)",Index=1)!='':
  163. urlList.append('https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?id={0}&serviceId=tvcctv&p=页数&n=100&mode=0&pub=1'.format(id))
  164. elif tid=="节目大全":
  165. try:
  166. lastUrl = 'https://api.cntv.cn/video/videoinfoByGuid?guid={0}&serviceId=tvcctv'.format(id)#guid
  167. htmlTxt = self.webReadFile(urlStr=lastUrl,header=self.header)
  168. topicId=json.loads(htmlTxt)['ctid']
  169. urlList.append("https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&d=&p=页数&n=100&sort=desc&mode=0&serviceId=tvcctv&t=json".format(topicId))
  170. except:
  171. return {'list':[]}
  172. elif tid=='搜索栏目':
  173. try:
  174. htmlTxt = self.webReadFile(urlStr=lastVideo,header=self.header)
  175. topicId=self.get_RegexGetText(Text=htmlTxt,RegexText=r"var (column_id|topicID)\s*=\s*(\"|')(.+?)(\"|');",Index=3)
  176. idTxt=self.get_RegexGetText(Text=htmlTxt,RegexText=r"var (lmtopId)\s*=\s*(\"|')(TOP.+?)(\"|');",Index=3)
  177. if idTxt!='':
  178. urlList.append('https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&n=20&sort=desc&p=页数&mode=0&serviceId=tvcctv'.format(idTxt))
  179. if len(topicId)>3:
  180. urlList.append( "https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&d=&p=页数&n=100&sort=desc&mode=0&serviceId=tvcctv&t=json".format(topicId))
  181. if len(urlList)<1:
  182. urlList.append(lastVideo)
  183. except:
  184. return {'list':[]}
  185. jRoot = ''
  186. videoList = []
  187. try:
  188. if tid=="搜索":
  189. fromId='中央台'
  190. videoList=[title+"$"+lastVideo]
  191. else:
  192. videoList=self.get_EpisodesList(urlList=urlList)
  193. if len(videoList)<1:
  194. try:
  195. htmlTxt=self.webReadFile(urlStr=lastVideo,header=self.header)
  196. patternTxt=[
  197. r"(\"|')title(\"|'):\s*(\"|')(?P<title>.+?)(\"|'),\n{0,1}\s*(\"|')brief(\"|'):\s*(\"|')(.+?)(\"|'),\n{0,1}\s*(\"|')img(\"|'):\s*(\"|')(.+?)(\"|'),\n{0,1}\s*(\"|')url(\"|'):\s*(\"|')(?P<url>.+?)(\"|')",
  198. r'class="tp1"><a\s*href="(?P<url>https://.+?)"\s*target="_blank"\s*title="(?P<title>.+?)"></a></div>',
  199. r"'title':\s*'(?P<title>.+?)',\n{0,1}\s*'img':\s*'(.+?)',\n{0,1}\s*'brief':\s*'(.+?)',\n{0,1}\s*'url':\s*'(?P<url>.+?)'",
  200. r'<a href="(?P<url>https://tv.cctv.com/.+?\.shtml).*?" target="_blank" alt="(?P<title>.+?)" ',
  201. r'href="(?P<url>.+?)" target="_blank" alt="(?P<title>.+?)" title=".+?">',
  202. r'<div class="text"><a href="(?P<url>https{0,1}://.+?[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/VID\w+?\.shtml)" target="_blank".*?>(?P<title>.+?)</a></div>',
  203. r'<div class="work">\s*\r*\n*\t*<a href="(?P<url>https://tv.cctv.com/[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/VID\w+?.shtml)" target="_blank">(?P<title>.+?)</a>'
  204. ]
  205. # print('正则')
  206. fromId='央视'
  207. if tid=="电视剧" or tid=="纪录片":
  208. videoList=self.get_EpisodesList_re(htmlTxt=htmlTxt,patternTxt=patternTxt[0])
  209. elif tid=="特别节目":
  210. videoList=self.get_EpisodesList_re(htmlTxt=htmlTxt,patternTxt=patternTxt[1])
  211. elif tid=="动画片":
  212. videoList=self.get_EpisodesList_re(htmlTxt=htmlTxt,patternTxt=patternTxt[2])
  213. elif tid=="节目大全":
  214. videoList=self.get_EpisodesList_re(htmlTxt=htmlTxt,patternTxt=patternTxt[4])
  215. if len(videoList)<1:
  216. for vod in patternTxt:
  217. videoList=self.get_EpisodesList_re(htmlTxt=htmlTxt,patternTxt=vod)
  218. if len(videoList)>0:
  219. brief='欲观看完整版,请到"分类"中寻找'
  220. break
  221. except:
  222. return {'list':[]}
  223. except:
  224. pass
  225. if len(videoList) == 0:
  226. return {'list':[]}
  227. vod = {
  228. "vod_id":array[0],
  229. "vod_name":title,
  230. "vod_pic":logo,
  231. "type_name":tid,
  232. "vod_year":vod_year,
  233. "vod_area":"",
  234. "vod_remarks":'',
  235. "vod_actor":actors,
  236. "vod_director":'',
  237. "vod_content":brief
  238. }
  239. vod['vod_play_from'] = fromId
  240. vod['vod_play_url'] = "#".join(videoList)
  241. result = {
  242. 'list':[
  243. vod
  244. ]
  245. }
  246. return result
  247. def get_lineList(self,Txt,mark,after):
  248. circuit=[]
  249. origin=Txt.find(mark)
  250. while origin>8:
  251. end=Txt.find(after,origin)
  252. circuit.append(Txt[origin:end])
  253. origin=Txt.find(mark,end)
  254. return circuit
  255. def get_RegexGetTextLine(self,Text,RegexText,Index):
  256. returnTxt=[]
  257. pattern = re.compile(RegexText, re.M|re.S)
  258. ListRe=pattern.findall(Text)
  259. if len(ListRe)<1:
  260. return returnTxt
  261. for value in ListRe:
  262. returnTxt.append(value)
  263. return returnTxt
  264. def searchContent(self,key,quick):
  265. key=urllib.parse.quote(key)
  266. # Url='https://search.cctv.com/ifsearch.php?page=1&qtext={0}&sort=relevance&pageSize=20&type=video&vtime=-1&datepid=1&channel=&pageflag=0&qtext_str={0}'.format(key)
  267. Url='https://search.cctv.com/search.php'
  268. headers = {
  269. 'Referer':'https://search.cctv.com/search.php',
  270. 'User-Agent': 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36',
  271. 'Host': 'search.cctv.com',
  272. 'Accept': '*/*',
  273. 'Accept-Language': 'zh-cn',
  274. 'Content-Type': 'application/x-www-form-urlencoded',
  275. 'Connection': 'Keep-Alive',
  276. 'Content-Length': '98'
  277. }
  278. data = {
  279. "type": "video",
  280. "url": "",
  281. "httpflag": "https%3A%2F%2F",
  282. "channel": "",
  283. "qtext_str": key,
  284. "qtext": key
  285. }
  286. req=self.post(Url,data)#headers=headers
  287. htmlTxt=req.text
  288. videos=[]
  289. videos=self.get_list_search(html=htmlTxt,key=key)
  290. result = {
  291. 'list':videos
  292. }
  293. return result
  294. def playerContent(self,flag,id,vipFlags):
  295. result = {}
  296. url=''
  297. parse=0
  298. headers = {
  299. 'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'
  300. }
  301. if flag=='CCTV':
  302. url=self.get_m3u8(urlTxt=id)
  303. else:
  304. try:
  305. # print(url)
  306. html=self.webReadFile(urlStr=id,header=self.header)
  307. if self.get_RegexGetText(Text=html,RegexText=r"(window.location.href)",Index=1)!='':
  308. url=self.get_RegexGetText(Text=html,RegexText=r"window.location.href\s*=\s*(\"|')(.+?)(\"|')",Index=2)
  309. VID=self.get_RegexGetText(Text=html,RegexText=r"content\s*=\s*(\"|')(VID.+?)(\"|')",Index=2)
  310. if VID!='' and url=='':
  311. url='https://tv.cctv.com/v/lv/'+VID+".html"
  312. html=self.webReadFile(urlStr=url,header=self.header)
  313. url=self.get_RegexGetText(Text=html,RegexText=r"pcUrl\s*=\s*(\"|')(.+?)(\"|')",Index=2)
  314. if url!='':
  315. html=self.webReadFile(urlStr=url,header=self.header)
  316. if url!='':
  317. id=url
  318. guid=self.get_RegexGetText(Text=html,RegexText=r'var\sguid\s*=\s*"(.+?)";',Index=1)
  319. if guid!='':
  320. url=self.get_m3u8(urlTxt=guid)
  321. except :
  322. url=id
  323. parse=1
  324. if url.find('://')<0:
  325. url=id
  326. parse=1
  327. result["parse"] = parse#1=嗅探,0=播放
  328. result["playUrl"] = ''
  329. result["url"] = url
  330. result["header"] =headers
  331. return result
  332. config = {
  333. "player": {},
  334. "filter": {
  335. "电视剧":[
  336. {"key":"datafl-sc","name":"类型","value":[{"n":"全部","v":""},{"n":"谍战","v":"谍战"},{"n":"悬疑","v":"悬疑"},{"n":"刑侦","v":"刑侦"},{"n":"历史","v":"历史"},{"n":"古装","v":"古装"},{"n":"武侠","v":"武侠"},{"n":"军旅","v":"军旅"},{"n":"战争","v":"战争"},{"n":"喜剧","v":"喜剧"},{"n":"青春","v":"青春"},{"n":"言情","v":"言情"},{"n":"偶像","v":"偶像"},{"n":"家庭","v":"家庭"},{"n":"年代","v":"年代"},{"n":"革命","v":"革命"},{"n":"农村","v":"农村"},{"n":"都市","v":"都市"},{"n":"其他","v":"其他"}]},
  337. {"key":"datadq-area","name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"中国香港","v":"香港"},{"n":"美国","v":"美国"},{"n":"欧洲","v":"欧洲"},{"n":"泰国","v":"泰国"}]},
  338. {"key":"datanf-year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"},{"n":"2007","v":"2007"},{"n":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004","v":"2004"},{"n":"2003","v":"2003"},{"n":"2002","v":"2002"},{"n":"2001","v":"2001"},{"n":"2000","v":"2000"},{"n":"1999","v":"1999"},{"n":"1998","v":"1998"},{"n":"1997","v":"1997"}]},
  339. {"key":"dataszm-letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"C","v":"C"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"},{"n":"0-9","v":"0-9"}]}
  340. ],
  341. "动画片":[
  342. {"key":"datafl-sc","name":"类型","value":[{"n":"全部","v":""},{"n":"亲子","v":"亲子"},{"n":"搞笑","v":"搞笑"},{"n":"冒险","v":"冒险"},{"n":"动作","v":"动作"},{"n":"宠物","v":"宠物"},{"n":"体育","v":"体育"},{"n":"益智","v":"益智"},{"n":"历史","v":"历史"},{"n":"教育","v":"教育"},{"n":"校园","v":"校园"},{"n":"言情","v":"言情"},{"n":"武侠","v":"武侠"},{"n":"经典","v":"经典"},{"n":"未来","v":"未来"},{"n":"古代","v":"古代"},{"n":"神话","v":"神话"},{"n":"真人","v":"真人"},{"n":"励志","v":"励志"},{"n":"热血","v":"热血"},{"n":"奇幻","v":"奇幻"},{"n":"童话","v":"童话"},{"n":"剧情","v":"剧情"},{"n":"夺宝","v":"夺宝"},{"n":"其他","v":"其他"}]},
  343. {"key":"datadq-area","name":"地区","value":[{"n":"全部","v":""},{"n":"中国大陆","v":"中国大陆"},{"n":"美国","v":"美国"},{"n":"欧洲","v":"欧洲"}]},
  344. {"key":"dataszm-letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"C","v":"C"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"},{"n":"0-9","v":"0-9"}]}
  345. ],
  346. "纪录片":[
  347. {"key":"datapd-channel","name":"频道","value":[{"n":"全部","v":""},{"n":"CCTV{1 综合","v":"CCTV{1 综合"},{"n":"CCTV{2 财经","v":"CCTV{2 财经"},{"n":"CCTV{3 综艺","v":"CCTV{3 综艺"},{"n":"CCTV{4 中文国际","v":"CCTV{4 中文国际"},{"n":"CCTV{5 体育","v":"CCTV{5 体育"},{"n":"CCTV{6 电影","v":"CCTV{6 电影"},{"n":"CCTV{7 国防军事","v":"CCTV{7 国防军事"},{"n":"CCTV{8 电视剧","v":"CCTV{8 电视剧"},{"n":"CCTV{9 纪录","v":"CCTV{9 纪录"},{"n":"CCTV{10 科教","v":"CCTV{10 科教"},{"n":"CCTV{11 戏曲","v":"CCTV{11 戏曲"},{"n":"CCTV{12 社会与法","v":"CCTV{12 社会与法"},{"n":"CCTV{13 新闻","v":"CCTV{13 新闻"},{"n":"CCTV{14 少儿","v":"CCTV{14 少儿"},{"n":"CCTV{15 音乐","v":"CCTV{15 音乐"},{"n":"CCTV{17 农业农村","v":"CCTV{17 农业农村"}]},
  348. {"key":"datafl-sc","name":"类型","value":[{"n":"全部","v":""},{"n":"人文历史","v":"人文历史"},{"n":"人物","v":"人物"},{"n":"军事","v":"军事"},{"n":"探索","v":"探索"},{"n":"社会","v":"社会"},{"n":"时政","v":"时政"},{"n":"经济","v":"经济"},{"n":"科技","v":"科技"}]},
  349. {"key":"datanf-year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"}]},
  350. {"key":"dataszm-letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"C","v":"C"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"},{"n":"0-9","v":"0-9"}]}
  351. ],
  352. "特别节目":[
  353. {"key":"datapd-channel","name":"频道","value":[{"n":"全部","v":""},{"n":"CCTV{1 综合","v":"CCTV{1 综合"},{"n":"CCTV{2 财经","v":"CCTV{2 财经"},{"n":"CCTV{3 综艺","v":"CCTV{3 综艺"},{"n":"CCTV{4 中文国际","v":"CCTV{4 中文国际"},{"n":"CCTV{5 体育","v":"CCTV{5 体育"},{"n":"CCTV{6 电影","v":"CCTV{6 电影"},{"n":"CCTV{7 国防军事","v":"CCTV{7 国防军事"},{"n":"CCTV{8 电视剧","v":"CCTV{8 电视剧"},{"n":"CCTV{9 纪录","v":"CCTV{9 纪录"},{"n":"CCTV{10 科教","v":"CCTV{10 科教"},{"n":"CCTV{11 戏曲","v":"CCTV{11 戏曲"},{"n":"CCTV{12 社会与法","v":"CCTV{12 社会与法"},{"n":"CCTV{13 新闻","v":"CCTV{13 新闻"},{"n":"CCTV{14 少儿","v":"CCTV{14 少儿"},{"n":"CCTV{15 音乐","v":"CCTV{15 音乐"},{"n":"CCTV{17 农业农村","v":"CCTV{17 农业农村"}]},
  354. {"key":"datafl-sc","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":"其他"}]},
  355. {"key":"dataszm-letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"C","v":"C"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"},{"n":"0-9","v":"0-9"}]}
  356. ],
  357. "节目大全":[{"key":"cid","name":"频道","value":[{"n":"全部","v":""},{"n":"CCTV-1综合","v":"EPGC1386744804340101"},{"n":"CCTV-2财经","v":"EPGC1386744804340102"},{"n":"CCTV-3综艺","v":"EPGC1386744804340103"},{"n":"CCTV-4中文国际","v":"EPGC1386744804340104"},{"n":"CCTV-5体育","v":"EPGC1386744804340107"},{"n":"CCTV-6电影","v":"EPGC1386744804340108"},{"n":"CCTV-7国防军事","v":"EPGC1386744804340109"},{"n":"CCTV-8电视剧","v":"EPGC1386744804340110"},{"n":"CCTV-9纪录","v":"EPGC1386744804340112"},{"n":"CCTV-10科教","v":"EPGC1386744804340113"},{"n":"CCTV-11戏曲","v":"EPGC1386744804340114"},{"n":"CCTV-12社会与法","v":"EPGC1386744804340115"},{"n":"CCTV-13新闻","v":"EPGC1386744804340116"},{"n":"CCTV-14少儿","v":"EPGC1386744804340117"},{"n":"CCTV-15音乐","v":"EPGC1386744804340118"},{"n":"CCTV-16奥林匹克","v":"EPGC1634630207058998"},{"n":"CCTV-17农业农村","v":"EPGC1563932742616872"},{"n":"CCTV-5+体育赛事","v":"EPGC1468294755566101"}]},{"key":"fc","name":"分类","value":[{"n":"全部","v":""},{"n":"新闻","v":"新闻"},{"n":"体育","v":"体育"},{"n":"综艺","v":"综艺"},{"n":"健康","v":"健康"},{"n":"生活","v":"生活"},{"n":"科教","v":"科教"},{"n":"经济","v":"经济"},{"n":"农业","v":"农业"},{"n":"法治","v":"法治"},{"n":"军事","v":"军事"},{"n":"少儿","v":"少儿"},{"n":"动画","v":"动画"},{"n":"纪实","v":"纪实"},{"n":"戏曲","v":"戏曲"},{"n":"音乐","v":"音乐"},{"n":"影视","v":"影视"}]},{"key":"fl","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"2014","v":"2014"},{"n":"2013","v":"2013"},{"n":"2012","v":"2012"},{"n":"2011","v":"2011"},{"n":"2010","v":"2010"},{"n":"2009","v":"2009"},{"n":"2008","v":"2008"},{"n":"2007","v":"2007"},{"n":"2006","v":"2006"},{"n":"2005","v":"2005"},{"n":"2004","v":"2004"},{"n":"2003","v":"2003"},{"n":"2002","v":"2002"},{"n":"2001","v":"2001"},{"n":"2000","v":"2000"}]},{"key":"month","name":"月份","value":[{"n":"全部","v":""},{"n":"12","v":"12"},{"n":"11","v":"11"},{"n":"10","v":"10"},{"n":"09","v":"09"},{"n":"08","v":"08"},{"n":"07","v":"07"},{"n":"06","v":"06"},{"n":"05","v":"05"},{"n":"04","v":"04"},{"n":"03","v":"03"},{"n":"02","v":"02"},{"n":"01","v":"01"}]}]
  358. }
  359. }
  360. header = {
  361. "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",
  362. "Host": "tv.cctv.com",
  363. "Referer": "https://tv.cctv.com/"
  364. }
  365. def localProxy(self,param):
  366. return [200, "video/MP2T", action, ""]
  367. #-----------------------------------------------自定义函数-----------------------------------------------
  368. def removeHtml(self,txt):
  369. soup = re.compile(r'<[^>]+>',re.S)
  370. txt =soup.sub('', txt)
  371. return txt.replace("&nbsp;"," ")
  372. #访问网页
  373. def webReadFile(self,urlStr,header,timeout=200):#timeout=200
  374. html=''
  375. req=urllib.request.Request(url=urlStr)#,headers=header
  376. with urllib.request.urlopen(req,timeout=timeout) as response:
  377. html = response.read().decode('utf-8')
  378. return html
  379. #判断网络地址是否存在
  380. def TestWebPage(self,urlStr,header):
  381. html=''
  382. try:
  383. req=urllib.request.Request(url=urlStr,method='HEAD')#,method='HEAD'
  384. with urllib.request.urlopen(req) as response:
  385. html = response.getcode ()
  386. except :
  387. html=0
  388. return html
  389. #正则取文本
  390. def get_RegexGetText(self,Text,RegexText,Index):
  391. returnTxt=""
  392. Regex=re.search(RegexText, Text, re.M|re.S)
  393. if Regex is None:
  394. returnTxt=""
  395. else:
  396. returnTxt=Regex.group(Index)
  397. return returnTxt
  398. #正则取文本,返回数组
  399. def custom_RegexGetTextLine(self,Text,RegexText,Index):
  400. returnTxt=[]
  401. pattern = re.compile(RegexText, re.M|re.S)
  402. ListRe=pattern.findall(Text)
  403. if len(ListRe)<1:
  404. return returnTxt
  405. for value in ListRe:
  406. returnTxt.append(value)
  407. return returnTxt
  408. #取集数
  409. def get_EpisodesList(self,urlList):
  410. videos=[]
  411. url=''
  412. for vod in urlList:
  413. for i in range(1,3):
  414. url=vod.replace('页数',str(i))
  415. htmlTxt=self.webReadFile(urlStr=url,header=self.header)
  416. if htmlTxt.find('list')>4:
  417. try:
  418. jRoot = json.loads(htmlTxt)
  419. data=jRoot['data']
  420. total=data['total']
  421. jsonList=data['list']
  422. for j in jsonList:
  423. guid = j['guid']
  424. # print(url)
  425. title =j['title']
  426. if len(guid) == 0:
  427. continue
  428. videos.append(title+"$"+guid)
  429. # print('集数:{0},目前数:{1},循环数:{2},是否相等:{3}'.format(str(total),len(videos),i,len(videos)==total))
  430. if len(videos)>0:
  431. if total>200 or len(videos)==total:
  432. break
  433. else:
  434. break
  435. except:
  436. break
  437. else:
  438. break
  439. # print(str(len(videos))+'=总数')
  440. if len(videos)>0:
  441. break
  442. return videos
  443. #取集数
  444. def get_EpisodesList_re(self,htmlTxt,patternTxt):
  445. ListRe=re.finditer(patternTxt, htmlTxt, re.M|re.S)
  446. videos=[]
  447. for vod in ListRe:
  448. url = vod.group('url')
  449. title =self.removeHtml(txt=vod.group('title'))
  450. if len(url) == 0:
  451. continue
  452. videos.append(title+"$"+url)
  453. return videos
  454. #取剧集区
  455. def get_lineList(self,Txt,mark,after):
  456. circuit=[]
  457. origin=Txt.find(mark)
  458. while origin>8:
  459. end=Txt.find(after,origin)
  460. circuit.append(Txt[origin:end])
  461. origin=Txt.find(mark,end)
  462. return circuit
  463. #正则取文本,返回数组
  464. def get_RegexGetTextLine(self,Text,RegexText,Index):
  465. returnTxt=[]
  466. pattern = re.compile(RegexText, re.M|re.S)
  467. ListRe=pattern.findall(Text)
  468. if len(ListRe)<1:
  469. return returnTxt
  470. for value in ListRe:
  471. returnTxt.append(value)
  472. return returnTxt
  473. #删除html标签
  474. def removeHtml(self,txt):
  475. soup = re.compile(r'<[^>]+>',re.S)
  476. txt =soup.sub('', txt)
  477. return txt.replace("&nbsp;"," ")
  478. #取m3u8
  479. def get_m3u8(self,urlTxt):
  480. if urlTxt=='':
  481. return ''
  482. url = "https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid={0}".format(urlTxt)
  483. html=self.webReadFile(urlStr=url,header=self.header)
  484. jo =json.loads(html)
  485. link = jo['hls_url'].strip()
  486. html = self.webReadFile(urlStr=link,header=self.header)
  487. content = html.strip()
  488. arr = content.split('\n')
  489. urlPrefix = self.get_RegexGetText(Text=link,RegexText='(http[s]?://[a-zA-z0-9.]+)/',Index=1)
  490. subUrl = arr[-1].split('/')
  491. subUrl[3] = '1200'
  492. subUrl[-1] = '1200.m3u8'
  493. hdUrl = urlPrefix + '/'.join(subUrl)
  494. url = urlPrefix + arr[-1]
  495. hdRsp=0
  496. try:
  497. hdRsp = self.TestWebPage(urlStr=hdUrl,header=self.header)
  498. except:
  499. hdRsp=0
  500. if hdRsp == 200:
  501. url = hdUrl
  502. elif self.get_RegexGetText(Text=url,RegexText=r"(\.m3u8)",Index=1)=='':
  503. url=''
  504. return url
  505. def get_list1(self,html,tid):
  506. jRoot = json.loads(html)
  507. videos = []
  508. data=jRoot['response']
  509. if data is None:
  510. return []
  511. jsonList=data['docs']
  512. for vod in jsonList:
  513. id = vod['lastVIDE']['videoSharedCode']
  514. title =vod['column_name']
  515. url=vod['column_website']
  516. img=vod['column_logo']
  517. year=vod['column_playdate']
  518. brief=vod['column_brief']
  519. actors=''
  520. if len(url) == 0:
  521. continue
  522. guid="{0}###{1}###{2}###{3}###{4}###{5}###{6}###{7}".format(tid,title,url,img,id,year,actors,brief)
  523. #print(vod_id)
  524. videos.append({
  525. "vod_id":guid,
  526. "vod_name":title,
  527. "vod_pic":img,
  528. "vod_remarks":''
  529. })
  530. #print(videos)
  531. return videos
  532. #分类取结果
  533. def get_list(self,html,tid):
  534. jRoot = json.loads(html)
  535. videos = []
  536. data=jRoot['data']
  537. if data is None:
  538. return []
  539. jsonList=data['list']
  540. for vod in jsonList:
  541. url = vod['url']
  542. title =vod['title']
  543. img=vod['image']
  544. id=vod['id']
  545. try:
  546. brief=vod['brief']
  547. except:
  548. brief=''
  549. try:
  550. year=vod['year']
  551. except:
  552. year=''
  553. try:
  554. actors=vod['actors']
  555. except:
  556. actors=''
  557. if len(url) == 0:
  558. continue
  559. guid="{0}###{1}###{2}###{3}###{4}###{5}###{6}###{7}".format(tid,title,url,img,id,year,actors,brief)
  560. #print(vod_id)
  561. videos.append({
  562. "vod_id":guid,
  563. "vod_name":title,
  564. "vod_pic":img,
  565. "vod_remarks":''
  566. })
  567. return videos
  568. #搜索
  569. def get_list_search(self,html,key):
  570. videos=[]
  571. try:
  572. root = self.html(html)
  573. nodes = root.xpath('//div[@class="ind01"]')
  574. for vod in nodes:
  575. temporary=vod.xpath("./div[@class='ind-r']/div[@class='tit_bre']/h3[@class='tit']/span/a")[0]
  576. url=temporary.xpath("./@href")[0]
  577. if url=='':
  578. continue
  579. temporary=vod.xpath("./div[@class='ind-r']/div[@class='tit_bre']/h3[@class='tit']")[0]
  580. title=self.get_RegexGetText(Text=temporary.xpath("string(.)"),RegexText=r'(.+?)\n',Index=1)
  581. temporary=vod.xpath("./div[@class='image']/table/tbody/tr/td/img")[0]
  582. img=temporary.xpath("./@src")[0]
  583. vod_id="{0}###{1}###{2}###{3}".format('搜索栏目',title,url,img)
  584. videos.append({
  585. "vod_id":vod_id,
  586. "vod_name":title,
  587. "vod_pic":img,
  588. "vod_remarks":'视频集'
  589. })
  590. except:
  591. pass
  592. try:
  593. temporary=self. get_lineList(Txt=html,mark=r'<ul class="post">',after=r'</ul>')
  594. if len(temporary)>0:
  595. temporary=self. get_lineList(Txt=html,mark=r'<li',after=r'</li>')
  596. for vod in temporary:
  597. string=vod.split('-->')
  598. if len(string)<2:
  599. continue
  600. title=self.removeHtml(txt=self.get_RegexGetText(Text=string[1],RegexText=r'title="(.+?)">',Index=1))
  601. url=self.get_RegexGetText(Text=string[1],RegexText=r'href="(https{0,1}://tv\..+?\.shtml)"',Index=1)
  602. img=self.get_RegexGetText(Text=string[1],RegexText=r'src="(.+?)"',Index=1)
  603. if title=='' or url=='':
  604. continue
  605. vod_id="{0}###{1}###{2}###{3}".format('搜索栏目',title,url,img)
  606. videos.append({
  607. "vod_id":vod_id,
  608. "vod_name":title,
  609. "vod_pic":img,
  610. "vod_remarks":'视频集'
  611. })
  612. except:
  613. pass
  614. res = [i for n, i in enumerate(videos) if i not in videos[:n]]
  615. videos = res
  616. try:
  617. Url='https://search.cctv.com/ifsearch.php?page=1&qtext={0}&sort=relevance&pageSize=20&type=video&vtime=-1&datepid=1&channel=&pageflag=0&qtext_str={0}'.format(key)
  618. html=self.webReadFile(urlStr=Url,header=self.header)
  619. jRoot = json.loads(html)
  620. jsonList=jRoot['list']
  621. for vod in jsonList:
  622. url = vod['urllink']
  623. title =self.removeHtml(txt=vod['title'])
  624. img=vod['imglink']
  625. id=vod['id']
  626. brief=vod['channel']
  627. year=vod['uploadtime']
  628. if len(url) == 0:
  629. continue
  630. guid="{0}###{1}###{2}###{3}###{4}###{5}###{6}###{7}".format('搜索',title,url,img,id,year,'',brief)
  631. videos.append({
  632. "vod_id":guid,
  633. "vod_name":title,
  634. "vod_pic":img,
  635. "vod_remarks":year
  636. })
  637. except:
  638. pass
  639. return videos
  640. #水平有限,找不到其它办法
  641. def custom_complexSituation(self,urlStr):
  642. html=self.webReadFile(urlStr=urlStr,header=self.header)
  643. column_id=self.get_RegexGetText(Text=html,RegexText=r'var (topicID|column_id)\s*=\s*("|\')(\w+?)("|\');',Index=3)
  644. if column_id!='':#topicID
  645. # print(column_id)
  646. return column_id
  647. link=self.custom_RegexGetTextLine(Text=html,RegexText=r'<a href="(https{0,1}://tv.cctv.com/[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/VID\w+?\.shtml)"',Index=1)
  648. if len(link)<1:
  649. return ''
  650. TOPC=''
  651. i=0
  652. # print(urlStr)
  653. for vod in link:
  654. if vod.find('://')<0:
  655. continue
  656. i=i+1
  657. try:
  658. # print(str(i)+'---')
  659. html=self.webReadFile(urlStr=vod,header=self.header,timeout=60)
  660. except :
  661. continue
  662. guid =self.get_RegexGetText(Text=html,RegexText=r'var guid\s*=\s*("|\')(\w+?)("|\');',Index=2)
  663. if guid=='':
  664. continue
  665. try:
  666. html=self.webReadFile(urlStr='https://api.cntv.cn/video/videoinfoByGuid?guid={0}&serviceId=tvcctv'.format(guid),header=self.header,timeout=60)
  667. jo =json.loads(html)
  668. link = jo['ctid'].strip()
  669. if link=='':
  670. continue
  671. html=self.webReadFile(urlStr='https://api.cntv.cn/NewVideo/getVideoListByColumn?id={0}&p=1&d=1&n=10&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(link),header=self.header)
  672. if html.find('"list":[')<2:
  673. continue
  674. jo =json.loads(html)
  675. data = jo['data']
  676. jsonList=data['list']
  677. if len(jsonList)>0:
  678. TOPC=link
  679. break
  680. except :
  681. pass
  682. if i>60:
  683. break
  684. return TOPC
  685. # def readFile(self,filePath):
  686. # fileJson = open(filePath,'r',encoding='utf-8')#encoding='utf-8'
  687. # htmlTxt = fileJson.read(-1)
  688. # fileJson.close()
  689. # return htmlTxt
  690. # def html(self,html):
  691. # from lxml import etree
  692. # root=etree.HTML(html)
  693. # return root
  694. # T=Spider()
  695. # print(T.homeContent(filter=False))
  696. # # l=T.homeVideoContent()
  697. # l=T.searchContent(key='军事',quick='')
  698. # l=T.categoryContent(tid='节目大全',pg='2',filter=False,extend={})
  699. # for x in l['list']:
  700. # print(x['vod_id'])
  701. # mubiao= '搜索栏目###等着我###https://tv.cctv.com/lm/dzw/index.shtml###https://p5.img.cctvpic.com/photoAlbum/page/performance/img/2019/5/20/1558338967988_127.jpg'#l['list'][1]['vod_id']#7
  702. # mubiao=l['list'][0]['vod_id']#7
  703. # # # print(mubiao)
  704. # playTabulation=T.detailContent(array=[mubiao,])
  705. # print(playTabulation)
  706. # vod_play_from=playTabulation['list'][0]['vod_play_from']
  707. # vod_play_url=playTabulation['list'][0]['vod_play_url']
  708. # url=vod_play_url.split('$$$')
  709. # vod_play_from=vod_play_from.split('$$$')[0]
  710. # url=url[0].split('$')
  711. # url=url[1].split('#')[0]
  712. # print(url)
  713. # m3u8=T.playerContent(flag=vod_play_from,id=url,vipFlags=True)
  714. # print(m3u8['url'])
  715. # for x in l['list']:
  716. # mubiao= x['vod_id']#7
  717. # print(x['vod_name']+'_'+x['vod_remarks'])
  718. # if x['vod_remarks']!='视频集':
  719. # break
  720. # playTabulation=T.detailContent(array=[mubiao,])
  721. # # print(playTabulation['list'][0]['vod_play_url'])
  722. # if len(playTabulation['list'])<1:
  723. # print(mubiao)
  724. # break
  725. # vod_play_from=playTabulation['list'][0]['vod_play_from']
  726. # vod_play_url=playTabulation['list'][0]['vod_play_url']
  727. # url=vod_play_url.split('$$$')
  728. # vod_play_from=vod_play_from.split('$$$')[0]
  729. # url=url[0].split('$')
  730. # url=url[1].split('#')[0]
  731. # m3u8=T.playerContent(flag=vod_play_from,id=url,vipFlags=True)
  732. # print(m3u8['url'])
  733. # if m3u8['url'].find('m3u8')<0:
  734. # print(mubiao)
  735. # break
  736. # time.sleep(3)
  737. # # break