Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install (editable, deps from pyproject)
run: pip install -e .
- name: Install (editable + dev deps from pyproject)
run: pip install -e ".[dev]"
- name: Syntax check (compile all scripts)
run: python -m compileall scripts
- name: Smoke test (console entry point)
run: viralens --help
- name: Unit tests
run: pytest
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ creators.py ──▶ fetch_multi.py ──▶ data/<alias>_videos.json (
- **Signal scanner** (`scan_signals`): turns each video into a universal feature vector, then auto-tests
every dimension (title patterns, length buckets, daypart, cover metrics…) for high/low-play separation,
ranks by effect size, and reports which levers are *universal* vs *creator-specific*.
- **L2 — text** (`subtitle`, `comments`): subtitles + hot comments → `jieba` keyword analysis.
- **L2 — text**: subtitles + hot comments → `jieba` keyword analysis (cross-creator comment-engagement test: `compare_meme.py`).
- **Cross-creator / cross-zone gate**: a pattern earns a ✅ only if it survives the *same test* on
multiple independent creators **and** more than one zone.

Expand Down
5 changes: 5 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Let pytest import the flat scripts/ modules without installing the package."""
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent / "scripts"))
6 changes: 3 additions & 3 deletions packaging/viralens.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ hiddenimports += [
"fetch_multi", "fetch_bilibili", "fetch_youtube",
"compare_form", "creator_profile", "scan_signals", "charts", "export_data", "build_report",
"diagnose", "analyze_video", "import_private",
"creators", "features", "benchmarks",
"classify_and_stats", "comments", "compare_meme", "fetch_covers",
"fetch_videos", "resolve_creators", "subtitle",
"creators", "features", "benchmarks", "shared_markers", "schema",
"compare_meme", "fetch_covers",
"resolve_creators",
]

# —— 只读资源:网页界面 + 配置模板 —— 放进打包根目录,app.py 用 runtime.ASSET_DIR 找它们 ——
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ classifiers = [
"Topic :: Scientific/Engineering :: Information Analysis",
]
dependencies = [
"bilibili-api-python>=17.0.0",
"bilibili-api-python>=17.0.0,<18.0.0",
"jieba>=0.42.1",
"matplotlib>=3.7.0",
"Pillow>=9.0.0",
"numpy>=1.23.0",
]

# 仅在「打包成桌面 app」时需要:原生窗口后端。源码 CLI / 网页界面都不依赖它
# gui = 打包成桌面 app 时的原生窗口后端;dev = 跑测试。源码 CLI / 网页界面都不依赖它们
[project.optional-dependencies]
gui = ["pywebview>=5.0"]
dev = ["pytest>=7.0"]

[project.urls]
Homepage = "https://github.com/HarryXin0919/viralens"
Expand All @@ -45,3 +46,6 @@ py-modules = ["viralens"]

[tool.setuptools.package-dir]
"" = "scripts"

[tool.pytest.ini_options]
testpaths = ["tests"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# viralens — runtime dependencies
# Install: pip install -r requirements.txt
bilibili-api-python>=17.0.0 # async Bilibili public-data access
bilibili-api-python>=17.0.0,<18.0.0 # async Bilibili public-data access (cap: 18.x may break API)
jieba>=0.42.1 # Chinese word segmentation (comment keyword analysis)
matplotlib>=3.7.0 # static README charts (PNG)
Pillow>=9.0.0 # cover-image analysis (optional step: fetch_covers.py)
Expand Down
6 changes: 3 additions & 3 deletions scripts/analyze_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
按需调用:用户在诊断页点「分析开头+配乐」才下这一条,不批量下 700 条。

命令行单测:
python analyze_video.py bidao BV1mT421Y7mE
python analyze_video.py mrbeast 0BjlBnfHcHM
python analyze_video.py bidao BV1mT421Y7mE --force # 忽略缓存重算
python analyze_video.py <alias> <vid> # 如 demo_b1 BVxxxxxxxxxx
python analyze_video.py <alias> <youtube_vid> # YouTube 视频 id
python analyze_video.py <alias> <vid> --force # 忽略缓存重算
"""
import base64
import json
Expand Down
119 changes: 0 additions & 119 deletions scripts/classify_and_stats.py

This file was deleted.

173 changes: 0 additions & 173 deletions scripts/comments.py

This file was deleted.

Loading
Loading