유튜브 뮤직 쿠키 자동 갱신: 서버가 브라우저 탭처럼 10분마다 accounts.youtube.com/RotateCookies를 불러 새 __Secure-*PSIDTS·*SIDCC 값을 쿠키 파일에 그 형식 그대로 씀(collector/cookie-keeper.ts, cookie-jar.ts), 이어서 노래 검색으로 로그인 상태 확인. 만료(갱신 401/403·로그아웃 검색)는 관리자 → 수집 맨 위에 표시하고 새 파일이 들어올 때까지 갱신 멈춤(파일이 바뀌면 1분 안에 다시 확인). 원곡 찾기 YtMusic은 파일이 바뀌면 다시 읽고, 연령제한 음원 받기는 곡마다 새로 읽고 yt-dlp가 바꾼 값을 파일에 합침. compose: 쿠키 폴더를 쓰기 가능으로 연결(YT_COOKIE_PATH=/run/secrets/music_quiz/ytm_cookie.txt). 단위·관리자 API·e2e 테스트, docs 08·09·12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,7 +38,7 @@ export interface QuizAdminDeps {
|
||||
let searcher: Promise<(q: string) => Promise<YtmSong[]>> | null = null;
|
||||
function defaultSearch(q: string): Promise<YtmSong[]> {
|
||||
// Picked once per process: with the cookie when it is logged in, else plain YouTube (Topic channels first).
|
||||
searcher ??= pickSearcher(process.env.YT_COOKIE_PATH ?? '/run/secrets/ytm_cookie.txt', () => {}).then((s) => s.searchSongs);
|
||||
searcher ??= pickSearcher(process.env.YT_COOKIE_PATH ?? '/run/secrets/music_quiz/ytm_cookie.txt', () => {}).then((s) => s.searchSongs);
|
||||
return searcher.then((f) => f(q)).catch((e) => {
|
||||
searcher = null;
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user