代码拉取完成,页面将自动刷新
import requests
import sendMesToWechat
def getData(url, name, title, access_token):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27 '
}
i = 0
while i < 5:
try:
ts_data = requests.get(url=url, headers=headers, timeout=5)
return ts_data
except requests.exceptions.RequestException:
i += 1
if i == 5:
contxt = name + ' ' + title
data = sendMesToWechat.getFuiJson(contxt)
sendMesToWechat.send_message(access_token, data)
def getHtml(url, access_token):
headers = {
'Cookie': 'XLA_CI=3728202e1b1367eceb5de2bd13d4992e; PHPSESSID=ceii8a3hc3s1suesavc7osfbej; '
'history=%5B%7B%22name%22%3A%22%E5%90%8D%E4%BE%A6%E6%8E%A2%E6%9F%AF%E5%8D%97%E5%89%A7%E5%9C%BA%E7'
'%89%88%E5%9B%BD%E8%AF%AD%22%2C%22pic%22%3A%22%2Fupload%2Fvod%2F20201029-3'
'%2Ffafbae309d97b6ff77b4cab677558af5.jpg%22%2C%22link%22%3A%22%2Fvodplay%2F5467-1-1.html%22%2C'
'%22part%22%3A%22%E7%AC%AC01%E9%9B%86%22%7D%2C%7B%22name%22%3A%22%E5%90%8D%E4%BE%A6%E6%8E%A2%E6%9F'
'%AF%E5%8D%97%EF%BC%9A%E8%B4%9D%E5%85%8B%E8%A1%97%E7%9A%84%22%2C%22pic%22%3A%22%2Fupload%2Fvod'
'%2F20201029-1%2F591ee036951abb97d482d1ddbcd7352f.jpg%22%2C%22link%22%3A%22%2Fvodplay%2F6666-2-1'
'.html%22%2C%22part%22%3A%22%E5%85%A8%E9%9B%86%22%7D%2C%7B%22name%22%3A%22%E4%B8%8D%E6%AD%BB%E8%80'
'%85%E4%B9%8B%E7%8E%8B%E7%AC%AC%E5%9B%9B%E5%AD%A3%22%2C%22pic%22%3A%22https%3A%2F%2Ftvax4.sinaimg'
'.cn%2Flarge%2F006yt1Omgy1gxh5c1j48wj30ku0tf7fk.jpg%22%2C%22link%22%3A%22%2Fvodplay%2F7117-1-1.html'
'%22%2C%22part%22%3A%22%E7%AC%AC01%E9%9B%86%22%7D%5D',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/105.0.0.0 Safari/537.36 '
}
i = 0
while i < 5:
try:
ts_data = requests.get(url=url, headers=headers, timeout=5)
return ts_data
except requests.exceptions.RequestException:
i += 1
if i == 5:
contxt = ' '
data = sendMesToWechat.getFuiJson(contxt)
sendMesToWechat.send_message(access_token, data)
def getData1(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; '
'x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 '
'Safari/537.36 '
}
i = 0
while i < 5:
try:
ts_data = requests.get(url=url, headers=headers, timeout=5)
return ts_data
except requests.exceptions.RequestException:
i += 1
# hls类型 m3u8视频类型的每个片段的url
def getFinalUrl(url):
url_list = url.split('/')
temp = url_list[2]
length = len(url_list)
rep = url_list[length - 1]
if temp == 'omts.tc.qq.com' or temp == 'qycache.hs-mould.cn':
url = url.replace(rep, '')
# print(url)
return url
elif temp == 'play4.cp21.ott.cibntv.net':
return ''
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。