Skip to content

Commit ae85de4

Browse files
WIndFateclaude
andcommitted
Split README into per-language files and add CLAUDE.md
- README.md: English only, links to translated docs - docs/README_zh.md: Chinese documentation - docs/README_ja.md: Japanese documentation - CLAUDE.md: project conventions and development guide Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1616a73 commit ae85de4

4 files changed

Lines changed: 230 additions & 124 deletions

File tree

CLAUDE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# CLAUDE.md
2+
3+
## Project Overview
4+
5+
Bili-Streamer is a cross-platform Bilibili live stream management tool that simulates the official Android BiliLive client. It provides both a PyQt6 GUI and a CLI interface.
6+
7+
## Architecture
8+
9+
- `bilibili_stream.py` — Core API layer. All Bilibili API interactions live here (login, start/stop live, category/title management, device fingerprint). Both GUI and CLI consume this as a library.
10+
- `gui.py` — PyQt6 GUI application. Imports functions from `bilibili_stream.py`. All network calls run in `QThread` workers to keep the UI responsive.
11+
- `bili_config/` — Runtime config directory. `config.json` (credentials, gitignored), `device.json` (fingerprint, gitignored), `settings.json` (preferences, tracked).
12+
13+
## Key Design Decisions
14+
15+
- **Single global DeviceFingerprint instance** — accessed via `get_device_fp()` singleton. All functions share the same device identity for consistency.
16+
- **Single global requests.Session** — accessed via `get_http_session()`. Reuses TCP connections and enforces 30s default timeout.
17+
- **Device fingerprint is persisted to `device.json`** — generated once, reused across sessions. All header fields (BUVID, Display-ID, Session-ID, network type) are stable per device.
18+
- **BUVID format** — must be `XX` + 32-char lowercase hex (MD5). Never use `random.sample` with uppercase chars.
19+
- **Build number consistency** — all API calls must read `build` from `device_fp.fingerprint["build_number"]`, never hardcode.
20+
21+
## Anti-Detection / Risk Control Rules
22+
23+
These are critical for avoiding account bans:
24+
25+
- Never randomize per-request fields that real clients keep stable (Display-ID, Session-ID, network type in UA)
26+
- User-Agent must not contain identifiable third-party markers (no hardcoded emails, tool names)
27+
- Use `except Exception:` not bare `except:` — bare except catches KeyboardInterrupt/SystemExit
28+
- All HTTP requests must go through `get_http_session()` with timeout
29+
- APP_KEY `1d8b6e7d45233436` and APP_SECRET are the standard Android client keys — do not change unless Bilibili revokes them
30+
31+
## Development Commands
32+
33+
```bash
34+
# Activate virtual environment
35+
source venv/bin/activate # Windows: venv\Scripts\activate
36+
37+
# Run GUI
38+
python gui.py
39+
40+
# Run CLI
41+
python bilibili_stream.py
42+
43+
# Syntax check
44+
python -c "import py_compile; py_compile.compile('bilibili_stream.py', doraise=True)"
45+
python -c "import py_compile; py_compile.compile('gui.py', doraise=True)"
46+
47+
# Build standalone executable
48+
pip install pyinstaller
49+
pyinstaller --onefile --windowed --name "Bili-Streamer" gui.py
50+
```
51+
52+
## Sensitive Files (gitignored)
53+
54+
- `bili_config/config.json` — contains SESSDATA, bili_jct cookies
55+
- `bili_config/device.json` — contains device fingerprint
56+
57+
Never commit these files. Never log cookie values in print/log output.

README.md

Lines changed: 9 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A cross-platform tool for managing Bilibili live streams. Simulates the official Android streaming client to start/stop broadcasts, change stream categories, and update titles — with both a GUI and CLI interface.
44

