大家好,这里是木木
今天给大家分享一个超酷的录制python库,DouyinLiveRecorder
DouyinLiveRecorder,一款简易的可循环值守的直播录制工具,基于FFmpeg实现多平台直播源录制,支持自定义配置录制以及直播状态推送。

😺已支持平台
-
抖音 -
TikTok -
快手 -
虎牙 -
斗鱼 -
YY -
B站 -
小红书 -
bigo -
blued -
AfreecaTV -
网易cc -
千度热播 -
pandaTV -
猫耳FM -
更多平台正在更新中
核心功能与特性
-
自动录制: 自动检测并录制指定抖音账号的直播。 -
视频保存: 自动保存直播视频至本地。 -
高度配置: 支持多种配置选项,如录制质量、保存路径等。
应用场景
-
内容创作者备份: 自动保存自己的直播内容。 -
分析竞争对手: 录制并分析竞争对手的直播策略。 -
学术研究: 收集数据进行社交媒体研究。
注意事项与最佳实践
-
遵守法律法规: 确保在法律允许的范围内使用。 -
定期更新: 保持库与API的兼容性。 -
性能考量: 根据设备性能合理设置录制参数。
示例代码
下面是一个可能的使用示例,用于启动DouyinLiveRecorder并录制直播:
-
配置直播间链接
抖音:
https://live.douyin.com/745964462470
https://v.douyin.com/iQFeBnt/
TikTok:
https://www.tiktok.com/@pearlgaga88/live
快手:
https://live.kuaishou.com/u/yall1102
虎牙:
https://www.huya.com/52333
斗鱼:
https://www.douyu.com/3637778?dyshid=
https://www.douyu.com/topic/wzDBLS6?rid=4921614&dyshid=
YY:
https://www.yy.com/22490906/22490906
B站:
https://live.bilibili.com/320
小红书:
https://www.redelight.cn/hina/livestream/569077534207413574/1707413727088?appuid=5f3f478a00000000010005b3&
bigo直播:
https://www.bigo.tv/cn/716418802
buled直播:
https://app.blued.cn/live?id=Mp6G2R
AfreecaTV:
https://play.afreecatv.com/sw7love
网易cc:
https://cc.163.com/583946984
(抖音尽量用长链接,避免因短链接转换失效导致不能正常录制,而且需要有nodejs环境,否则无法转换)
使用源码运行,前提有python环境,之后按如下步骤拉取代码并执行
# 1.拉取或手动下载本仓库项目代码
git clone https://github.com/ihmily/DouyinLiveRecorder.git
# 2.进入项目文件夹,安装依赖
cd DouyinLiveRecorder
pip3 install -r requirements.txt
# 3.运行程序
python main.py
程序示例源码
def create_ass_file(filegruop: list):
# TODO: 录制时生成ass格式的字幕文件
anchor_name = filegruop[0]
ass_filename = filegruop[1]
index_time = -1
finish = 0
today = datetime.datetime.now()
re_datatime = today.strftime('%Y-%m-%d %H:%M:%S')
while True:
index_time += 1
txt = str(index_time) + "n" + transform_int_to_time(index_time) + ',000 --> ' + transform_int_to_time(
index_time + 1) + ',000' + "n" + str(re_datatime) + "n"
with open(ass_filename + ".ass", 'a', encoding='utf8') as f:
f.write(txt)
if anchor_name not in recording:
finish += 1
offset = datetime.timedelta(seconds=1)
# 获取修改后的时间并格式化
re_datatime = (today + offset).strftime('%Y-%m-%d %H:%M:%S')
today = today + offset
else:
time.sleep(1)
today = datetime.datetime.now()
re_datatime = today.strftime('%Y-%m-%d %H:%M:%S')
if finish > 15:
break
总结
DouyinLiveRecorder提供了一种自动化方式来录制各平台直播,对于内容创作者、研究人员等用户来说是一个非常有价值的工具。使用时,确保遵循相关法律和平台规则,同时关注该库的项目地址的更新以保证软件的正常运行。
原文始发于微信公众号(木木夕咦):DouyinLiveRecorder,一款超酷的python库
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/228875.html