1
0
mirror of https://github.com/wbt5/real-url.git synced 2025-06-16 15:59:57 +08:00

Add LiveU (#243)

This commit is contained in:
wbt5 2021-08-15 16:15:31 +08:00
parent 5d4dfb3a10
commit 63bb22457f
No known key found for this signature in database
GPG Key ID: 92D5C42E815A2BD6

34
liveu.py Normal file
View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# @Time: 2021/8/15 14:09
# @Project: my-spiders
# @Author: wbt5
# @Blog: https://wbt5.com
import requests
class liveU:
def __init__(self, rid):
self.rid = rid
def get_real_url(self):
with requests.Session() as s:
url = f'https://mobile.liveu.me/appgw/v2/watchstartweb?sessionid=&vid={self.rid}'
res = s.get(url).json()
play_url = res['retinfo']['play_url'] if res['retval'] == 'ok' else '不存在或未开播'
return play_url
def get_real_url(rid):
try:
url = liveU(rid)
return url.get_real_url()
except Exception as e:
print('Exception', e)
return False
if __name__ == '__main__':
r = input('输入liveU直播房间号\n')
print(get_real_url(r))