加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
checkOutTime.py 3.25 KB
一键复制 编辑 原始数据 按行查看 历史
GuLu 提交于 2022-09-18 17:33 . selenium
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 ''
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化