Fix: [2.0.3] yt-dlp 쿠키 인증 추가, 문서 업데이트, CI/CD .md 스킵
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 4m40s

- yt-dlp에 쿠키 파일(/app/cookies.txt) 지원 추가 (YouTube 봇 감지 우회)
- CI/CD에 paths-ignore: **/*.md 추가하여 문서 수정 시 빌드 스킵
- 전체 문서 업데이트: 라우트 변경, 쿠키 인증 방식, n8n Expression 모드 안내
- .gitignore에 cookies.txt 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
sm4640
2026-03-24 15:45:12 +09:00
parent aaf5bd8d05
commit d4bd508618
9 changed files with 104 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ n8n (RSS 감지) → POST /api/news/summarize → 자막 추출 → Claude 요
| 모듈 | 역할 |
|------|------|
| `app/main.py` | FastAPI 엔드포인트 |
| `app/transcript.py` | YouTube 자막 추출 (yt-dlp) |
| `app/transcript.py` | YouTube 자막 추출 (yt-dlp + 쿠키 인증) |
| `app/summarizer.py` | Claude Sonnet 4.6으로 요약 생성 |
| `app/discord.py` | Discord 웹훅 전송 |
| `app/config.py` | 환경변수 설정 (pydantic-settings) |
@@ -45,9 +45,19 @@ docker build -t nkey/news-summary-bot .
docker compose up
```
### 쿠키 파일 (서버 배포 시 필수)
OCI 등 클라우드 서버에서는 YouTube가 데이터센터 IP를 봇으로 감지하여 자막 추출을 차단합니다. 이를 우회하기 위해 쿠키 파일이 필요합니다.
1. Chrome 확장 **Get cookies.txt LOCALLY**로 YouTube 쿠키 export
2. 서버에 `cookies.txt` 업로드
3. `compose.apps.yml`에서 볼륨 마운트: `./news-summary-bot/cookies.txt:/app/cookies.txt:ro`
> 쿠키는 6개월~1년 후 만료됩니다. 자막 추출 500 에러 발생 시 쿠키 재export가 필요합니다.
## API
### `POST /api/news/summarize`
### `POST /api/news/summarize` (외부) / `POST /summarize` (내부)
영상 URL을 받아 자막 추출 → 요약 → Discord 전송을 수행합니다.
@@ -72,10 +82,12 @@ docker compose up
}
```
### `GET /api/news/health`
### `GET /api/news/health` (외부) / `GET /health` (내부)
헬스 체크 엔드포인트.
> **참고:** Nginx가 `/api/news/` prefix를 strip하므로, FastAPI 내부 라우트는 `/summarize`, `/health`입니다. 외부에서는 `/api/news/summarize`, `/api/news/health`로 접근합니다.
## n8n 워크플로우
```