fix: Instagram data collection pipeline — handle normalization + DB persistence
- enrich-channels: Instagram fallback — auto-try _ps, .ps, _clinic suffixes when <100 followers - enrich-channels: YouTube URL normalization via normalizeYouTubeChannel (handles /c/, /user/, @handle) - enrich-channels: Google Maps multi-query search for better hit rate - generate-report: AI-found social handles prioritized over Firecrawl scrape - generate-report: Added socialMedia field to AI prompt for accurate handle discovery - normalizeHandles: Added normalizeYouTubeChannel for /c/, /user/, /channel/, @handle URLs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9bf47f7d93
commit
e5399486f7
3 files changed
+157
-56
No files matched your search
@@ -92,7 +92,13 @@ ${JSON.stringify(analyzeResult.data?.analysis || {}, null, 2)}
|
||||
"address": "주소",
|
||||
"phone": "전화번호",
|
||||
"services": ["시술1", "시술2"],
|
||||
"doctors": [{"name": "의사명", "specialty": "전문분야"}]
|
||||
"doctors": [{"name": "의사명", "specialty": "전문분야"}],
|
||||
"socialMedia": {
|
||||
"instagram": "정확한 Instagram 핸들 (@ 없이, 예: banobagi_ps)",
|
||||
"youtube": "YouTube 채널 핸들 또는 URL",
|
||||
"facebook": "Facebook 페이지명",
|
||||
"naverBlog": "네이버 블로그 ID"
|
||||
}
|
||||
},
|
||||
"executiveSummary": "경영진 요약 (3-5문장)",
|
||||
"overallScore": 0-100,
|
||||
@@ -165,13 +171,14 @@ ${JSON.stringify(analyzeResult.data?.analysis || {}, null, 2)}
|
||||
report = { raw: reportText, parseError: true };
|
||||
}
|
||||
|
||||
// Normalize social handles from scrape data
|
||||
const socialMedia = clinic.socialMedia || {};
|
||||
// Merge social handles: AI-found (more accurate) > Firecrawl-extracted (fallback)
|
||||
const scrapeSocial = clinic.socialMedia || {};
|
||||
const aiSocial = report?.clinicInfo?.socialMedia || {};
|
||||
const normalizedHandles = {
|
||||
instagram: normalizeInstagramHandle(socialMedia.instagram),
|
||||
youtube: socialMedia.youtube || null,
|
||||
facebook: socialMedia.facebook || null,
|
||||
blog: socialMedia.blog || null,
|
||||
instagram: normalizeInstagramHandle(aiSocial.instagram) || normalizeInstagramHandle(scrapeSocial.instagram),
|
||||
youtube: aiSocial.youtube || scrapeSocial.youtube || null,
|
||||
facebook: aiSocial.facebook || scrapeSocial.facebook || null,
|
||||
blog: aiSocial.naverBlog || scrapeSocial.blog || null,
|
||||
};
|
||||
|
||||
// Embed normalized handles in report for DB persistence
|
||||
|
||||
Reference in new issue
Block a user