| 1 | from typing import Any, Dict |
| 2 | |
| 3 | DEFAULT_CONFIG: Dict[str, Any] = { |
| 4 | "path": "./Downloaded/", |
| 5 | "music": True, |
| 6 | "cover": True, |
| 7 | "avatar": True, |
| 8 | "json": True, |
| 9 | "start_time": "", |
| 10 | "end_time": "", |
| 11 | "folderstyle": True, |
| 12 | # 命名模板:渲染时可用变量见 utils/naming.py:ALLOWED_VARIABLES。默认保持 |
| 13 | # 与历史行为一致(`{date}_{title}_{id}`),用户可在设置中改写。 |
| 14 | "filename_template": "{date}_{title}_{id}", |
| 15 | "folder_template": "{date}_{title}_{id}", |
| 16 | # 作者目录层命名方式: |
| 17 | # "nickname" - 作者昵称(默认,最直观,但重名会合并、改名会分裂) |
| 18 | # "sec_uid" - 作者 sec_uid(稳定唯一,但不直观) |
| 19 | # "nickname_uid" - 昵称_sec_uid(直观 + 唯一) |
| 20 | # 切换只影响后续下载,不会迁移已存在的目录。 |
| 21 | "author_dir": "nickname", |
| 22 | "download_pinned": False, |
| 23 | "mode": ["post"], |
| 24 | "number": { |
| 25 | "post": 0, |
| 26 | "like": 0, |
| 27 | "allmix": 0, |
| 28 | "mix": 0, |
| 29 | "music": 0, |
| 30 | "collect": 0, |
| 31 | "collectmix": 0, |
| 32 | }, |
| 33 | "increase": { |
| 34 | "post": False, |
| 35 | "like": False, |
| 36 | "allmix": False, |
| 37 | "mix": False, |
| 38 | "music": False, |
| 39 | }, |
| 40 | "thread": 5, |
| 41 | "retry_times": 3, |
| 42 | "rate_limit": 2, |
| 43 | "proxy": "", |
| 44 | "database": True, |
| 45 | "database_path": "dy_downloader.db", |
| 46 | "progress": { |
| 47 | "quiet_logs": True, |
| 48 | }, |
| 49 | "transcript": { |
| 50 | "enabled": False, |
| 51 | "model": "gpt-4o-mini-transcribe", |
| 52 | "output_dir": "", |
| 53 | "response_formats": ["txt", "json"], |
| 54 | "api_url": "https://api.openai.com/v1/audio/transcriptions", |
| 55 | "api_key_env": "OPENAI_API_KEY", |
| 56 | "api_key": "", |
| 57 | # When true (default), the desktop sidecar runs the source video |
| 58 | # through ffmpeg locally and uploads only the extracted mono mp3 |
| 59 | # to the transcription endpoint. Saves bandwidth and avoids the |
| 60 | # OpenAI 25 MiB single-file ceiling. Set to false to fall back to |
| 61 | # uploading the source video itself (legacy behaviour). The UI |
| 62 | # deliberately does not surface this toggle — see |
| 63 | # ``.kiro/specs/transcript-audio-extract-and-ui`` Requirement 1. |
| 64 | "upload_audio_only": True, |
| 65 | }, |
| 66 | "auto_cookie": False, |
| 67 | "browser_fallback": { |
| 68 | "enabled": True, |
| 69 | "headless": False, |
| 70 | "max_scrolls": 240, |
| 71 | "idle_rounds": 8, |
| 72 | "wait_timeout_seconds": 600, |
| 73 | }, |
| 74 | # 下载完成通知(可选)。providers 支持 bark / telegram / webhook。 |
| 75 | "notifications": { |
| 76 | "enabled": False, |
| 77 | "on_success": True, |
| 78 | "on_failure": True, |
| 79 | "providers": [], |
| 80 | }, |
| 81 | # 评论采集(可选)。启用后每个作品会额外生成 *_comments.json。 |
| 82 | "comments": { |
| 83 | "enabled": False, |
| 84 | "include_replies": False, |
| 85 | "max_comments": 0, # 0 = 不限 |
| 86 | "page_size": 20, |
| 87 | }, |
| 88 | # 直播录制(可选)。由 live.douyin.com / /follow/live/ 链接触发。 |
| 89 | "live": { |
| 90 | "max_duration_seconds": 0, # 0 = 直到流结束 |
| 91 | "chunk_size": 65536, |
| 92 | "idle_timeout_seconds": 30, |
| 93 | }, |
| 94 | # REST API 服务模式(可选,需 fastapi + uvicorn)。 |
| 95 | "server": { |
| 96 | "max_jobs": 500, # 内存中保留的 job 条数上限(不含 in-flight) |
| 97 | "job_ttl_seconds": 86400, # 完成态 job 保留时间(秒) |
| 98 | }, |
| 99 | } |
| 100 |