代码拉取完成,页面将自动刷新
同步操作将从 UndCover/IPTV 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import requests
# 导入文件操作库
import os
import re
import bs4
import json
from bs4 import BeautifulSoup
# mainUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1569314345479107&n=100&sort=desc&p={}&mode=2&serviceId=tvcctv&d={}'.format
mainUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1451557970755294&n=100&sort=desc&p={}&mode=2&serviceId=tvcctv&d={}'.format
url = 'http://newcntv.qcloudcdn.com/asp/hls/main/0303000a/3/default/{}/main.m3u8?maxbr=2048'.format
target = 'http://newcntv.qcloudcdn.com/asp/hls/2000/0303000a/3/default/4745f57fb4c14415b60c3f6df3db5624/2000.m3u8'
# url2 = 'http://newcntv.qcloudcdn.com/asp/hls/main/0303000a/3/default/{0}/main.m3u8?maxbr=2048'
mainPath = 'wafm(old){}.m3u'.format
global proxies
proxies = {
'http':'http://athena05:808',
'https':'https://athena05:808'
}
def lineParse(_url):
res_sub = requests.get(_url,proxies=proxies)
res_sub.encoding = 'utf-8'
tList = re.findall(r'/[^\s]*', res_sub.text)
targetLink = ''
fMax = 0
for i in range(len(tList)):
item = re.findall(r'[1-9]\d*(?=\.)', tList[i])
tMax = int(item[0])
if(fMax < tMax):
targetLink = tList[i]
fMax = tMax
print(targetLink)
return targetLink
def mainParse(_url,_path):
print("request-------------------------\n"+_url)
res_sub = requests.get(_url,proxies=proxies)
res_sub.encoding = 'utf-8'
jo = json.loads(res_sub.text)
jData = jo['data']
jList = jData['list']
if(len(jList) == 0):
return False
f = open(_path, 'a+', encoding='utf-8')
for i in range(len(jList)):
tGuid =jList[i]['guid']
tTitle = jList[i]['title']
f.write('#EXTINF:-1 , group-title="我爱发明", ')
f.write(tTitle)
f.write('\nhttp://newcntv.qcloudcdn.com')
f.write(lineParse(url(tGuid)))
f.write('\n')
f.close()
print("done")
return True
if __name__ == '__main__':
# mainParse(mainUrl)
# lineParse(url('4745f57fb4c14415b60c3f6df3db5624'))
for y in reversed(range(2009,2021)):
i = 1
while mainParse(mainUrl(i,y),mainPath(y)):
i = i + 1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。