Skip to content

fix: replace Defuddle API with local library and remove YouTube support - #24

Merged
toy-crane merged 7 commits into
mainfrom
fix/api-route-proxy
Apr 8, 2026
Merged

fix: replace Defuddle API with local library and remove YouTube support#24
toy-crane merged 7 commits into
mainfrom
fix/api-route-proxy

Conversation

@toy-crane

@toy-crane toy-crane commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Defuddle hosted API(defuddle.md)가 Cloudflare Bot Fight Mode로 브라우저/서버 모두 차단되는 문제 해결
  • defuddle npm 패키지를 Next.js API Route에서 직접 사용하여 외부 API 의존성 제거
  • YouTube 자막 지원 제거 (datacenter IP 차단으로 불안정)

Changes

  • lib/extract.ts 생성: defuddle/node + linkedom 기반 서버사이드 추출
  • app/api/extract/route.ts: Defuddle API 프록시 → extractContent() 직접 호출
  • hooks/use-extract.ts: frontmatter 파싱 → JSON 응답 처리로 전환
  • YouTube 관련 코드 전부 제거 (hooks, components, tests, spec.yaml)

Test plan

  • bun run test — 테스트 통과 (기존 실패 2개 제외)
  • bun run build — 빌드 성공
  • 로컬 bun run dev → 웹페이지 URL 추출 동작 확인
  • Vercel Preview 배포 → 실제 환경에서 동작 확인

🤖 Generated with Claude Code

Browser direct calls to defuddle.md are blocked by CORS policy.
Route requests through /api/extract server-side proxy instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
feedme Ready Ready Preview, Comment Apr 8, 2026 3:16am

Cloudflare bot protection may block requests with default server
User-Agent. Forward the client's User-Agent to avoid 403 responses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Log upstream status, headers, and body preview to diagnose
Cloudflare 403 responses from Vercel deployment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
toy-crane and others added 4 commits April 8, 2026 11:29
Cloudflare Bot Fight Mode blocks both browser direct calls and
server proxy calls to defuddle.md. Documented findings and
remaining options.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
YouTube transcript extraction is unreliable due to datacenter IP
blocking by InnerTube API. Remove all YouTube-related code from
hooks, components, tests, and spec.yaml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace external defuddle.md API proxy with local defuddle/node
library for HTML-to-markdown conversion. This avoids Cloudflare
Bot Fight Mode blocking and removes external API dependency.

- Add defuddle and linkedom dependencies
- Create lib/extract.ts with server-side extraction logic
- Update API route to call extractContent() directly
- Switch hooks/use-extract.ts from frontmatter to JSON responses
- Update all test mocks to use JSON response format

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documented defuddle library direct usage as the solution.
YouTube support removed due to datacenter IP blocking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@toy-crane toy-crane changed the title fix: add API route proxy for Defuddle to avoid CORS errors fix: replace Defuddle API with local library and remove YouTube support Apr 8, 2026
@toy-crane
toy-crane merged commit 4c99ecc into main Apr 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant