diff --git a/README_PYPI.md b/README_PYPI.md index 3a41700..36614ad 100644 --- a/README_PYPI.md +++ b/README_PYPI.md @@ -65,7 +65,7 @@ asyncio.run(main()) | Bigo | ✅ | ✅ | ❌ | | Blued | ✅ | ✅ | ❌ | | SOOP | ✅ | ✅ | ❌ | -| 网易CC | ✅ | ❌ | ✅ | +| 网易CC | ✅ | ✅ | ✅ | | 千度热播 | ✅ | ❌ | ✅ | | PandaTV | ✅ | ✅ | ❌ | | 猫耳FM | ✅ | ✅ | ✅ | diff --git a/main.py b/main.py index 3173ecd..6c00a1e 100644 --- a/main.py +++ b/main.py @@ -4,8 +4,8 @@ Author: Hmily GitHub: https://github.com/ihmily Date: 2023-07-17 23:52:05 -Update: 2025-01-26 00:05:00 -Copyright (c) 2023-2024 by Hmily, All Rights Reserved. +Update: 2025-02-06 02:05:00 +Copyright (c) 2023-2025 by Hmily, All Rights Reserved. Function: Record live stream video. """ import asyncio @@ -38,7 +38,7 @@ from ffmpeg_install import ( check_ffmpeg, ffmpeg_path, current_env_path ) -version = "v4.0.2" +version = "v4.0.3" platforms = ("\n国内站点:抖音|快手|虎牙|斗鱼|YY|B站|小红书|bigo|blued|网易CC|千度热播|猫耳FM|Look|TwitCasting|百度|微博|" "酷狗|花椒|流星|Acfun|畅聊|映客|音播|知乎|嗨秀|VV星球|17Live|浪Live|漂漂|六间房|乐嗨|花猫|淘宝|京东" "\n海外站点:TikTok|SOOP|PandaTV|WinkTV|FlexTV|PopkonTV|TwitchTV|LiveMe|ShowRoom|CHZZK|Shopee|" @@ -1979,4 +1979,4 @@ while True: t2.start() first_run = False - time.sleep(3) \ No newline at end of file + time.sleep(3) diff --git a/pyproject.toml b/pyproject.toml index c6b89f1..799860b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "streamget" -version = "4.0.2" +version = "4.0.3" description = "A simple and efficient tool to fetch live stream URLs from various platforms. Supports multiple platforms and easy integration." authors = [{ name = "Hmily" }] license = {text = "MIT"} diff --git a/setup.py b/setup.py index 30fb9e3..c6f1821 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup( name='streamget', - version='4.0.2', + version='4.0.3', author='Hmily', description='A simple and efficient tool to fetch live stream URLs from various platforms. Supports multiple ' 'platforms and easy integration.', diff --git a/streamget/spider.py b/streamget/spider.py index aa01f71..4aea9aa 100644 --- a/streamget/spider.py +++ b/streamget/spider.py @@ -4,8 +4,8 @@ Author: Hmily GitHub: https://github.com/ihmily Date: 2023-07-15 23:15:00 -Update: 2025-02-04 04:58:16 -Copyright (c) 2023-2024 by Hmily, All Rights Reserved. +Update: 2025-02-06 02:29:16 +Copyright (c) 2023-2025 by Hmily, All Rights Reserved. Function: Get live stream data. """ @@ -1049,14 +1049,14 @@ async def get_netease_stream_data(url: str, proxy_addr: OptionalStr = None, cook room_data = json_data['props']['pageProps']['roomInfoInitData'] live_data = room_data['live'] result = {"is_live": False} - if 'quickplay' not in live_data: - result["anchor_name"] = room_data['nickname'] - else: + live_status = live_data.get('status') == 1 + result["anchor_name"] = live_data.get('nickname', room_data.get('nickname')) + if live_status: result |= { - 'anchor_name': live_data['nickname'], 'is_live': True, 'title': live_data['title'], - 'stream_list': live_data['quickplay'] + 'stream_list': live_data.get('quickplay'), + 'm3u8_url': live_data.get('sharefile') } return result @@ -3006,4 +3006,4 @@ async def get_faceit_stream_data(url: str, proxy_addr: OptionalStr = None, cooki result['anchor_name'] = anchor_name else: result = {'anchor_name': anchor_name, 'is_live': False} - return result + return result \ No newline at end of file diff --git a/streamget/stream.py b/streamget/stream.py index c40cd49..acf7212 100644 --- a/streamget/stream.py +++ b/streamget/stream.py @@ -4,8 +4,8 @@ Author: Hmily GitHub: https://github.com/ihmily Date: 2023-07-15 23:15:00 -Update: 2024-10-27 17:15:00 -Copyright (c) 2023-2024 by Hmily, All Rights Reserved. +Update: 2025-02-06 02:28:00 +Copyright (c) 2023-2025 by Hmily, All Rights Reserved. Function: Get live stream data. """ import base64 @@ -357,23 +357,29 @@ async def get_bilibili_stream_url(json_data: dict, video_quality: str, proxy_add async def get_netease_stream_url(json_data: dict, video_quality: str) -> dict: if not json_data['is_live']: return json_data - stream_list = json_data['stream_list']['resolution'] - order = ['blueray', 'ultra', 'high', 'standard'] - sorted_keys = [key for key in order if key in stream_list] - while len(sorted_keys) < 5: - sorted_keys.append(sorted_keys[-1]) - video_quality, quality_index = get_quality_index(video_quality) - selected_quality = sorted_keys[quality_index] - flv_url_list = stream_list[selected_quality]['cdn'] - selected_cdn = list(flv_url_list.keys())[0] - flv_url = flv_url_list[selected_cdn] + + m3u8_url = json_data['m3u8_url'] + flv_url = None + if json_data.get('stream_list'): + stream_list = json_data['stream_list']['resolution'] + order = ['blueray', 'ultra', 'high', 'standard'] + sorted_keys = [key for key in order if key in stream_list] + while len(sorted_keys) < 5: + sorted_keys.append(sorted_keys[-1]) + video_quality, quality_index = get_quality_index(video_quality) + selected_quality = sorted_keys[quality_index] + flv_url_list = stream_list[selected_quality]['cdn'] + selected_cdn = list(flv_url_list.keys())[0] + flv_url = flv_url_list[selected_cdn] + return { "is_live": True, "anchor_name": json_data['anchor_name'], "title": json_data['title'], 'quality': video_quality, + "m3u8_url": m3u8_url, "flv_url": flv_url, - "record_url": flv_url + "record_url": flv_url or m3u8_url } @@ -412,4 +418,4 @@ async def get_stream_url(json_data: dict, video_quality: str, url_type: str = 'm data |= {"flv_url": flv_url, "record_url": flv_url} data['title'] = json_data.get('title') data['quality'] = video_quality - return data + return data \ No newline at end of file