mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2025-12-26 05:48:32 +08:00
fix bigo room_id parse and twitcasting login (#1194)
This commit is contained in:
parent
e80f1e653a
commit
3965487746
@ -772,7 +772,7 @@ async def get_bigo_stream_url(url: str, proxy_addr: OptionalStr = None, cookies:
|
|||||||
if '&h=' in url:
|
if '&h=' in url:
|
||||||
room_id = url.split('&h=')[-1]
|
room_id = url.split('&h=')[-1]
|
||||||
else:
|
else:
|
||||||
room_id = re.search('www.bigo.tv/cn/(\\w+)', url).group(1)
|
room_id = url.split("?")[0].rsplit("/", maxsplit=1)[-1]
|
||||||
|
|
||||||
data = {'siteId': room_id} # roomId
|
data = {'siteId': room_id} # roomId
|
||||||
url2 = 'https://ta.bigo.tv/official_website/studio/getInternalStudioInfo'
|
url2 = 'https://ta.bigo.tv/official_website/studio/getInternalStudioInfo'
|
||||||
@ -789,8 +789,16 @@ async def get_bigo_stream_url(url: str, proxy_addr: OptionalStr = None, cookies:
|
|||||||
result['record_url'] = m3u8_url
|
result['record_url'] = m3u8_url
|
||||||
result |= {"title": live_title, "is_live": True, "m3u8_url": m3u8_url, 'record_url': m3u8_url}
|
result |= {"title": live_title, "is_live": True, "m3u8_url": m3u8_url, 'record_url': m3u8_url}
|
||||||
elif result['anchor_name'] == '':
|
elif result['anchor_name'] == '':
|
||||||
html_str = await async_req(url=f'https://www.bigo.tv/cn/{room_id}', proxy_addr=proxy_addr, headers=headers)
|
html_str = await async_req(url=f'https://www.bigo.tv/{url.split("/")[3]}/{room_id}',
|
||||||
result['anchor_name'] = re.search('<title>欢迎来到(.*?)的直播间</title>', html_str, re.DOTALL).group(1)
|
proxy_addr=proxy_addr, headers=headers)
|
||||||
|
match_anchor_name = re.search('<title>欢迎来到(.*?)的直播间</title>', html_str, re.DOTALL)
|
||||||
|
if match_anchor_name:
|
||||||
|
anchor_name = match_anchor_name.group(1)
|
||||||
|
else:
|
||||||
|
match_anchor_name = re.search('<meta data-n-head="ssr" data-hid="og:title" property="og:title" '
|
||||||
|
'content="(.*?) - BIGO LIVE">', html_str, re.DOTALL)
|
||||||
|
anchor_name = match_anchor_name.group(1)
|
||||||
|
result['anchor_name'] = anchor_name
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -1711,7 +1719,7 @@ async def login_twitcasting(
|
|||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
cookie_dict = await async_req(login_api, proxy_addr=proxy_addr, headers=headers,
|
cookie_dict = await async_req(login_api, proxy_addr=proxy_addr, headers=headers,
|
||||||
json_data=data, return_cookies=True, timeout=20)
|
data=data, return_cookies=True, timeout=20)
|
||||||
if 'tc_ss' in cookie_dict:
|
if 'tc_ss' in cookie_dict:
|
||||||
cookie = utils.dict_to_cookie_str(cookie_dict)
|
cookie = utils.dict_to_cookie_str(cookie_dict)
|
||||||
return cookie
|
return cookie
|
||||||
@ -3238,4 +3246,4 @@ async def get_picarto_stream_url(url: str, proxy_addr: OptionalStr = None, cooki
|
|||||||
title = json_data['channel']['title']
|
title = json_data['channel']['title']
|
||||||
m3u8_url = f"https://1-edge1-us-newyork.picarto.tv/stream/hls/golive+{anchor_name}/index.m3u8"
|
m3u8_url = f"https://1-edge1-us-newyork.picarto.tv/stream/hls/golive+{anchor_name}/index.m3u8"
|
||||||
result |= {'is_live': True, 'title': title, 'm3u8_url': m3u8_url, 'record_url': m3u8_url}
|
result |= {'is_live': True, 'title': title, 'm3u8_url': m3u8_url, 'record_url': m3u8_url}
|
||||||
return result
|
return result
|
||||||
Loading…
x
Reference in New Issue
Block a user