Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a9036e47 | ||
|
|
5dbc7d7ffe | ||
|
|
71b605eaa6 | ||
|
|
aff2b2720d | ||
|
|
eed57729d9 | ||
|
|
d1293f9188 | ||
|
|
0e68cbe71b |
No files matched your search
+35
-20
@@ -14,9 +14,10 @@ from common.utils import _normalize_homepage, _with_scheme
|
||||
router = APIRouter(prefix="/api/analysis", tags=["analysis"], dependencies=[Depends(verify_api_key)])
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 추후 DB에 클리닉별로 매핑할 채널(틱톡/영문 인스타·페북). 지금은 mock_urls에서 homepage 매칭으로 보충.
|
||||
def _extra_channels_from_mockurls(homepage_url: str) -> dict:
|
||||
"""homepage로 mock_urls에서 클리닉을 찾아 틱톡/영문 인스타·페북 URL 반환 (없으면 {})."""
|
||||
# 추후 DB에 클리닉별로 매핑할 채널들 — 지금은 mock_urls에서 homepage 매칭으로 보충.
|
||||
# 메인 채널(IG/FB/YT/네이버블로그/강남언니) + 부가 채널(틱톡/영문 IG·FB/카카오/네이버카페) 모두 포함.
|
||||
# 클라가 일부만 보내거나 빈 값이면 mock에서 동일 hospital을 찾아 채워줌.
|
||||
def _channels_from_mockurls(homepage_url: str) -> dict:
|
||||
target = _normalize_homepage(homepage_url)
|
||||
if not target:
|
||||
return {}
|
||||
@@ -24,11 +25,18 @@ def _extra_channels_from_mockurls(homepage_url: str) -> dict:
|
||||
urls = c["urls"]
|
||||
if _normalize_homepage(urls.get("homepage", "")) == target:
|
||||
return {
|
||||
"tiktok": _with_scheme(urls.get("tiktok")),
|
||||
# main
|
||||
"instagram": _with_scheme(urls.get("instagram")),
|
||||
"facebook": _with_scheme(urls.get("facebook")),
|
||||
"naver_blog": _with_scheme(urls.get("naverBlog")),
|
||||
"youtube": _with_scheme(urls.get("youtube")),
|
||||
"gangnam_unni": _with_scheme(urls.get("gangnamUnni")),
|
||||
# extra
|
||||
"tiktok": _with_scheme(urls.get("tiktok")),
|
||||
"instagram_en": _with_scheme(urls.get("instagramEn")),
|
||||
"facebook_en": _with_scheme(urls.get("facebookEn")),
|
||||
"kakao_talk": _with_scheme(urls.get("kakaoTalk")),
|
||||
"naver_cafe": _with_scheme(urls.get("naverCafe")),
|
||||
"facebook_en": _with_scheme(urls.get("facebookEn")),
|
||||
"kakao_talk": _with_scheme(urls.get("kakaoTalk")),
|
||||
"naver_cafe": _with_scheme(urls.get("naverCafe")),
|
||||
}
|
||||
return {}
|
||||
|
||||
@@ -47,28 +55,35 @@ async def start_analysis(body: AnalysisCreate, background_tasks: BackgroundTasks
|
||||
if not hospital:
|
||||
raise HTTPException(status_code=409, detail="Clinic not found")
|
||||
|
||||
# 클라가 안 보낸 채널은 mock_urls에서 homepage 매칭으로 보충 (main + extra 동일 규칙)
|
||||
mock = _channels_from_mockurls(hospital["url"])
|
||||
|
||||
# 사용자가 'gangnamunni.com/...' 같이 scheme/www 없이 줘도 _with_scheme이 https://www. 보강.
|
||||
ig_id = await insert_instagram_row(hospital_id, _with_scheme(body.channels.instagram)) if body.channels.instagram else None
|
||||
fb_id = await insert_facebook_row(hospital_id, _with_scheme(body.channels.facebook)) if body.channels.facebook else None
|
||||
nb_id = await insert_naver_blog_row(hospital_id, _with_scheme(body.channels.naver_blog)) if body.channels.naver_blog else None
|
||||
yt_id = await insert_youtube_row(hospital_id, _with_scheme(body.channels.youtube)) if body.channels.youtube else None
|
||||
gu_id = await insert_gangnam_unni_row(hospital_id, _with_scheme(body.channels.gangnam_unni)) if body.channels.gangnam_unni else None
|
||||
ig_url = _with_scheme(body.channels.instagram) or mock.get("instagram")
|
||||
fb_url = _with_scheme(body.channels.facebook) or mock.get("facebook")
|
||||
nb_url = _with_scheme(body.channels.naver_blog) or mock.get("naver_blog")
|
||||
yt_url = _with_scheme(body.channels.youtube) or mock.get("youtube")
|
||||
gu_url = _with_scheme(body.channels.gangnam_unni) or mock.get("gangnam_unni")
|
||||
|
||||
ig_id = await insert_instagram_row(hospital_id, ig_url) if ig_url else None
|
||||
fb_id = await insert_facebook_row(hospital_id, fb_url) if fb_url else None
|
||||
nb_id = await insert_naver_blog_row(hospital_id, nb_url) if nb_url else None
|
||||
yt_id = await insert_youtube_row(hospital_id, yt_url) if yt_url else None
|
||||
gu_id = await insert_gangnam_unni_row(hospital_id, gu_url) if gu_url else None
|
||||
|
||||
analysis_run_id = await insert_analysis_run(
|
||||
analysis_run_id, hospital_id, hospital["owner_user_id"],
|
||||
ig_id, fb_id, nb_id, yt_id, gu_id,
|
||||
)
|
||||
|
||||
# 클라 값 우선, 없으면 보충 (추후 DB에서 클리닉별로 가져올 값)
|
||||
mock_extra = _extra_channels_from_mockurls(hospital["url"])
|
||||
extra_channels = {
|
||||
"tiktok": body.channels.tiktok or mock_extra.get("tiktok"),
|
||||
"instagram_en": body.channels.instagram_en or mock_extra.get("instagram_en"),
|
||||
"facebook_en": body.channels.facebook_en or mock_extra.get("facebook_en"),
|
||||
"kakao_talk": body.channels.kakao_talk or mock_extra.get("kakao_talk"),
|
||||
"naver_cafe": body.channels.naver_cafe or mock_extra.get("naver_cafe"),
|
||||
"tiktok": body.channels.tiktok or mock.get("tiktok"),
|
||||
"instagram_en": body.channels.instagram_en or mock.get("instagram_en"),
|
||||
"facebook_en": body.channels.facebook_en or mock.get("facebook_en"),
|
||||
"kakao_talk": body.channels.kakao_talk or mock.get("kakao_talk"),
|
||||
"naver_cafe": body.channels.naver_cafe or mock.get("naver_cafe"),
|
||||
}
|
||||
logger.info("[analysis] extra_channels=%s (mock_matched=%s)", extra_channels, bool(mock_extra))
|
||||
logger.info("[analysis] main+extra channels resolved (mock_matched=%s)", bool(mock))
|
||||
background_tasks.add_task(run_pipeline, analysis_run_id, extra_channels)
|
||||
|
||||
return AnalysisStartResponse(
|
||||
|
||||
+7
-4
@@ -1,8 +1,9 @@
|
||||
import json
|
||||
import logging
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response
|
||||
from common.db import fetchone
|
||||
from common.db import fetchone, fetch_raw
|
||||
from common.deps import verify_api_key
|
||||
from common.utils import _with_scheme
|
||||
from integrations.llm.schemas.plan import PlanOutput
|
||||
from models.plan import PlanApiResponse
|
||||
|
||||
@@ -14,7 +15,7 @@ logger = logging.getLogger(__name__)
|
||||
async def get_plan(run_id: str):
|
||||
logger.info("GET /api/plan/%s", run_id)
|
||||
row = await fetchone(
|
||||
"SELECT ar.plan_data, ar.created_at, h.hospital_name, h.hospital_name_en, h.url"
|
||||
"SELECT ar.plan_data, ar.created_at, ar.gangnam_unni_data_id, h.hospital_name, h.hospital_name_en, h.url"
|
||||
" FROM analysis_runs ar"
|
||||
" JOIN hospital_baseinfo h ON ar.hospital_id = h.hospital_id"
|
||||
" WHERE ar.analysis_run_id = %s",
|
||||
@@ -26,11 +27,13 @@ async def get_plan(run_id: str):
|
||||
return Response(status_code=204)
|
||||
data = json.loads(row["plan_data"]) if isinstance(row["plan_data"], str) else row["plan_data"]
|
||||
plan = PlanOutput(**data)
|
||||
gangnam_unni = await fetch_raw("gangnam_unni_data", row["gangnam_unni_data_id"]) or {}
|
||||
clinic_name = gangnam_unni.get("name") or row["hospital_name"]
|
||||
return PlanApiResponse(
|
||||
id=run_id,
|
||||
clinic_name=row["hospital_name"],
|
||||
clinic_name=clinic_name,
|
||||
clinic_name_en=row["hospital_name_en"],
|
||||
created_at=str(row["created_at"]),
|
||||
target_url=row["url"],
|
||||
target_url=_with_scheme(row["url"]),
|
||||
**plan.model_dump(),
|
||||
)
|
||||
+2
-1
@@ -3,6 +3,7 @@ import logging
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response
|
||||
from common.db import fetchone
|
||||
from common.deps import verify_api_key
|
||||
from common.utils import _with_scheme
|
||||
from integrations.llm.schemas.report import ReportOutput
|
||||
from models.report import MarketingReportResponse
|
||||
|
||||
@@ -31,6 +32,6 @@ async def get_report(run_id: str):
|
||||
clinic_name=row["hospital_name"],
|
||||
clinic_name_en=row["hospital_name_en"],
|
||||
created_at=str(row["created_at"]),
|
||||
target_url=row["url"],
|
||||
target_url=_with_scheme(row["url"]),
|
||||
**llm_output.model_dump(exclude={"id", "created_at", "target_url"}),
|
||||
)
|
||||
+1
-1
@@ -62,7 +62,7 @@ def _normalize_homepage(url: str) -> str:
|
||||
|
||||
|
||||
# SSL 인증서가 www.* 에만 유효한 도메인 — bare 도메인이면 사용자 클릭 시 브라우저 SSL warning 뜸.
|
||||
_WWW_REQUIRED = ("gangnamunni.com", "facebook.com", "instagram.com")
|
||||
_WWW_REQUIRED = ("gangnamunni.com", "facebook.com", "instagram.com", "toxnfill.com")
|
||||
|
||||
|
||||
def _with_scheme(u: str | None) -> str | None:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
from pydantic import BaseModel
|
||||
from common.utils import get_env
|
||||
from integrations.llm.schemas.report import ReportInput, ReportOutput
|
||||
from integrations.llm.schemas.report import ReportInput, ReportOutput, YouTubeDiagnosisInput, YouTubeDiagnosisOutput
|
||||
from integrations.llm.schemas.plan import PlanInput, PlanOutput
|
||||
from integrations.llm.schemas.market import (
|
||||
MarketCompetitorsInput, MarketCompetitorsOutput,
|
||||
@@ -80,3 +80,10 @@ market_target_audience_prompt = Prompt(
|
||||
input_class=MarketTargetAudienceInput,
|
||||
output_class=MarketTargetAudienceOutput,
|
||||
)
|
||||
|
||||
youtube_diagnosis_prompt = Prompt(
|
||||
file_name="youtube_diagnosis_prompt.txt",
|
||||
prompt_model="REPORT_MODEL",
|
||||
input_class=YouTubeDiagnosisInput,
|
||||
output_class=YouTubeDiagnosisOutput,
|
||||
)
|
||||
@@ -19,6 +19,8 @@ class PlanInput(BaseModel):
|
||||
instagram_en: str | None = None
|
||||
facebook_en: str | None = None
|
||||
naver_blog: str | None = None
|
||||
naver_cafe: str | None = None
|
||||
kakao_talk: str | None = None
|
||||
channel_logos: str | None = None
|
||||
brand_assets: str | None = None
|
||||
|
||||
|
||||
@@ -68,22 +68,18 @@ class RegistryData(BaseModel):
|
||||
|
||||
|
||||
class ClinicSnapshot(BaseModel):
|
||||
name: str
|
||||
name_en: str
|
||||
established: str
|
||||
years_in_business: int
|
||||
staff_count: int
|
||||
lead_doctor: LeadDoctor
|
||||
overall_rating: float
|
||||
total_reviews: int
|
||||
price_range: PriceRange
|
||||
certifications: list[str]
|
||||
media_appearances: list[str]
|
||||
medical_tourism: list[str]
|
||||
location: str
|
||||
nearest_station: str
|
||||
phone: str
|
||||
domain: str
|
||||
# _build_clinic_snapshot은 source 데이터 있을 때만 채움 (`if x:` 가드).
|
||||
# required면 강남언니/홈페이지 누락 병원에서 ValidationError로 리포트 실패.
|
||||
name: str | None = None
|
||||
name_en: str | None = None
|
||||
staff_count: int | None = None
|
||||
lead_doctor: LeadDoctor | None = None
|
||||
overall_rating: float | None = None
|
||||
total_reviews: int | None = None
|
||||
certifications: list[str] = []
|
||||
location: str | None = None
|
||||
phone: str | None = None
|
||||
domain: str | None = None
|
||||
logo_images: LogoImages | None = None
|
||||
brand_colors: BrandColors | None = None
|
||||
source: DataSource | None = None
|
||||
@@ -127,45 +123,47 @@ class TopVideo(BaseModel):
|
||||
|
||||
|
||||
class YouTubeAudit(BaseModel):
|
||||
channel_name: str
|
||||
handle: str
|
||||
subscribers: int
|
||||
total_videos: int
|
||||
total_views: int
|
||||
weekly_view_growth: WeeklyViewGrowth
|
||||
estimated_monthly_revenue: EstimatedRevenue
|
||||
avg_video_length: str
|
||||
upload_frequency: str
|
||||
channel_created_date: str
|
||||
subscriber_rank: str
|
||||
channel_description: str
|
||||
linked_urls: list[LinkedUrl]
|
||||
playlists: list[str]
|
||||
top_videos: list[TopVideo]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
# YouTube 미수집 병원에서 _build_youtube_audit가 채울 수 없는 필드 빔.
|
||||
# required면 ValidationError로 리포트 실패 → Optional로 받아 부분 응답 허용.
|
||||
channel_name: str | None = None
|
||||
handle: str | None = None
|
||||
subscribers: int | None = None
|
||||
total_videos: int | None = None
|
||||
total_views: int | None = None
|
||||
weekly_view_growth: WeeklyViewGrowth | None = None
|
||||
estimated_monthly_revenue: EstimatedRevenue | None = None
|
||||
avg_video_length: str | None = None
|
||||
upload_frequency: str | None = None
|
||||
channel_created_date: str | None = None
|
||||
channel_description: str | None = None
|
||||
linked_urls: list[LinkedUrl] = []
|
||||
playlists: list[str] = []
|
||||
top_videos: list[TopVideo] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
|
||||
|
||||
# --- Instagram ---
|
||||
|
||||
class InstagramAccount(BaseModel):
|
||||
handle: str
|
||||
language: Language
|
||||
label: str
|
||||
posts: int
|
||||
followers: int
|
||||
following: int
|
||||
category: str
|
||||
profile_link: str
|
||||
highlights: list[str]
|
||||
reels_count: int
|
||||
content_format: str
|
||||
profile_photo: str
|
||||
bio: str
|
||||
# LLM이 누락 가능 — Optional로 받아 ValidationError 차단.
|
||||
handle: str | None = None
|
||||
language: Language | None = None
|
||||
label: str | None = None
|
||||
posts: int | None = None
|
||||
followers: int | None = None
|
||||
following: int | None = None
|
||||
category: str | None = None
|
||||
profile_link: str | None = None
|
||||
highlights: list[str] = []
|
||||
reels_count: int | None = None
|
||||
content_format: str | None = None
|
||||
profile_photo: str | None = None
|
||||
bio: str | None = None
|
||||
|
||||
|
||||
class InstagramAudit(BaseModel):
|
||||
accounts: list[InstagramAccount]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
accounts: list[InstagramAccount] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
|
||||
|
||||
# --- Facebook ---
|
||||
@@ -184,31 +182,32 @@ class BrandInconsistency(BaseModel):
|
||||
|
||||
|
||||
class FacebookPage(BaseModel):
|
||||
url: str
|
||||
page_name: str
|
||||
language: Language
|
||||
label: str
|
||||
followers: int
|
||||
following: int
|
||||
category: str
|
||||
bio: str
|
||||
logo: str
|
||||
logo_description: str
|
||||
link: str
|
||||
linked_domain: str
|
||||
reviews: int
|
||||
recent_post_age: str
|
||||
has_whatsapp: bool
|
||||
# LLM이 누락 가능 (page 1·2개 모두 language/label/logo/has_whatsapp 빼먹는 경우 관찰됨).
|
||||
url: str | None = None
|
||||
page_name: str | None = None
|
||||
language: Language | None = None
|
||||
label: str | None = None
|
||||
followers: int | None = None
|
||||
following: int | None = None
|
||||
category: str | None = None
|
||||
bio: str | None = None
|
||||
logo: str | None = None
|
||||
logo_description: str | None = None
|
||||
link: str | None = None
|
||||
linked_domain: str | None = None
|
||||
reviews: int | None = None
|
||||
recent_post_age: str | None = None
|
||||
has_whatsapp: bool | None = None
|
||||
post_frequency: str | None = None
|
||||
top_content_type: str | None = None
|
||||
engagement: str | None = None
|
||||
|
||||
|
||||
class FacebookAudit(BaseModel):
|
||||
pages: list[FacebookPage]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
brand_inconsistencies: list[BrandInconsistency]
|
||||
consolidation_recommendation: str
|
||||
pages: list[FacebookPage] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
brand_inconsistencies: list[BrandInconsistency] = []
|
||||
consolidation_recommendation: str | None = None
|
||||
|
||||
|
||||
# --- 기타 채널 / 웹사이트 ---
|
||||
@@ -353,3 +352,20 @@ class MarketingReport(BaseModel):
|
||||
|
||||
|
||||
ReportOutput = MarketingReport
|
||||
|
||||
|
||||
# --- YouTubeDiagnosis ---
|
||||
|
||||
class YouTubeDiagnosisInput(BaseModel):
|
||||
channel_name: str | None = None
|
||||
subscribers: int | None = None
|
||||
total_videos: int | None = None
|
||||
total_views: int | None = None
|
||||
avg_video_length: str | None = None
|
||||
upload_frequency: str | None = None
|
||||
top_videos: str | None = None
|
||||
playlists: str | None = None
|
||||
|
||||
|
||||
class YouTubeDiagnosisOutput(BaseModel):
|
||||
diagnosis: list[DiagnosisItem]
|
||||
@@ -32,8 +32,8 @@
|
||||
## 분석 리포트
|
||||
{report}
|
||||
|
||||
## 추가 채널 데이터 (네이버 블로그 / 틱톡 / 인스타그램 EN / 페이스북 EN)
|
||||
아래에 데이터가 있는 채널은 channelStrategies와 channelBranding에 **반드시 포함**하세요 (네이버 블로그, 틱톡, 영문 인스타그램, 영문 페이스북). null이면 제외.
|
||||
## 추가 채널 데이터 (네이버 블로그 / 틱톡 / 인스타그램 EN / 페이스북 EN / 네이버 카페 / 카카오톡)
|
||||
아래에 데이터가 있는 채널은 channelStrategies에 **반드시 포함**하세요 (네이버 블로그, 틱톡, 영문 인스타그램, 영문 페이스북, 네이버 카페, 카카오톡). channelBranding은 SNS·블로그·카페까지만 포함(카카오톡은 메신저라 제외). null이면 제외.
|
||||
|
||||
### 네이버 블로그 (Naver Blog)
|
||||
{naver_blog}
|
||||
@@ -47,6 +47,16 @@
|
||||
### 페이스북 (영문 페이지)
|
||||
{facebook_en}
|
||||
|
||||
### 네이버 카페 (공식 카페 운영 신호)
|
||||
{naver_cafe}
|
||||
- naver_cafe.cafeName: 카페명, naver_cafe.memberCount: 회원수
|
||||
- currentStatus는 "회원 N명" 형태로 간단하게. 게시글 수·최근 활동은 수집 불가 (추측 금지).
|
||||
- targetGoal은 회원 확보 목표 수치 + 운영 권장 (예: "회원 5,000명, 주 1~2회 공지 발행").
|
||||
|
||||
### 카카오톡 채널 (URL only — 콘텐츠 수집 X, 존재 여부만)
|
||||
{kakao_talk}
|
||||
- channelStrategies 카드 하나로 포함. currentStatus는 "공식 카카오톡 채널 운영 중" 정도, targetGoal은 친구 추가 유도·상담 전환·자동응답 시나리오 구체화 등.
|
||||
|
||||
## 채널별 로고 분석 (Gemini Vision) — 채널룰/일관성의 근거
|
||||
{channel_logos}
|
||||
- 위 channel_logos[]의 각 항목: channel(채널명), logo_description(프로필이 어떻게 생겼는지), is_official(공식 로고와 일치 여부).
|
||||
@@ -77,7 +87,7 @@
|
||||
- brandInconsistencies: 채널 간 브랜딩 불일치 항목 및 개선 권고
|
||||
|
||||
### Section 2: channelStrategies
|
||||
- 메인 SNS 채널(Instagram, Facebook, YouTube, TikTok, 네이버 블로그) + 영문 계정(Instagram EN, Facebook EN) 카드를 **모두 포함**. 데이터 없는 채널도 빠뜨리지 말 것.
|
||||
- 메인 SNS 채널(Instagram, Facebook, YouTube, TikTok, 네이버 블로그) + 영문 계정(Instagram EN, Facebook EN) + **네이버 카페 / 카카오톡** (URL 있을 때) 카드를 **모두 포함**. 데이터 없는 채널도 빠뜨리지 말 것.
|
||||
- **currentStatus**: 데이터 있는 채널은 실제 수치로 서술 (예: "14,047 팔로워, Reels 0개", "104K 구독자, 주 2~3회 업로드"). **데이터 없는 채널은 "계정 없음"** 으로 표시. `excellent`/`warning`/`good` 같은 등급·평가어 금지.
|
||||
- **targetGoal은 모든 채널에 반드시 채울 것** — 구체적 목표 수치(예: "50K 팔로워, Reels 주 5개"). 데이터 없는 채널도 시작 시 권장 목표를 작성하고 비우지 말 것.
|
||||
- 각 채널의 우선순위(P0/P1/P2), 콘텐츠 유형, 게시 빈도, 포맷 가이드라인 모두 권장값으로 작성 — 데이터 없어도 시작 권장값으로 채울 것.
|
||||
|
||||
@@ -66,8 +66,11 @@
|
||||
### 카카오톡 채널 (URL only — 수집 데이터 없음, 존재 여부만 확인)
|
||||
{kakao_talk}
|
||||
|
||||
### 네이버 카페 (URL only — 수집 데이터 없음, 존재 여부만 확인)
|
||||
### 네이버 카페 (공식 카페 운영 신호)
|
||||
{naver_cafe}
|
||||
- naver_cafe.cafeName: 카페명
|
||||
- naver_cafe.memberCount: 회원수
|
||||
- 게시글 총 수·최근 게시일은 로그인 필요라 수집 불가. 추측 금지. 위 두 값만 사용.
|
||||
|
||||
### 채널별 로고 분석 (Gemini Vision)
|
||||
{channel_logos}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
다음은 성형외과/피부과 유튜브 채널 데이터입니다.
|
||||
|
||||
채널명: {channel_name}
|
||||
구독자 수: {subscribers}
|
||||
총 영상 수: {total_videos}
|
||||
총 조회수: {total_views}
|
||||
평균 영상 길이: {avg_video_length}
|
||||
업로드 주기: {upload_frequency}
|
||||
인기 영상 목록: {top_videos}
|
||||
플레이리스트: {playlists}
|
||||
|
||||
위 데이터를 바탕으로 이 채널의 마케팅 문제점과 개선사항을 진단해줘.
|
||||
각 항목은 category(진단 카테고리), detail(상세 설명), severity(critical/warning/info) 형식의 JSON 배열로 출력해줘.
|
||||
|
||||
진단 카테고리들은 다음과 같아. :
|
||||
구독자 대비 조회수 비율,
|
||||
최근 롱폼 조회수,
|
||||
Shorts 조회수,
|
||||
업로드 빈도,
|
||||
콘텐츠 톤앤매너,
|
||||
썸네일 디자인,
|
||||
최고 성과 Shorts
|
||||
|
||||
출처 번호([1], [2] 등)는 굳이 포함하지 마.
|
||||
@@ -1,4 +1,5 @@
|
||||
import re
|
||||
import httpx
|
||||
from http import HTTPMethod
|
||||
from urllib.parse import urlparse
|
||||
from common.utils import http_request
|
||||
@@ -108,3 +109,59 @@ class NaverClient:
|
||||
"totalResults": total,
|
||||
"posts": posts[:10],
|
||||
}
|
||||
|
||||
async def get_cafe_info(self, cafe_url: str, *_args, **_kwargs) -> dict | None:
|
||||
"""네이버 카페 운영 신호 수집. 2단계 fetch:
|
||||
1) https://cafe.naver.com/{handle} → cafeId 추출
|
||||
2) ArticleList.nhn?search.clubid={cafeId} → memberCount + cafeName 추출
|
||||
본문/게시글은 로그인 필요라 못 가져옴. 회원수·카페명만 잡히면 충분.
|
||||
common.http_request는 redirect 안 따라가서 카페 페이지에 안 맞아 httpx 직접 사용."""
|
||||
handle = urlparse(cafe_url).path.strip("/").split("/")[0] if "://" in cafe_url else cafe_url.split("/")[-1]
|
||||
if not handle:
|
||||
return None
|
||||
|
||||
async with httpx.AsyncClient(
|
||||
timeout=10, follow_redirects=True,
|
||||
headers={"User-Agent": "Mozilla/5.0"},
|
||||
) as c:
|
||||
# 1. cafeId 추출
|
||||
try:
|
||||
main = await c.get(f"https://cafe.naver.com/{handle}")
|
||||
except Exception:
|
||||
return {"url": f"https://cafe.naver.com/{handle}", "cafeHandle": handle, "accessible": False}
|
||||
if main.status_code != 200:
|
||||
return {"url": f"https://cafe.naver.com/{handle}", "cafeHandle": handle, "accessible": False}
|
||||
cid_match = re.search(r'cafeId["\']?\s*[:=]\s*["\']?(\d+)', main.text)
|
||||
cafe_id = cid_match.group(1) if cid_match else None
|
||||
|
||||
result: dict = {
|
||||
"url": f"https://cafe.naver.com/{handle}",
|
||||
"cafeHandle": handle,
|
||||
"cafeId": cafe_id,
|
||||
"accessible": True,
|
||||
"cafeName": None,
|
||||
"memberCount": None,
|
||||
}
|
||||
if not cafe_id:
|
||||
return result
|
||||
|
||||
# 2. ArticleList 페이지에서 회원수 + 카페명 추출 (로그인 없이 접근 가능한 유일한 endpoint)
|
||||
try:
|
||||
listing = await c.get(
|
||||
f"https://cafe.naver.com/ArticleList.nhn?search.clubid={cafe_id}&search.menuid=&search.boardtype=L",
|
||||
headers={"Referer": f"https://cafe.naver.com/{handle}"},
|
||||
)
|
||||
except Exception:
|
||||
return result
|
||||
if listing.status_code != 200:
|
||||
return result
|
||||
mc = re.search(r'memberCount[^0-9]+(\d[\d,]*)', listing.text)
|
||||
if mc:
|
||||
result["memberCount"] = int(mc.group(1).replace(",", ""))
|
||||
tm = re.search(r"<title>(.+?)\s*:\s*네이버 카페</title>", listing.text)
|
||||
if tm:
|
||||
name = re.sub(r"&", "&", tm.group(1)).strip()
|
||||
if "," in name:
|
||||
name = name.split(",", 1)[1].strip()
|
||||
result["cafeName"] = name
|
||||
return result
|
||||
@@ -10,6 +10,7 @@ import logging
|
||||
import re
|
||||
import ssl
|
||||
import httpx
|
||||
import resvg_py
|
||||
from openai import AsyncOpenAI
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -77,11 +78,20 @@ class VisionClient:
|
||||
if not mime.startswith("image/"):
|
||||
logger.warning("[vision] %s not an image (content-type=%s)", url, mime)
|
||||
return None
|
||||
size = len(resp.content)
|
||||
# SVG는 Gemini가 못 보므로 즉시 PNG로 래스터화 (resvg, in-memory ~1ms)
|
||||
content = resp.content
|
||||
if mime == "image/svg+xml" or url.lower().split("?")[0].endswith(".svg"):
|
||||
try:
|
||||
content = bytes(resvg_py.svg_to_bytes(svg_string=resp.text))
|
||||
mime = "image/png"
|
||||
except Exception as e:
|
||||
logger.warning("[vision] svg rasterize failed %s: %s", url, e)
|
||||
return None
|
||||
size = len(content)
|
||||
if size < 500:
|
||||
logger.warning("[vision] %s too small (%d bytes) — likely placeholder", url, size)
|
||||
return None
|
||||
b64 = base64.b64encode(resp.content).decode("ascii")
|
||||
b64 = base64.b64encode(content).decode("ascii")
|
||||
return f"data:{mime};base64,{b64}"
|
||||
except (httpx.ConnectError, httpx.ReadError, ssl.SSLError) as e:
|
||||
last_err = e
|
||||
@@ -120,6 +130,75 @@ class VisionClient:
|
||||
logger.warning("[vision] error: %s", e)
|
||||
return None
|
||||
|
||||
async def describe_svg_text(self, svg_url: str) -> dict | None:
|
||||
"""SVG는 Gemini Vision이 못 보지만 XML 텍스트 자체는 LLM이 읽을 수 있음.
|
||||
SVG 소스를 받아 그대로 text endpoint에 던지고 색·심볼·텍스트를 추론하게 함.
|
||||
analyze_brand_assets와 동일한 스키마(logo_description/style/has_symbol/...) 반환."""
|
||||
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"}
|
||||
|
||||
def _weak_ctx() -> ssl.SSLContext:
|
||||
ctx = ssl.create_default_context()
|
||||
try:
|
||||
ctx.set_ciphers("DEFAULT@SECLEVEL=1")
|
||||
except ssl.SSLError:
|
||||
pass
|
||||
return ctx
|
||||
|
||||
svg_text: str | None = None
|
||||
for verify in (True, _weak_ctx(), False):
|
||||
try:
|
||||
async with httpx.AsyncClient(
|
||||
timeout=15.0, follow_redirects=True, headers=headers, verify=verify,
|
||||
) as c:
|
||||
resp = await c.get(svg_url)
|
||||
if resp.status_code == 200:
|
||||
svg_text = resp.text
|
||||
break
|
||||
except (httpx.ConnectError, httpx.ReadError, ssl.SSLError):
|
||||
continue
|
||||
except Exception as e:
|
||||
logger.warning("[vision] svg fetch error %s: %s", svg_url, e)
|
||||
return None
|
||||
if not svg_text:
|
||||
logger.warning("[vision] svg fetch failed %s", svg_url)
|
||||
return None
|
||||
# 페이로드 폭주 방지 — 평범한 로고 SVG는 수 KB 수준
|
||||
if len(svg_text) > 60000:
|
||||
svg_text = svg_text[:60000]
|
||||
|
||||
prompt = (
|
||||
"아래는 병원 로고 SVG 소스 코드입니다. SVG 마크업(path/circle/text/fill/stroke 등)을 "
|
||||
"읽고 로고의 시각적 특징을 추론해 아래 JSON 스키마로만 응답하세요. 코드펜스 없이 순수 JSON.\n"
|
||||
"{\n"
|
||||
' "logo_description": "심볼 형태 + 워드마크 + 톤을 1~2문장 한국어로",\n'
|
||||
' "logo_style": "minimal | illustrative | typographic | abstract 중 하나",\n'
|
||||
' "has_symbol": "심볼/아이콘이 있으면 true, 글자만 있으면 false (boolean)",\n'
|
||||
' "logo_symbol": "심볼 묘사 (예: \'잎사귀\'). 없으면 빈 문자열",\n'
|
||||
' "logo_text": "워드마크 텍스트 그대로. <text> 태그 내용 우선",\n'
|
||||
' "logo_colors_desc": "쓰인 색감을 사람이 부르는 이름으로 (예: \'딥네이비 + 골드\'). hex 출력 금지"\n'
|
||||
"}\n"
|
||||
"주의: hex 값이나 URL은 출력하지 마세요 (별도 추출 로직 처리). 모든 텍스트는 한국어로.\n\n"
|
||||
"SVG 소스:\n"
|
||||
f"{svg_text}"
|
||||
)
|
||||
try:
|
||||
resp = await self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
max_tokens=8000, # Gemini 2.5는 thinking 토큰을 max_tokens에서 차감하므로 여유 필요
|
||||
)
|
||||
choice = resp.choices[0]
|
||||
if choice.finish_reason != "stop":
|
||||
logger.warning("[vision] svg describe finish_reason=%s", choice.finish_reason)
|
||||
result = self._extract_json(choice.message.content or "")
|
||||
except Exception as e:
|
||||
logger.warning("[vision] svg describe error: %s", e)
|
||||
return None
|
||||
if not result:
|
||||
return None
|
||||
result["logo_images"] = {"circle": None, "horizontal": svg_url, "korean": None}
|
||||
return result
|
||||
|
||||
async def analyze_brand_assets(
|
||||
self,
|
||||
logo_url: str | None,
|
||||
|
||||
@@ -79,7 +79,17 @@ class YouTubeClient:
|
||||
if resp and resp.is_success:
|
||||
videos = resp.json().get("items", [])[:10]
|
||||
|
||||
return {"channelId": channel_id, "channel": channel, "videos": videos}
|
||||
playlists: list[dict] = []
|
||||
resp = await http_request(
|
||||
HTTPMethod.GET,
|
||||
url=f"{YT}/playlists",
|
||||
params={"part": "snippet", "channelId": channel_id, "maxResults": 50, "key": self.api_key},
|
||||
label="yt-playlists",
|
||||
)
|
||||
if resp and resp.is_success:
|
||||
playlists = resp.json().get("items", [])
|
||||
|
||||
return {"channelId": channel_id, "channel": channel, "videos": videos, "playlists": playlists}
|
||||
|
||||
async def get_channel(self, url: str) -> dict | None:
|
||||
raw = await self.fetch_channel(url)
|
||||
@@ -111,6 +121,11 @@ class YouTubeClient:
|
||||
}
|
||||
for v in raw["videos"]
|
||||
],
|
||||
"playlists": [
|
||||
p.get("snippet", {}).get("title")
|
||||
for p in raw["playlists"]
|
||||
if p.get("snippet", {}).get("title")
|
||||
],
|
||||
}
|
||||
|
||||
async def search_channels(self, query: str, max_results: int = 3) -> list[str]:
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+134
-93
@@ -32,6 +32,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/23",
|
||||
"tiktok": "tiktok.com/@banobagi_official",
|
||||
"tiktokEn": "tiktok.com/@banobagi_english",
|
||||
"instagramEn": "instagram.com/english_banobagi",
|
||||
"facebookEn": "facebook.com/englishbanobagi",
|
||||
"kakaoTalk": "pf.kakao.com/_bCMxfE"
|
||||
@@ -49,6 +50,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/257",
|
||||
"tiktok": "tiktok.com/@idhospitalkorea",
|
||||
"tiktokEn": "tiktok.com/@idhospital_eng",
|
||||
"instagramEn": "instagram.com/idhospitalkorea",
|
||||
"facebookEn": "facebook.com/idhospital.eng",
|
||||
"kakaoTalk": "pf.kakao.com/_yxlxmxhE"
|
||||
@@ -63,9 +65,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "facebook.com/jkmedicalgroup",
|
||||
"naverPlace": "https://naver.me/x67y6cAc",
|
||||
"naverBlog": "blog.naver.com/jkstory1",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/858",
|
||||
"naverCafe": "cafe.naver.com/seoljyps",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "tiktok.com/@jkplastic",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/jkplasticsurgery",
|
||||
"facebookEn": "facebook.com/jkplastic",
|
||||
"kakaoTalk": "pf.kakao.com/_uCxeRE"
|
||||
@@ -83,6 +86,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/62",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/grandps_eng",
|
||||
"facebookEn": "facebook.com/grandplasticsurgery",
|
||||
"kakaoTalk": "pf.kakao.com/_SxixbqV"
|
||||
@@ -94,12 +98,13 @@ MOCK_CLINICS = [
|
||||
"homepage": "bkhospital.com",
|
||||
"youtube": "youtube.com/channel/UChJONft3hemy5DGbXUveTFg",
|
||||
"instagram": "instagram.com/bkhospital_korea",
|
||||
"facebook": "",
|
||||
"facebook": "facebook.com/bkhospitalkorea",
|
||||
"naverPlace": "https://naver.me/517CTH3W",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/english_bkhospital",
|
||||
"facebookEn": "facebook.com/BKPSKoreaE",
|
||||
"kakaoTalk": "pf.kakao.com/_kpxjLV"
|
||||
@@ -114,9 +119,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "facebook.com/toxnfill.official",
|
||||
"naverPlace": "https://naver.me/FvEmJIHA",
|
||||
"naverBlog": "blog.naver.com/toxnfill",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/toxnfill",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/3702",
|
||||
"tiktok": "tiktok.com/@toxnfillglobal",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/toxnfill_global",
|
||||
"facebookEn": "facebook.com/p/Toxnfill-Global-61557593068252",
|
||||
"kakaoTalk": "pf.kakao.com/_EKXJxl"
|
||||
@@ -133,7 +139,8 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/with_theps",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/30",
|
||||
"tiktok": "",
|
||||
"tiktok": "tiktok.com/@the_plasticsurgery",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/the_plasticsurgery.en",
|
||||
"facebookEn": "facebook.com/theps.english",
|
||||
"kakaoTalk": "pf.kakao.com/_yUAZE"
|
||||
@@ -151,9 +158,10 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/125",
|
||||
"tiktok": "tiktok.com/@oracleclinic_usa",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/oracleclinic_global",
|
||||
"facebookEn": "facebook.com/oracleclinicglobal",
|
||||
"kakaoTalk": ""
|
||||
"kakaoTalk": "pf.kakao.com/_RHjhl"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -168,6 +176,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2500",
|
||||
"tiktok": "tiktok.com/@wonjin_official",
|
||||
"tiktokEn": "tiktok.com/@wonjinglobal",
|
||||
"instagramEn": "instagram.com/wonjinplasticsurgery",
|
||||
"facebookEn": "facebook.com/wonjinplasticsurgery",
|
||||
"kakaoTalk": "pf.kakao.com/_bxflzE"
|
||||
@@ -179,12 +188,13 @@ MOCK_CLINICS = [
|
||||
"homepage": "mindprs.com",
|
||||
"youtube": "youtube.com/channel/UCzM5tIgkC8Es10YmLI55R_w",
|
||||
"instagram": "instagram.com/mind.prs",
|
||||
"facebook": "",
|
||||
"facebook": "facebook.com/mindprs",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/1342923541",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/729",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/mindprs_eng",
|
||||
"facebookEn": "facebook.com/mindprseng",
|
||||
"kakaoTalk": "pf.kakao.com/_kmxodC"
|
||||
@@ -202,6 +212,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/215",
|
||||
"tiktok": "tiktok.com/@braunps",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/braunpskr",
|
||||
"facebookEn": "facebook.com/braunpskr",
|
||||
"kakaoTalk": "pf.kakao.com/_gMVxaT"
|
||||
@@ -219,6 +230,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/926",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_JxoeFu"
|
||||
@@ -236,8 +248,9 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/938",
|
||||
"tiktok": "tiktok.com/@nanahospitaleng",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/nanahospital_eng",
|
||||
"facebookEn": "",
|
||||
"facebookEn": "facebook.com/nanahospital.eng",
|
||||
"kakaoTalk": "pf.kakao.com/_ZxgKUC"
|
||||
}
|
||||
},
|
||||
@@ -253,8 +266,9 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2186",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/noteprs_eng",
|
||||
"facebookEn": "facebook.com/Noteprs.English",
|
||||
"kakaoTalk": "pf.kakao.com/_xbvuxaT"
|
||||
}
|
||||
},
|
||||
@@ -270,8 +284,9 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/250",
|
||||
"tiktok": "tiktok.com/@daprs",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/daplasticsurgery_korea",
|
||||
"facebookEn": "",
|
||||
"facebookEn": "facebook.com/daplasticsurgery",
|
||||
"kakaoTalk": "pf.kakao.com/_Qqrzd"
|
||||
}
|
||||
},
|
||||
@@ -286,9 +301,10 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/abps20",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/3004",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktok": "tiktok.com/@abplasticsurgeryeng",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/ab_plasticsurgery_eng",
|
||||
"facebookEn": "facebook.com/abplasticsurgeryeng",
|
||||
"kakaoTalk": "pf.kakao.com/_lJnuK"
|
||||
}
|
||||
},
|
||||
@@ -301,10 +317,11 @@ MOCK_CLINICS = [
|
||||
"facebook": "facebook.com/biopskorea",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/21428819",
|
||||
"naverBlog": "blog.naver.com/bioplastics20",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/prsyang",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/bioplasticsurgery",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
}
|
||||
@@ -321,6 +338,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/139",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/jayjunps_eng",
|
||||
"facebookEn": "facebook.com/jayjuneng",
|
||||
"kakaoTalk": "pf.kakao.com/_XxmSFV"
|
||||
@@ -338,8 +356,9 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/141",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/marbleps_english",
|
||||
"facebookEn": "",
|
||||
"facebookEn": "facebook.com/marbleps.eng",
|
||||
"kakaoTalk": "pf.kakao.com/_xefxmxiM"
|
||||
}
|
||||
},
|
||||
@@ -355,6 +374,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/55",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/jewelryps_global",
|
||||
"facebookEn": "facebook.com/jewelrypsglobal",
|
||||
"kakaoTalk": "pf.kakao.com/_SSaRE"
|
||||
@@ -372,7 +392,8 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/116",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/tsprsglobal",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_Jxhduxd"
|
||||
}
|
||||
@@ -389,8 +410,9 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/248",
|
||||
"tiktok": "tiktok.com/@yuno_global",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/yuno.global",
|
||||
"facebookEn": "facebook.com/yuno.global",
|
||||
"kakaoTalk": "pf.kakao.com/_xkWbSu"
|
||||
}
|
||||
},
|
||||
@@ -405,7 +427,8 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/night140160",
|
||||
"naverCafe": "cafe.naver.com/litingps",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/331",
|
||||
"tiktok": "",
|
||||
"tiktok": "tiktok.com/@liting_ps",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xfxmiDu"
|
||||
@@ -422,9 +445,10 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/answerps",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/1449",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktok": "tiktok.com/@answerplasticsurgery1",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/answerplasticsurgery",
|
||||
"facebookEn": "facebook.com/answerplasticsurgeryseoul",
|
||||
"kakaoTalk": ""
|
||||
}
|
||||
},
|
||||
@@ -440,6 +464,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2196",
|
||||
"tiktok": "tiktok.com/@thefixps2860",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
@@ -454,9 +479,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/21705376",
|
||||
"naverBlog": "blog.naver.com/girinlife",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/girinlife",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/398",
|
||||
"tiktok": "tiktok.com/@girin_korea",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/girin_eng",
|
||||
"facebookEn": "facebook.com/girinplasticsurgery.en",
|
||||
"kakaoTalk": "pf.kakao.com/_mtiyl"
|
||||
@@ -468,12 +494,13 @@ MOCK_CLINICS = [
|
||||
"homepage": "asps.co.kr",
|
||||
"youtube": "youtube.com/channel/UCqNtVCL2u5Xvx74ymboxDyg",
|
||||
"instagram": "instagram.com/asps_no.1",
|
||||
"facebook": "",
|
||||
"facebook": "facebook.com/seoulps",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/11531189",
|
||||
"naverBlog": "blog.naver.com/asps0119",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/fox5282",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/213",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/asps_en",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_bMkqxd"
|
||||
@@ -491,6 +518,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/4154",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_jPxgNxd"
|
||||
@@ -508,6 +536,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/623",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_Jntxnb"
|
||||
@@ -519,14 +548,15 @@ MOCK_CLINICS = [
|
||||
"homepage": "objetps.com",
|
||||
"youtube": "youtube.com/channel/UC2QrFhj-S8oUrbfOp1NXKZA",
|
||||
"instagram": "instagram.com/objet_plastic_surgery",
|
||||
"facebook": "",
|
||||
"facebook": "facebook.com/p/오브제성형외과-100064266697249",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "blog.naver.com/objetps",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2122",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/objetplasticsurgery_eng",
|
||||
"facebookEn": "facebook.com/61584552036644",
|
||||
"kakaoTalk": "pf.kakao.com/_HtZsxb"
|
||||
}
|
||||
},
|
||||
@@ -542,6 +572,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/6597",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_eTyqn"
|
||||
@@ -559,7 +590,8 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/166",
|
||||
"tiktok": "tiktok.com/@eighthospital.th",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/eightplasticsurgery",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_zxafjxl"
|
||||
}
|
||||
@@ -576,6 +608,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/108",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/opera_plastic_surgery_eng",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_iCPwE"
|
||||
@@ -593,6 +626,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/69",
|
||||
"tiktok": "tiktok.com/@lienjang_ps",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/lienjang_english",
|
||||
"facebookEn": "facebook.com/lienjang.english",
|
||||
"kakaoTalk": "pf.kakao.com/_xlhEyl"
|
||||
@@ -607,9 +641,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/21868487",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/luho1",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/660",
|
||||
"tiktok": "tiktok.com/@luho_beauty_jp",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/luho_global",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_kvrXj"
|
||||
@@ -627,6 +662,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/4244",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_eVmCxj"
|
||||
@@ -644,6 +680,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/300",
|
||||
"tiktok": "tiktok.com/@atopplasticsurgery",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/atop_plasticsurgery",
|
||||
"facebookEn": "facebook.com/atoppsglobal",
|
||||
"kakaoTalk": "pf.kakao.com/_tePHd"
|
||||
@@ -661,6 +698,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/563",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xcwXAxd"
|
||||
@@ -678,6 +716,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "cafe.naver.com/starclinic",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xhXPdl"
|
||||
@@ -695,9 +734,10 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/itemps_eng",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
"kakaoTalk": "pf.kakao.com/_DxmNeK"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -712,6 +752,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_RWpexd"
|
||||
@@ -728,9 +769,10 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/2amsomething",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2991",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktok": "tiktok.com/@pspskorea",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/pspsenglish",
|
||||
"facebookEn": "facebook.com/pspskorea",
|
||||
"kakaoTalk": "pf.kakao.com/_vCLxdK"
|
||||
}
|
||||
},
|
||||
@@ -745,7 +787,8 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/58",
|
||||
"tiktok": "",
|
||||
"tiktok": "tiktok.com/@iwellps",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "facebook.com/iwellpseng",
|
||||
"kakaoTalk": "pf.kakao.com/_Sxlhql"
|
||||
@@ -763,6 +806,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/54",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/glovi_eng",
|
||||
"facebookEn": "facebook.com/glovieng",
|
||||
"kakaoTalk": "pf.kakao.com/_cVdhxh"
|
||||
@@ -780,6 +824,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/1181",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xcsxaZl"
|
||||
@@ -790,13 +835,14 @@ MOCK_CLINICS = [
|
||||
"urls": {
|
||||
"homepage": "onepeakps.com",
|
||||
"youtube": "",
|
||||
"instagram": "",
|
||||
"instagram": "instagram.com/onepeakps",
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/3000",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_jwbqK"
|
||||
@@ -813,9 +859,10 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/ina3599",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/66",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"tiktok": "tiktok.com/@topfaceplasticsurgery",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/topfaceplasticsurgeryclinic",
|
||||
"facebookEn": "facebook.com/topfaceplasticsurgery",
|
||||
"kakaoTalk": "pf.kakao.com/_BqwFxb"
|
||||
}
|
||||
},
|
||||
@@ -824,13 +871,14 @@ MOCK_CLINICS = [
|
||||
"urls": {
|
||||
"homepage": "http://semin100.co.kr",
|
||||
"youtube": "youtube.com/channel/UCKaNYEvRqME2h1lUSOYIYew",
|
||||
"instagram": "",
|
||||
"instagram": "instagram.com/seminps",
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "blog.naver.com/semin100",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
@@ -848,6 +896,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "cafe.naver.com/baekstage",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_XxdSxmE"
|
||||
@@ -865,6 +914,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/4749",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_cxekpxd"
|
||||
@@ -881,7 +931,8 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/5500",
|
||||
"tiktok": "",
|
||||
"tiktok": "tiktok.com/@dl_plastic_en",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/dl_plastic_int",
|
||||
"facebookEn": "facebook.com/dl.plastic.en",
|
||||
"kakaoTalk": "pf.kakao.com/_xgpMCG"
|
||||
@@ -899,6 +950,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/431",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xjepWxl"
|
||||
@@ -916,43 +968,28 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/laprin_en",
|
||||
"facebookEn": "facebook.com/Laprinprincess.en",
|
||||
"kakaoTalk": "pf.kakao.com/_xieNxmV"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "도도성형외과",
|
||||
"urls": {
|
||||
"homepage": "http://dodobeauty.com",
|
||||
"youtube": "",
|
||||
"instagram": "",
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "blog.naver.com/mmscjh",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "엠제이성형외과",
|
||||
"urls": {
|
||||
"homepage": "mjskinclinic.com",
|
||||
"youtube": "youtube.com/channel/UCFjkFyYDu4HpLjc9axlh6YQ",
|
||||
"instagram": "",
|
||||
"instagram": "instagram.com/mjskinclinic",
|
||||
"facebook": "facebook.com/people/MJ피부과/100063928095304",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "blog.naver.com/mjskinclinic",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/mjskinclinic_en",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
"kakaoTalk": "pf.kakao.com/_xcdgixb"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -967,6 +1004,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/5870",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_HKxkxeG"
|
||||
@@ -984,6 +1022,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/2052",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_xfjyQj"
|
||||
@@ -1001,6 +1040,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/4459",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_fCExej"
|
||||
@@ -1018,6 +1058,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/339",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_tBclE"
|
||||
@@ -1032,9 +1073,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/likeps",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/912",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_UxfEmC"
|
||||
@@ -1052,6 +1094,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/1265",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_zJBPxl"
|
||||
@@ -1069,6 +1112,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_pICRM"
|
||||
@@ -1083,9 +1127,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "facebook.com/서울아이성형외과-105199207892670",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/1240083198",
|
||||
"naverBlog": "blog.naver.com/seoulips",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/cometrueps",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/839",
|
||||
"tiktok": "tiktok.com/@seoulips_jp",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/seouli_eng",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_pxlYUxb"
|
||||
@@ -1103,9 +1148,10 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/5554",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/saerops_en",
|
||||
"facebookEn": "facebook.com/p/SAERO-Plastic-Surgery-61552761680056",
|
||||
"kakaoTalk": "pf.kakao.com/_rMQTG"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1119,7 +1165,8 @@ MOCK_CLINICS = [
|
||||
"naverBlog": "blog.naver.com/chaminst",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/4212",
|
||||
"tiktok": "",
|
||||
"tiktok": "tiktok.com/@chaminps",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_afxgpb"
|
||||
@@ -1137,28 +1184,12 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/6680",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_exfHsxb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "화이트성형외과",
|
||||
"urls": {
|
||||
"homepage": "http://whiteclinic.com",
|
||||
"youtube": "",
|
||||
"instagram": "",
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_FxdRvd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "미호성형외과",
|
||||
"urls": {
|
||||
@@ -1171,6 +1202,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/369",
|
||||
"tiktok": "tiktok.com/@koreaplasticsurgery",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/mihops_en",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_yxmexod"
|
||||
@@ -1181,13 +1213,14 @@ MOCK_CLINICS = [
|
||||
"urls": {
|
||||
"homepage": "http://avenueps.com",
|
||||
"youtube": "youtube.com/channel/UCOTVAerYogSEia3L-ERkAFg",
|
||||
"instagram": "",
|
||||
"instagram": "instagram.com/avenueps15",
|
||||
"facebook": "",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/6204",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": ""
|
||||
@@ -1198,13 +1231,14 @@ MOCK_CLINICS = [
|
||||
"urls": {
|
||||
"homepage": "bon-ps.com",
|
||||
"youtube": "youtube.com/channel/UClCjGIfEb3b1N-Q5tCNSU5w",
|
||||
"instagram": "",
|
||||
"instagram": "instagram.com/bon_p.s",
|
||||
"facebook": "",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/1492257313",
|
||||
"naverBlog": "blog.naver.com/miz2199",
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_AQZxbu"
|
||||
@@ -1219,9 +1253,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "",
|
||||
"naverPlace": "https://m.place.naver.com/hospital/1638918034",
|
||||
"naverBlog": "",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/arcps",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/3569",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/arcplasticsurgery_en",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_dxdQxdb"
|
||||
@@ -1239,6 +1274,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_IxaxekV"
|
||||
@@ -1256,7 +1292,8 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/1178",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/younme_eng",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_yKPmM"
|
||||
}
|
||||
@@ -1273,7 +1310,8 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/3429",
|
||||
"tiktok": "",
|
||||
"instagramEn": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "instagram.com/mano_plastic_surgery_clinic",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_ksJts"
|
||||
}
|
||||
@@ -1290,6 +1328,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/413",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_JLxofl"
|
||||
@@ -1307,6 +1346,7 @@ MOCK_CLINICS = [
|
||||
"naverCafe": "",
|
||||
"gangnamUnni": "",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_SCEJxj"
|
||||
@@ -1321,9 +1361,10 @@ MOCK_CLINICS = [
|
||||
"facebook": "facebook.com/pages/category/Hospital/더원성형외과-1539415639613021",
|
||||
"naverPlace": "",
|
||||
"naverBlog": "blog.naver.com/brs0714",
|
||||
"naverCafe": "",
|
||||
"naverCafe": "cafe.naver.com/cephalos1.cafe",
|
||||
"gangnamUnni": "www.gangnamunni.com/hospitals/5636",
|
||||
"tiktok": "",
|
||||
"tiktokEn": "",
|
||||
"instagramEn": "",
|
||||
"facebookEn": "",
|
||||
"kakaoTalk": "pf.kakao.com/_eWIqK"
|
||||
|
||||
+65
-66
@@ -66,22 +66,18 @@ class RegistryData(CamelModel):
|
||||
|
||||
|
||||
class ClinicSnapshot(CamelModel):
|
||||
name: str
|
||||
name_en: str
|
||||
established: str
|
||||
years_in_business: int
|
||||
staff_count: int
|
||||
lead_doctor: LeadDoctor
|
||||
overall_rating: float
|
||||
total_reviews: int
|
||||
price_range: PriceRange
|
||||
certifications: list[str]
|
||||
media_appearances: list[str]
|
||||
medical_tourism: list[str]
|
||||
location: str
|
||||
nearest_station: str
|
||||
phone: str
|
||||
domain: str
|
||||
# _build_clinic_snapshot은 source 데이터 있을 때만 필드 추가 (`if x:` 가드).
|
||||
# 강남언니/홈페이지 수집 누락된 병원에서 required면 ValidationError로 리포트 전체 실패.
|
||||
name: str | None = None
|
||||
name_en: str | None = None
|
||||
staff_count: int | None = None
|
||||
lead_doctor: LeadDoctor | None = None
|
||||
overall_rating: float | None = None
|
||||
total_reviews: int | None = None
|
||||
certifications: list[str] = []
|
||||
location: str | None = None
|
||||
phone: str | None = None
|
||||
domain: str | None = None
|
||||
logo_images: LogoImages | None = None
|
||||
brand_colors: BrandColors | None = None
|
||||
source: DataSource | None = None
|
||||
@@ -121,43 +117,45 @@ class TopVideo(CamelModel):
|
||||
|
||||
|
||||
class YouTubeAudit(CamelModel):
|
||||
channel_name: str
|
||||
handle: str
|
||||
subscribers: int
|
||||
total_videos: int
|
||||
total_views: int
|
||||
weekly_view_growth: WeeklyViewGrowth
|
||||
estimated_monthly_revenue: EstimatedRevenue
|
||||
avg_video_length: str
|
||||
upload_frequency: str
|
||||
channel_created_date: str
|
||||
subscriber_rank: str
|
||||
channel_description: str
|
||||
linked_urls: list[LinkedUrl]
|
||||
playlists: list[str]
|
||||
top_videos: list[TopVideo]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
# YouTube 채널 없는 병원이면 _build_youtube_audit가 채울 수 없는 필드들 (channel_name 등)이 빔.
|
||||
# required면 ValidationError로 리포트 실패 → Optional로 받아 부분 응답 허용.
|
||||
channel_name: str | None = None
|
||||
handle: str | None = None
|
||||
subscribers: int | None = None
|
||||
total_videos: int | None = None
|
||||
total_views: int | None = None
|
||||
weekly_view_growth: WeeklyViewGrowth | None = None
|
||||
estimated_monthly_revenue: EstimatedRevenue | None = None
|
||||
avg_video_length: str | None = None
|
||||
upload_frequency: str | None = None
|
||||
channel_created_date: str | None = None
|
||||
channel_description: str | None = None
|
||||
linked_urls: list[LinkedUrl] = []
|
||||
playlists: list[str] = []
|
||||
top_videos: list[TopVideo] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
|
||||
|
||||
class InstagramAccount(CamelModel):
|
||||
handle: str
|
||||
language: Language
|
||||
label: str
|
||||
posts: int
|
||||
followers: int
|
||||
following: int
|
||||
category: str
|
||||
profile_link: str
|
||||
highlights: list[str]
|
||||
reels_count: int
|
||||
content_format: str
|
||||
profile_photo: str
|
||||
bio: str
|
||||
# 인스타 계정(KR/EN) 미수집 시 빈 필드 가능 — Optional.
|
||||
handle: str | None = None
|
||||
language: Language | None = None
|
||||
label: str | None = None
|
||||
posts: int | None = None
|
||||
followers: int | None = None
|
||||
following: int | None = None
|
||||
category: str | None = None
|
||||
profile_link: str | None = None
|
||||
highlights: list[str] = []
|
||||
reels_count: int | None = None
|
||||
content_format: str | None = None
|
||||
profile_photo: str | None = None
|
||||
bio: str | None = None
|
||||
|
||||
|
||||
class InstagramAudit(CamelModel):
|
||||
accounts: list[InstagramAccount]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
accounts: list[InstagramAccount] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
|
||||
|
||||
class BrandInconsistencyValue(CamelModel):
|
||||
@@ -174,31 +172,32 @@ class BrandInconsistency(CamelModel):
|
||||
|
||||
|
||||
class FacebookPage(CamelModel):
|
||||
url: str
|
||||
page_name: str
|
||||
language: Language
|
||||
label: str
|
||||
followers: int
|
||||
following: int
|
||||
category: str
|
||||
bio: str
|
||||
logo: str
|
||||
logo_description: str
|
||||
link: str
|
||||
linked_domain: str
|
||||
reviews: int
|
||||
recent_post_age: str
|
||||
has_whatsapp: bool
|
||||
# 페북 페이지(KR/EN) 미수집 시 빈 필드 가능 — Optional.
|
||||
url: str | None = None
|
||||
page_name: str | None = None
|
||||
language: Language | None = None
|
||||
label: str | None = None
|
||||
followers: int | None = None
|
||||
following: int | None = None
|
||||
category: str | None = None
|
||||
bio: str | None = None
|
||||
logo: str | None = None
|
||||
logo_description: str | None = None
|
||||
link: str | None = None
|
||||
linked_domain: str | None = None
|
||||
reviews: int | None = None
|
||||
recent_post_age: str | None = None
|
||||
has_whatsapp: bool | None = None
|
||||
post_frequency: str | None = None
|
||||
top_content_type: str | None = None
|
||||
engagement: str | None = None
|
||||
|
||||
|
||||
class FacebookAudit(CamelModel):
|
||||
pages: list[FacebookPage]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
brand_inconsistencies: list[BrandInconsistency]
|
||||
consolidation_recommendation: str
|
||||
pages: list[FacebookPage] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
brand_inconsistencies: list[BrandInconsistency] = []
|
||||
consolidation_recommendation: str | None = None
|
||||
|
||||
|
||||
class OtherChannel(CamelModel):
|
||||
|
||||
+160
-41
@@ -1,9 +1,11 @@
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from datetime import datetime
|
||||
from common.db import fetchone, execute, fetch_raw, get_analysis_raw_data, save_analysis_report, get_market_analysis
|
||||
from integrations.llm.llm_service import LLMService
|
||||
from integrations.llm.prompt import report_prompt, plan_prompt
|
||||
from integrations.llm.schemas.report import ReportOutput
|
||||
from integrations.llm.prompt import report_prompt, plan_prompt, youtube_diagnosis_prompt
|
||||
from integrations.llm.schemas.report import ReportOutput, ClinicSnapshot, YouTubeAudit
|
||||
from services.instagram_audit import build_instagram_accounts
|
||||
from services.facebook_audit import build_facebook_pages
|
||||
from integrations.llm.schemas.plan import PlanOutput
|
||||
@@ -93,6 +95,8 @@ async def generate_plan(analysis_run_id: str) -> PlanOutput:
|
||||
"instagram_en": _json(clinic.get("instagramEn")),
|
||||
"facebook_en": _json(clinic.get("facebookEn")),
|
||||
"naver_blog": _json(_naver_blog_summary(raw.get("naver_blog"))),
|
||||
"naver_cafe": _json(clinic.get("naverCafe")),
|
||||
"kakao_talk": _json(clinic.get("kakaoTalk")),
|
||||
"channel_logos": _json(clinic.get("channelLogos")),
|
||||
"brand_assets": _json(clinic.get("brandAssets")),
|
||||
}
|
||||
@@ -100,6 +104,33 @@ async def generate_plan(analysis_run_id: str) -> PlanOutput:
|
||||
return await LLMService(provider="perplexity").generate(plan_prompt, input_data)
|
||||
|
||||
|
||||
def _build_clinic_snapshot(gangnam_unni: dict, hospital: dict) -> dict:
|
||||
snapshot: dict = {}
|
||||
doctors = gangnam_unni.get("doctors", [])
|
||||
lead = max(doctors, key=lambda d: d.get("reviews", 0)) if doctors else None
|
||||
if gangnam_unni.get("name"): snapshot["name"] = gangnam_unni["name"]
|
||||
if hospital.get("clinicNameEn"): snapshot["name_en"] = hospital["clinicNameEn"]
|
||||
if hospital.get("phone"): snapshot["phone"] = hospital["phone"]
|
||||
if hospital.get("domain"): snapshot["domain"] = hospital["domain"]
|
||||
if gangnam_unni.get("rating"): snapshot["overall_rating"] = gangnam_unni["rating"]
|
||||
if gangnam_unni.get("totalReviews"): snapshot["total_reviews"] = gangnam_unni["totalReviews"]
|
||||
if gangnam_unni.get("address"): snapshot["location"] = gangnam_unni["address"]
|
||||
if gangnam_unni.get("badges"): snapshot["certifications"] = gangnam_unni["badges"]
|
||||
if gangnam_unni.get("totalMajorStaffs"): snapshot["staff_count"] = gangnam_unni["totalMajorStaffs"]
|
||||
if lead:
|
||||
snapshot["lead_doctor"] = {
|
||||
"name": lead.get("name"),
|
||||
"credentials": lead.get("specialty"),
|
||||
"rating": lead.get("rating"),
|
||||
"review_count": lead.get("reviews"),
|
||||
}
|
||||
# brand_assets에서 logo_images / brand_colors 강제 주입. LLM이 프롬프트 가드 무시하고 null로 두는 케이스 차단.
|
||||
ba = hospital.get("brandAssets") or {}
|
||||
if ba.get("logo_images"): snapshot["logo_images"] = ba["logo_images"]
|
||||
if ba.get("brand_colors"): snapshot["brand_colors"] = ba["brand_colors"]
|
||||
return ClinicSnapshot.model_validate(snapshot).model_dump()
|
||||
|
||||
|
||||
def _naver_blog_summary(blog: dict | None) -> dict | None:
|
||||
"""plan 카드 한 장에 들어가는 건 전체 포스트 수와 최근 활동 시점뿐. 그 외(본문·링크·제목)는
|
||||
던져봐야 토큰만 늘고 LLM이 무관 정보로 hallucinate 함."""
|
||||
@@ -112,6 +143,117 @@ def _naver_blog_summary(blog: dict | None) -> dict | None:
|
||||
}
|
||||
|
||||
|
||||
def _parse_iso_duration_seconds(iso: str) -> int:
|
||||
m = re.match(r"PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?", iso or "")
|
||||
if not m:
|
||||
return 0
|
||||
h, mins, s = (int(x or 0) for x in m.groups())
|
||||
return h * 3600 + mins * 60 + s
|
||||
|
||||
|
||||
def _format_seconds(seconds: int) -> str:
|
||||
m, s = divmod(seconds, 60)
|
||||
h, m = divmod(m, 60)
|
||||
return f"{h}시간 {m}분" if h else f"{m}분 {s}초"
|
||||
|
||||
|
||||
def _format_clock(seconds: int) -> str:
|
||||
m, s = divmod(seconds, 60)
|
||||
h, m = divmod(m, 60)
|
||||
return f"{h}:{m:02d}:{s:02d}" if h else f"{m}:{s:02d}"
|
||||
|
||||
|
||||
def _calc_avg_video_length(videos: list[dict]) -> str:
|
||||
durations = [_parse_iso_duration_seconds(v.get("duration", "")) for v in videos]
|
||||
durations = [d for d in durations if d > 0]
|
||||
if not durations:
|
||||
return ""
|
||||
return _format_seconds(sum(durations) // len(durations))
|
||||
|
||||
|
||||
def _relative_date(date_str: str) -> str:
|
||||
if not date_str:
|
||||
return ""
|
||||
try:
|
||||
past = datetime.fromisoformat(date_str[:10])
|
||||
except ValueError:
|
||||
return ""
|
||||
days = (datetime.now() - past).days
|
||||
if days < 1:
|
||||
return "오늘"
|
||||
if days < 30:
|
||||
return f"{days}일 전"
|
||||
if days < 365:
|
||||
return f"{days // 30}개월 전"
|
||||
return f"{days // 365}년 전"
|
||||
|
||||
|
||||
def _calc_upload_frequency(videos: list[dict]) -> str:
|
||||
dates = sorted(
|
||||
[v["date"][:10] for v in videos if v.get("date")],
|
||||
reverse=True,
|
||||
)
|
||||
if len(dates) < 2:
|
||||
return ""
|
||||
gaps = [
|
||||
(datetime.fromisoformat(dates[i]) - datetime.fromisoformat(dates[i + 1])).days
|
||||
for i in range(len(dates) - 1)
|
||||
]
|
||||
avg_days = sum(gaps) // len(gaps)
|
||||
if avg_days <= 7:
|
||||
return f"주 {7 // max(avg_days, 1)}회"
|
||||
if avg_days <= 30:
|
||||
return f"월 {30 // avg_days}회"
|
||||
return f"{avg_days}일에 1회"
|
||||
|
||||
|
||||
async def _build_youtube_audit(youtube: dict) -> dict:
|
||||
videos = youtube.get("videos", [])
|
||||
yt_patch: dict = {
|
||||
"weekly_view_growth": {"absolute": 0, "percentage": 0.0},
|
||||
"estimated_monthly_revenue": {"min": 0, "max": 0},
|
||||
"linked_urls": [],
|
||||
"avg_video_length": _calc_avg_video_length(videos),
|
||||
"upload_frequency": _calc_upload_frequency(videos),
|
||||
}
|
||||
if youtube.get("channelName"): yt_patch["channel_name"] = youtube["channelName"]
|
||||
if youtube.get("handle"): yt_patch["handle"] = youtube["handle"]
|
||||
if youtube.get("subscribers"): yt_patch["subscribers"] = youtube["subscribers"]
|
||||
if youtube.get("totalVideos"): yt_patch["total_videos"] = youtube["totalVideos"]
|
||||
if youtube.get("totalViews"): yt_patch["total_views"] = youtube["totalViews"]
|
||||
if youtube.get("publishedAt"): yt_patch["channel_created_date"] = youtube["publishedAt"][:10]
|
||||
if youtube.get("description"): yt_patch["channel_description"] = youtube["description"]
|
||||
if youtube.get("playlists"): yt_patch["playlists"] = youtube["playlists"]
|
||||
if videos:
|
||||
yt_patch["top_videos"] = [
|
||||
{
|
||||
"title": v["title"],
|
||||
"views": v["views"],
|
||||
"duration": _format_clock(_parse_iso_duration_seconds(v.get("duration", ""))),
|
||||
"type": "Short" if "M" not in v.get("duration", "") else "Long",
|
||||
"uploaded_ago": _relative_date(v.get("date", "")),
|
||||
}
|
||||
for v in videos
|
||||
]
|
||||
|
||||
diagnosis_result = await LLMService(provider="perplexity").generate(
|
||||
youtube_diagnosis_prompt,
|
||||
{
|
||||
"channel_name": yt_patch.get("channel_name"),
|
||||
"subscribers": yt_patch.get("subscribers"),
|
||||
"total_videos": yt_patch.get("total_videos"),
|
||||
"total_views": yt_patch.get("total_views"),
|
||||
"avg_video_length": yt_patch.get("avg_video_length"),
|
||||
"upload_frequency": yt_patch.get("upload_frequency"),
|
||||
"top_videos": json.dumps(yt_patch.get("top_videos", []), ensure_ascii=False),
|
||||
"playlists": json.dumps(yt_patch.get("playlists", []), ensure_ascii=False),
|
||||
},
|
||||
)
|
||||
yt_patch["diagnosis"] = [item.model_dump() for item in diagnosis_result.diagnosis]
|
||||
|
||||
return YouTubeAudit.model_validate(yt_patch).model_dump()
|
||||
|
||||
|
||||
async def _build_overrides(analysis_run_id: str) -> dict:
|
||||
run = await fetchone(
|
||||
"SELECT hospital_id, instagram_data_id, facebook_data_id,"
|
||||
@@ -123,34 +265,19 @@ async def _build_overrides(analysis_run_id: str) -> dict:
|
||||
return {}
|
||||
|
||||
hospital_row = await fetchone(
|
||||
"SELECT raw_data FROM hospital_baseinfo WHERE hospital_id = %s",
|
||||
"SELECT raw_data, url FROM hospital_baseinfo WHERE hospital_id = %s",
|
||||
(run["hospital_id"],),
|
||||
)
|
||||
hospital = json.loads(hospital_row["raw_data"]) if hospital_row and isinstance(hospital_row.get("raw_data"), str) else (hospital_row or {}).get("raw_data") or {}
|
||||
hospital["domain"] = (hospital_row or {}).get("url") or ""
|
||||
instagram = await fetch_raw("instagram_data", run["instagram_data_id"]) or {}
|
||||
facebook = await fetch_raw("facebook_data", run["facebook_data_id"]) or {}
|
||||
naver_blog = await fetch_raw("naver_blog_data", run["naver_blog_data_id"]) or {}
|
||||
youtube = await fetch_raw("youtube_data", run["youtube_data_id"]) or {}
|
||||
gangnam_unni = await fetch_raw("gangnam_unni_data", run["gangnam_unni_data_id"]) or {}
|
||||
|
||||
snapshot: dict = {}
|
||||
|
||||
# ── gangnam_unni ──────────────────────────────────────────────────────────
|
||||
doctors = gangnam_unni.get("doctors", [])
|
||||
lead = max(doctors, key=lambda d: d.get("reviews", 0)) if doctors else None
|
||||
if gangnam_unni.get("name"): snapshot["name"] = gangnam_unni["name"]
|
||||
if gangnam_unni.get("rating"): snapshot["overall_rating"] = gangnam_unni["rating"]
|
||||
if gangnam_unni.get("totalReviews"): snapshot["total_reviews"] = gangnam_unni["totalReviews"]
|
||||
if gangnam_unni.get("address"): snapshot["location"] = gangnam_unni["address"]
|
||||
if gangnam_unni.get("badges"): snapshot["certifications"] = gangnam_unni["badges"]
|
||||
if gangnam_unni.get("totalMajorStaffs"): snapshot["staff_count"] = gangnam_unni["totalMajorStaffs"]
|
||||
if lead:
|
||||
snapshot["lead_doctor"] = {
|
||||
"name": lead.get("name"),
|
||||
"credentials": lead.get("specialty"),
|
||||
"rating": lead.get("rating"),
|
||||
"review_count": lead.get("reviews"),
|
||||
}
|
||||
snapshot: dict = _build_clinic_snapshot(gangnam_unni, hospital)
|
||||
yt_patch: dict = await _build_youtube_audit(youtube)
|
||||
|
||||
# ── instagram (KR·EN 계정을 코드에서 구성 → LLM 출력 무시하고 교체) ──────────────
|
||||
ig_patch = build_instagram_accounts(
|
||||
@@ -160,26 +287,6 @@ async def _build_overrides(analysis_run_id: str) -> dict:
|
||||
# ── facebook (KR=facebook_data, EN=hospital.facebookEn 둘 다 코드 산출, [KR, EN] 순서) ──
|
||||
fb_pages = build_facebook_pages(facebook, hospital.get("facebookEn") or {})
|
||||
|
||||
# ── youtube ───────────────────────────────────────────────────────────────
|
||||
yt_patch: dict = {}
|
||||
if youtube.get("channelName"): yt_patch["channel_name"] = youtube["channelName"]
|
||||
if youtube.get("handle"): yt_patch["handle"] = youtube["handle"]
|
||||
if youtube.get("subscribers"): yt_patch["subscribers"] = youtube["subscribers"]
|
||||
if youtube.get("totalVideos"): yt_patch["total_videos"] = youtube["totalVideos"]
|
||||
if youtube.get("totalViews"): yt_patch["total_views"] = youtube["totalViews"]
|
||||
if youtube.get("publishedAt"): yt_patch["channel_created_date"] = youtube["publishedAt"][:10]
|
||||
if youtube.get("description"): yt_patch["channel_description"] = youtube["description"]
|
||||
if youtube.get("videos"):
|
||||
yt_patch["top_videos"] = [
|
||||
{
|
||||
"title": v["title"],
|
||||
"views": v["views"],
|
||||
"duration": v.get("duration"),
|
||||
"type": "Short" if "M" not in v.get("duration", "") else "Long",
|
||||
"uploaded_ago": v.get("date", "")[:10],
|
||||
}
|
||||
for v in youtube["videos"]
|
||||
]
|
||||
|
||||
overrides: dict = {}
|
||||
if snapshot:
|
||||
@@ -209,6 +316,18 @@ def _patch_report(result: ReportOutput, overrides: dict) -> ReportOutput:
|
||||
merged = _deep_merge(result.model_dump(), overrides)
|
||||
# 인스타 계정은 프롬프트에서 LLM이 []로 두게 했고, 코드가 수집 데이터로 채운다 (데이터 없으면 빈 리스트)
|
||||
merged.setdefault("instagram_audit", {})["accounts"] = (overrides.get("instagram_audit") or {}).get("accounts") or []
|
||||
# 페북 페이지(KR+EN): _page_patch가 부분 필드만 만들어 그대로 박으면 검증 실패(label/logo 등 누락).
|
||||
# LLM이 만든 첫 페이지(보통 KR)를 템플릿으로 복사한 뒤 코드 patch로 인덱스별 덮어쓰기 →
|
||||
# 필수 필드는 LLM 디폴트 받고, 수집 수치는 코드 값. EN 누락 버그 회피.
|
||||
fb_pages = (overrides.get("facebook_audit") or {}).get("pages") or []
|
||||
if fb_pages:
|
||||
base_pages = merged.setdefault("facebook_audit", {}).setdefault("pages", [])
|
||||
template = base_pages[0] if base_pages else None
|
||||
while len(base_pages) < len(fb_pages) and template:
|
||||
base_pages.append({**template})
|
||||
for i, patch in enumerate(fb_pages):
|
||||
if i < len(base_pages):
|
||||
base_pages[i].update(patch)
|
||||
return ReportOutput(**merged)
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from integrations.apify import ApifyClient
|
||||
from integrations.naver import NaverClient
|
||||
from integrations.youtube import YouTubeClient
|
||||
from integrations.firecrawl import FirecrawlClient
|
||||
from services.enrichment import collect_brand_assets, collect_extra_channels, collect_channel_logos
|
||||
from services.collect_extras import collect_brand_assets, collect_extra_channels, collect_channel_logos
|
||||
from services.facebook_audit import transform_for_storage as transform_facebook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -2,12 +2,12 @@ import asyncio
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from urllib.parse import urlparse
|
||||
from common.db import fetchone, fetch_raw, merge_hospital_raw_data
|
||||
from common.utils import get_env
|
||||
from integrations.apify import ApifyClient
|
||||
from integrations.vision import VisionClient
|
||||
from integrations.naver import NaverClient
|
||||
from integrations.color_extractor import extract_brand_assets_from_site
|
||||
from services.facebook_audit import transform_for_storage as transform_facebook
|
||||
|
||||
@@ -58,19 +58,13 @@ async def collect_brand_assets(analysis_run_id: str, hospital_id: str) -> None:
|
||||
return
|
||||
|
||||
# 3. Vision은 로고 정성 묘사만 (hex는 CSS 추출이 더 정확). 키 없으면 색상만 저장.
|
||||
# Gemini Vision은 SVG 미지원 → SVG URL이 후보로 들어오면 Vision skip하고 URL만 그대로 박음 (묘사 없음).
|
||||
SVG_URL = re.compile(r"\.svg(?:\?|#|$)", re.I)
|
||||
# SVG는 vision 내부에서 resvg로 PNG 래스터화 후 Gemini에 던지므로 분기 불필요.
|
||||
result: dict = {}
|
||||
used_kind: str | None = None
|
||||
api_key = os.getenv("GEMINI_API_KEY")
|
||||
if api_key and candidates:
|
||||
vc = VisionClient(api_key)
|
||||
for kind, cand in candidates:
|
||||
if SVG_URL.search(cand):
|
||||
logger.info("[brand_assets] %s URL is SVG — Vision 분석 skip, URL만 보관: %s", kind, cand)
|
||||
result = {"logo_images": {"circle": None, "horizontal": cand, "korean": None}}
|
||||
used_kind = kind
|
||||
break
|
||||
result = await vc.analyze_brand_assets(logo_url=cand, homepage_url=homepage_url)
|
||||
if result:
|
||||
used_kind = kind
|
||||
@@ -106,9 +100,10 @@ async def collect_extra_channels(
|
||||
kakao_talk_url: str | None = None,
|
||||
naver_cafe_url: str | None = None,
|
||||
) -> None:
|
||||
"""틱톡 / 인스타 EN / 페북 EN 수집 + 카카오톡/네이버 카페 URL만 보관 →
|
||||
"""틱톡 / 인스타 EN / 페북 EN / 네이버 카페 수집 + 카카오톡 URL만 보관 →
|
||||
모두 hospital raw_data에 저장. 인스타EN·페북EN은 기존 Apify 수집기 재사용, 틱톡은 신규 액터.
|
||||
카카오톡·네이버 카페는 콘텐츠 수집 안 함 (URL만 → LLM이 채널 존재 신호로 사용)."""
|
||||
네이버 카페는 로그인 필요라 본문 못 보지만 URL 활성·cafeId·이름 언급수만 신호로 수집.
|
||||
카카오톡은 URL만 (LLM이 채널 존재 신호로만 사용)."""
|
||||
apify = ApifyClient(get_env("APIFY_API_TOKEN"))
|
||||
jobs: dict = {}
|
||||
if instagram_en_url:
|
||||
@@ -117,6 +112,9 @@ async def collect_extra_channels(
|
||||
jobs["facebookEn"] = apify.get_facebook_page(facebook_en_url)
|
||||
if tiktok_url:
|
||||
jobs["tiktok"] = apify.get_tiktok_profile(tiktok_url)
|
||||
if naver_cafe_url:
|
||||
nc = NaverClient(get_env("NAVER_CLIENT_ID"), get_env("NAVER_CLIENT_SECRET"))
|
||||
jobs["naverCafe"] = nc.get_cafe_info(naver_cafe_url)
|
||||
|
||||
results: dict = {}
|
||||
if jobs:
|
||||
@@ -133,8 +131,6 @@ async def collect_extra_channels(
|
||||
# URL-only 채널 (수집 X, 존재 여부만)
|
||||
if kakao_talk_url:
|
||||
results["kakaoTalk"] = {"url": kakao_talk_url}
|
||||
if naver_cafe_url:
|
||||
results["naverCafe"] = {"url": naver_cafe_url}
|
||||
|
||||
if not results:
|
||||
logger.info("[extra_channels] 수집 결과 없음 run=%s", analysis_run_id)
|
||||
@@ -10,3 +10,4 @@ passlib[bcrypt]==1.7.4
|
||||
python-multipart==0.0.26
|
||||
uuid6==2025.0.1
|
||||
aiomysql==0.3.2
|
||||
resvg-py==0.3.2
|
||||
Reference in new issue
Block a user