<aside>
🕷 크롤러 인터페이스 · HTTP 클라이언트 · 국가별 소스 · 파싱 전략 · Anti-bot · 잡 스케줄링 · 저장 / 중복 제거 · 원본: .claude/rules/02-crawler-implementation.md
</aside>
핵심 Crawler 인터페이스
모든 크롤러가 만족해야 하는 base 인터페이스. context 취소 / per-source rate limit / 명시적 lifecycle 강제.
type Crawler interface {
Name() string
Source() SourceInfo
Initialize(ctx context.Context, config Config) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
Fetch(ctx context.Context, target Target) (*RawContent, error)
HealthCheck(ctx context.Context) error
}
type SourceInfo struct {
Country string // ISO 3166-1 alpha-2 (US, KR)
Type SourceType
Name string
BaseURL string
Language string // ISO 639-1
}
HTTP 클라이언트 표준
- 단일 http.Client + connection pool (MaxIdleConns=100, MaxIdleConnsPerHost=10, IdleConnTimeout=90s, ForceAttemptHTTP2=true)
- Timeout 은 client 가 아닌 request context 단위 (기본 30s/요청)
- Header: User-Agent 필수 (IssueTracker/1.0 (+https://example.com/bot)), Accept-Language 는 target country 기준
- 응답: Content-Type 확인 후 파싱, io.LimitReader 로 본문 최대 10MB 제한, body close 보장
- Encoding: Content-Type · HTML meta 로 charset 감지 → UTF-8 변환 (golang.org/x/text/encoding)
국가별 소스 (우선순위 순)
🇺🇸 US
- Major News: CNN · NYT · Washington Post (RSS 선호)
- Wire / Regional: AP News · Reuters
- Communities: Reddit r/news · r/worldnews · r/politics · Hacker News
🇰🇷 KR
- Portals: Naver News · Daum News (공식 API 우선)
- Direct: Yonhap · KBS · MBC · SBS · Chosun · JoongAng · Dong-A
- Communities: Naver Cafe (선별) · DCInside (주요 갤러리) · TheQoo · Clien
파싱 전략