Skip to content

Commit 271a536

Browse files
committed
fix: update TTinglive
1 parent d77760f commit 271a536

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,10 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
752752
utils.update_config(
753753
config_file, 'Cookie', 'flextv_cookie', json_data['new_cookies']
754754
)
755-
port_info = asyncio.run(stream.get_stream_url(json_data, record_quality, spec=True))
755+
if 'play_url_list' in json_data:
756+
port_info = asyncio.run(stream.get_stream_url(json_data, record_quality, spec=True))
757+
else:
758+
port_info = json_data
756759
else:
757760
logger.error("错误信息: 网络异常,请检查本网络是否能正常访问FlexTV直播平台")
758761

@@ -1207,7 +1210,8 @@ def start_record(url_data: tuple, count_variable: int = -1) -> None:
12071210
if show_url:
12081211
re_plat = ('WinkTV', 'PandaTV', 'ShowRoom', 'CHZZK', 'Youtube')
12091212
if platform in re_plat:
1210-
logger.info(f"{platform} | {anchor_name} | 直播源地址: {port_info['m3u8_url']}")
1213+
logger.info(
1214+
f"{platform} | {anchor_name} | 直播源地址: {port_info.get('m3u8_url')}")
12111215
else:
12121216
logger.info(
12131217
f"{platform} | {anchor_name} | 直播源地址: {real_url}")

src/spider.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,11 +1375,15 @@ async def get_flextv_stream_data(
13751375
result["anchor_name"] = anchor_name
13761376
play_url = await get_flextv_stream_url(url=url, proxy_addr=proxy_addr, cookies=cookies)
13771377
if play_url:
1378-
play_url_list = await get_play_url_list(m3u8=play_url, proxy=proxy_addr, header=headers, abroad=True)
1379-
if play_url_list:
1380-
result['m3u8_url'] = play_url
1381-
result['play_url_list'] = play_url_list
1382-
result['is_live'] = True
1378+
result['is_live'] = True
1379+
if '.m3u8' in play_url:
1380+
play_url_list = await get_play_url_list(m3u8=play_url, proxy=proxy_addr, header=headers, abroad=True)
1381+
if play_url_list:
1382+
result['m3u8_url'] = play_url
1383+
result['play_url_list'] = play_url_list
1384+
else:
1385+
result['flv_url'] = play_url
1386+
result['record_url'] = play_url
13831387
else:
13841388
url2 = f'https://www.ttinglive.com/channels/{user_id}'
13851389
html_str = await async_req(url2, proxy_addr=proxy_addr, headers=headers, abroad=True)

0 commit comments

Comments
 (0)