- 路径重构:脚本创作 V1.0/Lite1.0 扁平化(去技能文件夹层),分镜技能迁移至 短视频提示词生成/V1.0,旧路径清理 - 输出边界铁律固化:创作流程规范.md 新增「交付物输出边界(通用铁律)」+ S9 输出模板新增「输出边界」块(验收口径=执行约束非输出内容) - 开场钩子铁律三层固化:00_开场/06_编导终审/S9 相关规则 + S5 预设钩子口径区分(前3秒=呈现窗口,3-7秒=开场段总时长) - 帮助文档:新增「从账号分析到脚本创作」跨技能章节(你这样问|我会做什么风格) - mcn-dou-analysis 内嵌副本:红线边界声明+人设卡术语更新(设定分析说明)
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
筛选 TOP 视频 — 已整合到 excel_tool.py select-top6 子命令。
|
||
此文件保留向后兼容,实际调用 excel_tool.select_top6()(默认取6条)。
|
||
|
||
用法:
|
||
python select_top6.py <excel路径> [--count 6] [--output output.json]
|
||
|
||
新用法(推荐):
|
||
python excel_tool.py select-top6 <excel路径> [--count 6] [--output output.json]
|
||
"""
|
||
|
||
import sys
|
||
import os
|
||
|
||
# 确保能找到 excel_tool
|
||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||
from excel_tool import select_top6, HEADERS
|
||
import json
|
||
|
||
|
||
def main():
|
||
if len(sys.argv) < 2:
|
||
print("用法: python select_top6.py <excel路径> [--count 6] [--output output.json]")
|
||
print("推荐: python excel_tool.py select-top6 <excel路径> [--count 6] [--output output.json]")
|
||
sys.exit(1)
|
||
|
||
excel_path = os.path.expanduser(sys.argv[1])
|
||
if not os.path.exists(excel_path):
|
||
print(f"ERROR: 文件不存在: {excel_path}", file=sys.stderr)
|
||
sys.exit(1)
|
||
|
||
# 解析 --output
|
||
output = None
|
||
if '--output' in sys.argv:
|
||
idx = sys.argv.index('--output')
|
||
if idx + 1 < len(sys.argv):
|
||
output = sys.argv[idx + 1]
|
||
elif '-o' in sys.argv:
|
||
idx = sys.argv.index('-o')
|
||
if idx + 1 < len(sys.argv):
|
||
output = sys.argv[idx + 1]
|
||
|
||
# 解析 --count(默认6)
|
||
count = 6
|
||
if '--count' in sys.argv:
|
||
idx = sys.argv.index('--count')
|
||
if idx + 1 < len(sys.argv):
|
||
try:
|
||
count = int(sys.argv[idx + 1])
|
||
except ValueError:
|
||
pass
|
||
elif '-n' in sys.argv:
|
||
idx = sys.argv.index('-n')
|
||
if idx + 1 < len(sys.argv):
|
||
try:
|
||
count = int(sys.argv[idx + 1])
|
||
except ValueError:
|
||
pass
|
||
|
||
top6 = select_top6(excel_path, count=count)
|
||
|
||
print(f"筛选完成,共 {len(top6)} 条视频:")
|
||
for i, v in enumerate(top6):
|
||
print(f" {i+1}. {v['视频标题'][:30]}... | 赞:{v['点赞数']} 转:{v['分享数']} | {v['视频时长']} | {v['发布时间']}")
|
||
|
||
if output:
|
||
with open(output, 'w', encoding='utf-8') as f:
|
||
json.dump(top6, f, ensure_ascii=False, indent=2)
|
||
print(f"\n已保存到: {output}")
|
||
|
||
|
||
if __name__ == '__main__':
|
||
main()
|