mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2025-12-26 05:48:32 +08:00
feat: add yingke live record
This commit is contained in:
parent
dc2b854054
commit
dbd854fd90
10
README.md
10
README.md
@ -44,6 +44,7 @@
|
||||
- [x] ShowRoom
|
||||
- [x] Acfun
|
||||
- [x] 时光直播
|
||||
- [x] 映客直播
|
||||
- [ ] 更多平台正在更新中
|
||||
|
||||
</div>
|
||||
@ -192,6 +193,9 @@ https://live.acfun.cn/live/179922
|
||||
|
||||
时光直播:
|
||||
https://www.rengzu.com/180778
|
||||
|
||||
映客直播:
|
||||
https://www.inke.cn/liveroom/index.html?uid=22954469&id=1720860391070904
|
||||
```
|
||||
|
||||
直播间分享地址和网页端长地址都能正常进行录制(抖音尽量用长链接,避免因短链接转换失效导致不能正常录制,而且需要有nodejs环境,否则无法转换)。
|
||||
@ -315,13 +319,17 @@ docker-compose stop
|
||||
[](https://github.com/missuo)
|
||||
<a href="https://github.com/xueli12" target="_blank"><img src="https://github.com/xueli12.png?size=50" alt="xueli12" style="width:53px; height:51px;" /></a>
|
||||
<a href="https://github.com/kaine1973" target="_blank"><img src="https://github.com/kaine1973.png?size=50" alt="kaine1973" style="width:53px; height:51px;" /></a>
|
||||
<a href="https://github.com/Max-Tortoise" target="_blank"><img src="https://github.com/Max-Tortoise.png?size=50" alt="Max-Tortoise" style="width:53px; height:51px;" /></a>
|
||||
 
|
||||
|
||||
## ⏳提交日志
|
||||
|
||||
- 20240713
|
||||
- 新增映客直播录制
|
||||
|
||||
- 20240705
|
||||
- 新增时光直播录制
|
||||
|
||||
|
||||
- 20240701
|
||||
- 修复虎牙直播录制2分钟断流问题
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@ liuxing_cookie =
|
||||
showroom_cookie =
|
||||
acfun_cookie =
|
||||
shiguang_cookie =
|
||||
yingke_cookie =
|
||||
|
||||
[Authorization]
|
||||
popkontv_token =
|
||||
|
||||
20
main.py
20
main.py
@ -61,7 +61,8 @@ from spider import (
|
||||
get_showroom_stream_data,
|
||||
get_acfun_stream_data,
|
||||
get_huya_app_stream_url,
|
||||
get_shiguang_stream_url
|
||||
get_shiguang_stream_url,
|
||||
get_yingke_stream_url
|
||||
)
|
||||
|
||||
from utils import (
|
||||
@ -70,9 +71,10 @@ from utils import (
|
||||
)
|
||||
from msg_push import dingtalk, xizhi, tg_bot
|
||||
|
||||
version = "v3.0.6"
|
||||
platforms = "\n国内站点:抖音|快手|虎牙|斗鱼|YY|B站|小红书|bigo|blued|网易CC|千度热播|猫耳FM|Look|TwitCasting|百度|微博|酷狗|LiveMe|花椒|流星|Acfun" \
|
||||
"\n海外站点:TikTok|AfreecaTV|PandaTV|WinkTV|FlexTV|PopkonTV|TwitchTV|ShowRoom"
|
||||
version = "v3.0.7"
|
||||
platforms = ("\n国内站点:抖音|快手|虎牙|斗鱼|YY|B站|小红书|bigo|blued|网易CC|千度热播|猫耳FM|Look|TwitCasting|百度|微博|"
|
||||
"酷狗|LiveMe|花椒|流星|Acfun|时光|映客"
|
||||
"\n海外站点:TikTok|AfreecaTV|PandaTV|WinkTV|FlexTV|PopkonTV|TwitchTV|ShowRoom")
|
||||
|
||||
recording = set()
|
||||
unrecording = set()
|
||||
@ -96,7 +98,7 @@ url_config_file = f'{script_path}/config/URL_config.ini'
|
||||
backup_dir = f'{script_path}/backup_config'
|
||||
encoding = 'utf-8-sig'
|
||||
rstr = r"[\/\\\:\*\?\"\<\>\|&.。,, ]"
|
||||
ffmpeg_path = f"{script_path}/ffmpeg.exe" # ffmpeg文件路径
|
||||
ffmpeg_path = f"{script_path}/ffmpeg.exe"
|
||||
default_path = f'{script_path}/downloads'
|
||||
os.makedirs(default_path, exist_ok=True)
|
||||
file_update_lock = threading.Lock()
|
||||
@ -978,6 +980,12 @@ def start_record(url_data: tuple, count_variable: int = -1):
|
||||
with semaphore:
|
||||
port_info = get_shiguang_stream_url(
|
||||
url=record_url, proxy_addr=proxy_address, cookies=shiguang_cookie)
|
||||
|
||||
elif record_url.find("www.inke.cn/") > -1:
|
||||
platform = '映客直播'
|
||||
with semaphore:
|
||||
port_info = get_yingke_stream_url(
|
||||
url=record_url, proxy_addr=proxy_address, cookies=yingke_cookie)
|
||||
else:
|
||||
logger.error(f'{record_url} 未知直播地址')
|
||||
return
|
||||
@ -1714,6 +1722,7 @@ while True:
|
||||
showroom_cookie = read_config_value(config, 'Cookie', 'showroom_cookie', '')
|
||||
acfun_cookie = read_config_value(config, 'Cookie', 'acfun_cookie', '')
|
||||
shiguang_cookie = read_config_value(config, 'Cookie', 'shiguang_cookie', '')
|
||||
yingke_cookie = read_config_value(config, 'Cookie', 'yingke_cookie', '')
|
||||
|
||||
if len(video_save_type) > 0:
|
||||
if video_save_type.upper().lower() == "FLV".lower():
|
||||
@ -1811,6 +1820,7 @@ while True:
|
||||
'm.acfun.cn',
|
||||
'www.rengzu.com',
|
||||
'wap.rengzu.com',
|
||||
'www.inke.cn'
|
||||
]
|
||||
overseas_platform_host = [
|
||||
'www.tiktok.com',
|
||||
|
||||
41
spider.py
41
spider.py
@ -2273,6 +2273,43 @@ def get_shiguang_stream_url(url: str, proxy_addr: Union[str, None] = None, cooki
|
||||
return result
|
||||
|
||||
|
||||
@trace_error_decorator
|
||||
def get_yingke_stream_url(url: str, proxy_addr: Union[str, None] = None, cookies: Union[str, None] = None) -> \
|
||||
Dict[str, Any]:
|
||||
headers = {
|
||||
'Referer': 'https://www.inke.cn/',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0',
|
||||
}
|
||||
if cookies:
|
||||
headers['Cookie'] = cookies
|
||||
|
||||
parsed_url = urllib.parse.urlparse(url)
|
||||
query_params = urllib.parse.parse_qs(parsed_url.query)
|
||||
uid = query_params['uid'][0]
|
||||
live_id = query_params['id'][0]
|
||||
params = {
|
||||
'uid': uid,
|
||||
'id': live_id,
|
||||
'_t': str(int(time.time())),
|
||||
}
|
||||
|
||||
api = f'https://webapi.busi.inke.cn/web/live_share_pc?{urllib.parse.urlencode(params)}'
|
||||
json_str = get_req(api, proxy_addr=proxy_addr, headers=headers)
|
||||
json_data = json.loads(json_str)
|
||||
anchor_name = json_data['data']['media_info']['nick']
|
||||
live_status = json_data['data']['status']
|
||||
|
||||
result = {"anchor_name": anchor_name, "is_live": False}
|
||||
if live_status == 1:
|
||||
m3u8_url = json_data['data']['live_addr'][0]['hls_stream_addr']
|
||||
flv_url = json_data['data']['live_addr'][0]['stream_addr']
|
||||
result["is_live"] = True
|
||||
result["m3u8_url"] = m3u8_url
|
||||
result["flv_url"] = flv_url
|
||||
result["record_url"] = m3u8_url
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 尽量用自己的cookie,以避免默认的不可用导致无法获取数据
|
||||
# 以下示例链接不保证时效性,请自行查看链接是否能正常访问
|
||||
@ -2316,6 +2353,7 @@ if __name__ == '__main__':
|
||||
# room_url = 'https://www.showroom-live.com/r/TPS0728' # showroom
|
||||
# room_url = 'https://live.acfun.cn/live/17912421' # Acfun
|
||||
# room_url = 'https://www.rengzu.com/180778' # 时光直播
|
||||
# room_url = 'https://www.inke.cn/liveroom/index.html?uid=710032101&id=1720857535354099' # 映客直播
|
||||
|
||||
print(get_douyin_stream_data(room_url, proxy_addr=''))
|
||||
# print(get_douyin_app_stream_data(room_url, proxy_addr=''))
|
||||
@ -2349,4 +2387,5 @@ if __name__ == '__main__':
|
||||
# print(get_liuxing_stream_url(room_url, proxy_addr=''))
|
||||
# print(get_showroom_stream_data(room_url, proxy_addr=''))
|
||||
# print(get_acfun_stream_data(room_url, proxy_addr=''))
|
||||
# print(get_shiguang_stream_url(room_url, proxy_addr=''))
|
||||
# print(get_shiguang_stream_url(room_url, proxy_addr=''))
|
||||
# print(get_yingke_stream_url(room_url, proxy_addr=''))
|
||||
Loading…
x
Reference in New Issue
Block a user