5-
**[中文](#中文) | [日本語](#日本語)**
5+
**[中文文档](docs/README_zh.md) | [日本語ドキュメント](docs/README_ja.md)**
66

77
---
88

@@ -64,7 +64,11 @@ python bilibili_stream.py -q
6464
python bilibili_stream.py -l
6565
```
6666

67-
## Build Standalone Executable
67+
## Download
68+
69+
Pre-built executables for **macOS** and **Windows** are available on the [Releases](https://github.com/WIndFate/Bili-Streamer/releases) page. No Python installation required.
70+
71+
## Build from Source
6872

6973
```bash
7074
pip install pyinstaller
@@ -81,6 +85,9 @@ The output will be in the `dist/` folder.
8185
├── requirements.txt # Python dependencies
8286
├── bili_config/
8387
│ └── settings.json # Saved preferences (category, title)
88+
├── docs/
89+
│ ├── README_zh.md # 中文文档
90+
│ └── README_ja.md # 日本語ドキュメント
8491
└── .gitignore
8592
```
8693

@@ -91,125 +98,3 @@ This tool is for **personal and educational use only**. Use at your own risk. Th
9198
## License
9299

93100
MIT
94-
95-
---
96-
97-
<a id="中文"></a>
98-
99-
## 中文
100-
101-
# Bili-Streamer
102-
103-
跨平台的B站直播管理工具。模拟官方 Android 直播姬客户端,支持开播/停播、切换分区、修改标题,提供 GUI 图形界面和命令行两种使用方式。
104-
105-
### 功能
106-
107-
- **扫码登录** — 使用B站APP扫码即可登录
108-
- **一键开播/停播** — 简单的直播控制
109-
- **分区选择** — 树形分区列表,自动记忆上次选择
110-
- **标题管理** — 自动保存上次使用的标题
111-
- **设备指纹** — 持久化的真实设备标识,降低风控风险
112-
- **双界面** — PyQt6 图形界面或命令行
113-
114-
### 安装
115-
116-
```bash
117-
git clone https://github.com/WIndFate/Bili-Streamer.git
118-
cd Bili-Streamer
119-
python -m venv venv
120-
source venv/bin/activate # Windows: venv\Scripts\activate
121-
pip install -r requirements.txt
122-
```
123-
124-
### 使用
125-
126-
```bash
127-
# 图形界面(推荐)
128-
python gui.py
129-
130-
# 命令行 - 交互式开播
131-
python bilibili_stream.py
132-
133-
# 命令行 - 指定标题开播
134-
python bilibili_stream.py -t "直播标题"
135-
136-
# 切换分区(直播中)
137-
python bilibili_stream.py -c
138-
139-
# 停止直播
140-
python bilibili_stream.py -q
141-
```
142-
143-
### 打包为独立程序
144-
145-
```bash
146-
pip install pyinstaller
147-
pyinstaller --onefile --windowed --name "Bili-Streamer" gui.py
148-
```
149-
150-
生成的文件在 `dist/` 目录下。
151-
152-
### 免责声明
153-
154-
本工具仅供**个人学习和研究使用**,使用风险自负。作者不对因使用本工具导致的任何账号限制承担责任。
155-
156-
---
157-
158-
<a id="日本語"></a>
159-
160-
## 日本語
161-
162-
# Bili-Streamer
163-
164-
Bilibiliライブ配信を管理するクロスプラットフォームツール。公式Androidクライアントをシミュレートし、配信の開始・停止、カテゴリ変更、タイトル更新をGUIとCLIの両方で操作できます。
165-
166-
### 機能
167-
168-
- **QRコードログイン** — Bilibiliアプリでスキャンして認証
169-
- **ワンクリック配信制御** — 開始・停止をボタン一つで
170-
- **カテゴリ選択** — ツリー表示で簡単選択、前回の選択を記憶
171-
- **タイトル管理** — 前回使用したタイトルを自動保存
172-
- **デバイスフィンガープリント** — リスク軽減のための永続的なデバイスID
173-
- **デュアルインターフェース** — PyQt6 GUI またはコマンドライン
174-
175-
### インストール
176-
177-
```bash
178-
git clone https://github.com/WIndFate/Bili-Streamer.git
179-
cd Bili-Streamer
180-
python -m venv venv
181-
source venv/bin/activate # Windows: venv\Scripts\activate
182-
pip install -r requirements.txt
183-
```
184-
185-
### 使い方
186-
187-
```bash
188-
# GUI(推奨)
189-
python gui.py
190-
191-
# CLI - 対話式で配信開始
192-
python bilibili_stream.py
193-
194-
# CLI - タイトル指定で配信開始
195-
python bilibili_stream.py -t "配信タイトル"
196-
197-
# カテゴリ変更(配信中)
198-
python bilibili_stream.py -c
199-
200-
# 配信停止
201-
python bilibili_stream.py -q
202-
```
203-
204-
### スタンドアロン実行ファイルのビルド
205-
206-
```bash
207-
pip install pyinstaller
208-
pyinstaller --onefile --windowed --name "Bili-Streamer" gui.py
209-
```
210-
211-
出力は `dist/` フォルダに生成されます。
212-
213-
### 免責事項
214-
215-
本ツールは**個人的な学習・研究目的のみ**を対象としています。使用は自己責任で行ってください。本ツールの使用により生じたアカウント制限について、作者は一切の責任を負いません。

docs/README_ja.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Bili-Streamer
2+
3+
Bilibiliライブ配信を管理するクロスプラットフォームツール。公式Androidクライアントをシミュレートし、配信の開始・停止、カテゴリ変更、タイトル更新をGUIとCLIの両方で操作できます。
4+
5+
**[English](../README.md) | [中文](README_zh.md)**
6+
7+
---
8+
9+
## 機能
10+
11+
- **QRコードログイン** — Bilibiliアプリでスキャンして認証
12+
- **ワンクリック配信制御** — 開始・停止をボタン一つで
13+
- **カテゴリ選択** — ツリー表示で簡単選択、前回の選択を記憶
14+
- **タイトル管理** — 前回使用したタイトルを自動保存
15+
- **デバイスフィンガープリント** — リスク軽減のための永続的なデバイスID
16+
- **デュアルインターフェース** — PyQt6 GUI またはコマンドライン
17+
18+
## 動作環境
19+
20+
- Python 3.11+
21+
- 依存パッケージ:`requests``qrcode[pil]``Pillow``PyQt6`
22+
23+
## インストール
24+
25+
```bash
26+
git clone https://github.com/WIndFate/Bili-Streamer.git
27+
cd Bili-Streamer
28+
python -m venv venv
29+
source venv/bin/activate # Windows: venv\Scripts\activate
30+
pip install -r requirements.txt
31+
```
32+
33+
## 使い方
34+
35+
### GUI(推奨)
36+
37+
```bash
38+
python gui.py
39+
```
40+
41+
### コマンドライン
42+
43+
```bash
44+
# 対話式で配信開始
45+
python bilibili_stream.py
46+
47+
# タイトル指定で配信開始
48+
python bilibili_stream.py -t "配信タイトル"
49+
50+
# 強制再開始
51+
python bilibili_stream.py -r
52+
53+
# カテゴリ変更(配信中)
54+
python bilibili_stream.py -c
55+
56+
# 配信停止
57+
python bilibili_stream.py -q
58+
59+
# 全カテゴリ一覧
60+
python bilibili_stream.py -l
61+
```
62+
63+
## ダウンロード
64+
65+
[Releases](https://github.com/WIndFate/Bili-Streamer/releases) ページから **macOS****Windows** の実行ファイルをダウンロードできます。Pythonのインストールは不要です。
66+
67+
## ソースからビルド
68+
69+
```bash
70+
pip install pyinstaller
71+
pyinstaller --onefile --windowed --name "Bili-Streamer" gui.py
72+
```
73+
74+
出力は `dist/` フォルダに生成されます。
75+
76+
## 免責事項
77+
78+
本ツールは**個人的な学習・研究目的のみ**を対象としています。使用は自己責任で行ってください。本ツールの使用により生じたアカウント制限について、作者は一切の責任を負いません。
79+
80+
## ライセンス
81+
82+
MIT

docs/README_zh.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Bili-Streamer
2+
3+
跨平台的B站直播管理工具。模拟官方 Android 直播姬客户端,支持开播/停播、切换分区、修改标题,提供 GUI 图形界面和命令行两种使用方式。
4+
5+
**[English](../README.md) | [日本語](README_ja.md)**
6+
7+
---
8+
9+
## 功能
10+
11+
- **扫码登录** — 使用B站APP扫码即可登录
12+
- **一键开播/停播** — 简单的直播控制
13+
- **分区选择** — 树形分区列表,自动记忆上次选择
14+
- **标题管理** — 自动保存上次使用的标题
15+
- **设备指纹** — 持久化的真实设备标识,降低风控风险
16+
- **双界面** — PyQt6 图形界面或命令行
17+
18+
## 环境要求
19+
20+
- Python 3.11+
21+
- 依赖库:`requests``qrcode[pil]``Pillow``PyQt6`
22+
23+
## 安装
24+
25+
```bash
26+
git clone https://github.com/WIndFate/Bili-Streamer.git
27+
cd Bili-Streamer
28+
python -m venv venv
29+
source venv/bin/activate # Windows: venv\Scripts\activate
30+
pip install -r requirements.txt
31+
```
32+
33+
## 使用方法
34+
35+
### 图形界面(推荐)
36+
37+
```bash
38+
python gui.py
39+
```
40+
41+
### 命令行
42+
43+
```bash
44+
# 交互式开播
45+
python bilibili_stream.py
46+
47+
# 指定标题开播
48+
python bilibili_stream.py -t "直播标题"
49+
50+
# 强制重新开播
51+
python bilibili_stream.py -r
52+
53+
# 切换分区(直播中)
54+
python bilibili_stream.py -c
55+
56+
# 停止直播
57+
python bilibili_stream.py -q
58+
59+
# 列出所有分区
60+
python bilibili_stream.py -l
61+
```
62+
63+
## 下载
64+
65+
可以在 [Releases](https://github.com/WIndFate/Bili-Streamer/releases) 页面直接下载 **macOS****Windows** 的可执行文件,无需安装 Python。
66+
67+
## 从源码打包
68+
69+
```bash
70+
pip install pyinstaller
71+
pyinstaller --onefile --windowed --name "Bili-Streamer" gui.py
72+
```
73+
74+
生成的文件在 `dist/` 目录下。
75+
76+
## 免责声明
77+
78+
本工具仅供**个人学习和研究使用**,使用风险自负。作者不对因使用本工具导致的任何账号限制承担责任。
79+
80+
## 许可证
81+
82+
MIT

0 commit comments

Comments
 (0)