mirror of
https://github.com/wbt5/real-url.git
synced 2025-07-28 12:15:52 +08:00
新增陌陌直播源
This commit is contained in:
parent
9f594bd1d9
commit
17a1f788cb
31
immomo.py
Normal file
31
immomo.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
def immomo(rid):
|
||||||
|
url = 'https://web.immomo.com/webmomo/api/scene/profile/roominfos'
|
||||||
|
data = {
|
||||||
|
'stid': rid,
|
||||||
|
'src': 'url'
|
||||||
|
}
|
||||||
|
|
||||||
|
with requests.Session() as s:
|
||||||
|
s.get('https://web.immomo.com')
|
||||||
|
res = s.post(url, data=data).json()
|
||||||
|
|
||||||
|
ec = res.get('ec', 0)
|
||||||
|
if ec != 200:
|
||||||
|
raise Exception('请求参数错误')
|
||||||
|
else:
|
||||||
|
live = res['data']['live']
|
||||||
|
if live:
|
||||||
|
real_url = res['data']['url']
|
||||||
|
return real_url
|
||||||
|
else:
|
||||||
|
raise Exception('未开播')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
r = input('输入陌陌直播房间号:\n')
|
||||||
|
print(immomo(r))
|
||||||
|
|
||||||
|
# https://web.immomo.com/live/337033339
|
Loading…
x
Reference in New Issue
Block a user