-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
推送本地视频到b站直播间 | ||
# 推送本地视频到b站直播间 | ||
|
||
## 使用说明 | ||
|
||
本项目依赖 `requests` 和 `qrcode`,可以直接使用 `pip` 安装: | ||
|
||
``` | ||
pip install -r requirements.txt | ||
``` | ||
|
||
使用二维码登录并生成 `cookie.json`: | ||
|
||
``` | ||
from utils.blivex import Bilibili | ||
bili = Bilibili() | ||
bili.login_with_qrcode("./data/cookie.json") # 可以自定义 `cookie.json` 的存储位置 | ||
``` | ||
|
||
生成 `cookie.json` 之后便可以直接用 `cookie` 登录: | ||
|
||
``` | ||
bili.login_with_cookie("./data/cookie.json") | ||
``` | ||
|
||
推送本地视频到直播间示例: | ||
|
||
``` | ||
bili.start_live() # 开启直播间 | ||
rtmp_addr = bili.get_rtmp() # 获取直播 rtmp 地址 | ||
ffmpeg -i "./本地视频.mp4" -c copy rtmp_addr # 使用 ffmpeg 推流 | ||
bili.send_dm("弹幕") # 发送弹幕 | ||
bili.stop_live() # 关闭直播间 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
requests==2.26.0 | ||
qrcode==7.4.2 |