Ai
1 Star 5 Fork 6

360模板吧/real-url

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
173.py 892 Bytes
一键复制 编辑 原始数据 按行查看 历史
wbt5 提交于 2021-11-08 22:34 +08:00 . :zap:优化代码 艺气山直播
# 艺气山直播:http://www.173.com/room/category?categoryId=11
import requests
class YQS:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
params = f'roomId={self.rid}'
with requests.Session() as s:
res = s.post('https://www.173.com/room/getVieoUrl', params=params).json()
data = res['data']
if data:
status = data['status']
if status == 2:
return data['url']
else:
raise Exception('未开播')
else:
raise Exception('直播间不存在')
def get_real_url(rid):
try:
yqs = YQS(rid)
return yqs.get_real_url()
except Exception as e:
print('Exception:', e)
return False
if __name__ == '__main__':
r = input('输入艺气山直播房间号:\n')
print(get_real_url(r))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chuangyeba/real-url.git
git@gitee.com:chuangyeba/real-url.git
chuangyeba
real-url
real-url
master

搜索帮助