feat(supporters): 유튜브·로고 단계 — collect_youtube.mjs(API 집계·정보형 필터·쇼츠 판별), 워커 youtube 단계(로고·파비콘·homeVideos), 글↔영상 매칭, 카드 로고 대체, 기존 글 보존 재실행. 원진 재배포
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
572978c316
commit
eb873bc43a
12 files changed
+353
-15
No files matched your search
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 112.49 30"><defs><style>.cls-1{fill:#3a5554;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M52,26.71v-.14c.49-.05.58-.09.58-.45V22.65c0-.37-.09-.4-.58-.45v-.15H53.8c1.21,0,1.85.45,1.85,1.29a1.29,1.29,0,0,1-.53,1.08,2.28,2.28,0,0,1-1.34.37l-.55,0v1.36c0,.36.17.4.66.45v.14Zm1.26-2.2a3.47,3.47,0,0,0,.46,0c.8,0,1.23-.41,1.23-1.14a1.08,1.08,0,0,0-.32-.84,1.41,1.41,0,0,0-1-.29h-.41Z"/><path class="cls-1" d="M56,26.71v-.14c.48-.05.57-.09.57-.45V22.65c0-.37-.09-.4-.57-.45v-.15h1.83v.15c-.48.05-.57.09-.57.45v3.78a2.82,2.82,0,0,0,.52,0c.82,0,1.06-.08,1.24-.55l.2-.56h.16l-.1,1.35Z"/><path class="cls-1" d="M64.42,26.71H62.64v-.14c.44,0,.55-.15.55-.28a.91.91,0,0,0,0-.22l-.32-.83H61l-.28.72a.74.74,0,0,0,0,.23c0,.21.21.34.63.38v.14H59.73v-.14c.3,0,.43-.18.57-.54l1.57-4h.43v0l1.57,4c.13.33.23.48.55.52ZM61.05,25h1.67l-.83-2.15Z"/><path class="cls-1" d="M66.32,26.79a2.61,2.61,0,0,1-1.45-.4h0v-1H65a1.28,1.28,0,0,0,1.29,1.18c.65,0,1.08-.37,1.08-.91s-.26-.68-.92-.94l-.33-.13c-.68-.28-1.2-.55-1.22-1.33A1.29,1.29,0,0,1,66.38,22a2.51,2.51,0,0,1,1.35.37h0v.93h-.17a1.22,1.22,0,0,0-1.21-1.07.78.78,0,0,0-.84.82c0,.41.25.67.91.93l.33.13a2.67,2.67,0,0,1,.94.56,1.08,1.08,0,0,1,.29.8C68,26.26,67.34,26.79,66.32,26.79Z"/><path class="cls-1" d="M70.09,22.29h-.37c-.52,0-.78.08-.94.58l-.13.49h-.17V22.05h3.9v1.31h-.16l-.15-.49c-.14-.51-.46-.58-.92-.58h-.38v3.83c0,.37.09.4.58.45v.14H69.51v-.14c.49-.05.58-.09.58-.45Z"/><path class="cls-1" d="M77.26,26.79a2,2,0,0,1-1.55-.65,2.45,2.45,0,0,1-.61-1.71,2.51,2.51,0,0,1,.64-1.77A2.22,2.22,0,0,1,77.42,22a3,3,0,0,1,1.59.46h0v1h-.17a1.48,1.48,0,0,0-1.47-1.21,1.34,1.34,0,0,0-1.12.57,2.55,2.55,0,0,0-.41,1.51c0,1.29.63,2.11,1.66,2.11A1.66,1.66,0,0,0,79,25.61l.19.11A2.12,2.12,0,0,1,77.26,26.79Z"/><path class="cls-1" d="M74.13,26.12c0,.37.09.4.57.45v.14H72.87v-.14c.48-.05.57-.09.57-.45V22.65c0-.37-.09-.4-.57-.45v-.15H74.7v.15c-.48.05-.57.09-.57.45Z"/><path class="cls-1" d="M82.94,26.79a2.63,2.63,0,0,1-1.46-.4h0v-1h.17a1.28,1.28,0,0,0,1.3,1.19A1,1,0,0,0,84,25.65c0-.41-.26-.68-.92-.94l-.33-.13c-.68-.28-1.2-.55-1.22-1.33A1.29,1.29,0,0,1,83,22a2.48,2.48,0,0,1,1.35.37h0v.93h-.17A1.21,1.21,0,0,0,83,22.2a.78.78,0,0,0-.84.82c0,.41.25.67.91.93l.33.13a2.58,2.58,0,0,1,.94.56,1.08,1.08,0,0,1,.29.8C84.6,26.26,84,26.79,82.94,26.79Z"/><path class="cls-1" d="M85.55,22.65c0-.37-.09-.41-.57-.45v-.15h1.84v.15c-.49.05-.58.08-.58.45v2.48c0,.93.38,1.36,1.21,1.36a1.18,1.18,0,0,0,.91-.33,1.42,1.42,0,0,0,.35-1v-2.5c0-.36-.14-.4-.63-.45v-.15H89.6v.15c-.49.05-.58.09-.58.45v2.48a1.66,1.66,0,0,1-.44,1.24,1.77,1.77,0,0,1-1.27.42c-1.17,0-1.75-.55-1.75-1.63Z"/><path class="cls-1" d="M93.67,26l-1-1.46a1.35,1.35,0,0,0,1.06-1.31,1,1,0,0,0-.46-.88,2.52,2.52,0,0,0-1.33-.29H90.06v.15c.49.05.58.08.58.45v3.47c0,.36-.09.4-.58.45v.14h1.82v-.14c-.44-.05-.56-.08-.56-.45V24.65h.44a.31.31,0,0,1,.32.16l1,1.44a.92.92,0,0,0,.89.51,2.54,2.54,0,0,0,.52-.05v-.14C94.19,26.57,93.94,26.37,93.67,26Zm-1.81-1.56a3,3,0,0,1-.54-.05V22.29h.41c.83,0,1.27.37,1.27,1A1,1,0,0,1,91.86,24.43Z"/><path class="cls-1" d="M98,25.19c0-.35-.15-.41-.61-.45V24.6h1.77v.14c-.47,0-.5.11-.51.45V26.3h0a3.23,3.23,0,0,1-1.77.49,2.14,2.14,0,0,1-2.3-2.32,2.54,2.54,0,0,1,.66-1.8A2.34,2.34,0,0,1,97,22a3.08,3.08,0,0,1,1.59.46h0v1H98.4a1.5,1.5,0,0,0-1.47-1.21c-1,0-1.6.84-1.6,2.14a2.75,2.75,0,0,0,.43,1.6,1.41,1.41,0,0,0,1.17.59A1.74,1.74,0,0,0,98,26.16Z"/><path class="cls-1" d="M102.37,25c-.1-.49-.2-.61-.78-.61h-.84v2a3.94,3.94,0,0,0,.82,0c1,0,1.15,0,1.38-.55l.2-.56h.17l-.1,1.35H99.49v-.14c.49-.05.58-.09.58-.45V22.65c0-.37-.09-.4-.58-.45v-.15h3.68v1.19H103l-.13-.39c-.18-.5-.44-.56-1-.56h-1.16V24.2h.84c.58,0,.68-.12.78-.61h.16V25Z"/><path class="cls-1" d="M110,26.12V25l-1.3-2.28c-.21-.36-.32-.49-.59-.54v-.15h1.78v.15c-.36,0-.51.12-.51.27a.65.65,0,0,0,.1.27l1.05,1.88,1-1.75a.62.62,0,0,0,.1-.32c0-.2-.2-.32-.56-.35v-.15h1.47v.15c-.25,0-.37.17-.58.54l-1.25,2.2v1.18c0,.37.09.4.58.45v.14H109.4v-.14C109.89,26.52,110,26.48,110,26.12Z"/><path class="cls-1" d="M107.6,26l-1-1.46a1.37,1.37,0,0,0,1.06-1.31,1,1,0,0,0-.46-.88,2.52,2.52,0,0,0-1.33-.29H104v.15c.49.05.58.08.58.45v3.47c0,.36-.09.4-.58.45v.14h1.81v-.14c-.43-.05-.55-.08-.55-.45V24.65h.43c.18,0,.26,0,.33.16l.95,1.44a.91.91,0,0,0,.88.51,2.58,2.58,0,0,0,.53-.05v-.14C108.12,26.57,107.87,26.37,107.6,26Zm-1.81-1.56a3,3,0,0,1-.54-.05V22.29h.41c.83,0,1.27.37,1.27,1A1,1,0,0,1,105.79,24.43Z"/><path class="cls-1" d="M57.19,13.87c.41,0,.6.2.6.46a.74.74,0,0,1,0,.23l-.91,3-1.18-3.77H55.4L54.17,17.5l-.91-3.08a.56.56,0,0,1,0-.21c0-.15.09-.31.55-.34v-.14H52v.14c.3,0,.45.18.56.51l1.23,4h.43l1.15-3.53,1.1,3.53h.43l1.26-4c.12-.35.26-.5.57-.54v-.14H57.19Z"/><path class="cls-1" d="M61.11,13.65a2.21,2.21,0,0,0-1.67.67,2.5,2.5,0,0,0-.65,1.77,2.43,2.43,0,0,0,.63,1.74A2.35,2.35,0,0,0,63.37,16a2.48,2.48,0,0,0-.62-1.74A2.25,2.25,0,0,0,61.11,13.65Zm0,4.58c-.95,0-1.57-.86-1.57-2.2s.56-2.15,1.49-2.15a1.35,1.35,0,0,1,1.14.59,2.77,2.77,0,0,1,.44,1.64C62.62,17.42,62.06,1Line truncated
|
||||
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1,100 @@
|
||||
// 유튜브 채널 집계 (v1 §4 "유튜브 통계·쇼츠 판별" 이식). YouTube Data API v3 만 쓴다(자막 없음).
|
||||
// node scripts/collect_youtube.mjs --channel <UC... | @handle | 채널 URL> [--out src/data/videos.json] [--max 2000]
|
||||
// 산출: viewclinic videos.json 과 같은 형태.
|
||||
// channel{id,handle,url,title,subscribers,videos,totalViews} · top(전체 조회수 10) · topLong(정보형 롱폼 10) · topShorts(정보형 쇼츠 10)
|
||||
// shortsInfo(정보형 쇼츠 10, answer 는 사람이 채운다) · all(전체, 조회수순) · fetchedAt · shortsDetection
|
||||
// 정보형 판별: 제목에 후기·전후·토크·변신·이벤트 류가 없는 것(게이트 BANNED_VIDEO_TITLE + 확장). 쇼츠 판별: youtube.com/shorts/{id} 가 200 이면 쇼츠(길이 기준 아님, v1 §6).
|
||||
import { writeFileSync, existsSync, readFileSync } from 'node:fs';
|
||||
import { resolve, join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as R from './gate/rules.mjs';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const opt = (k, d) => { const i = args.indexOf(`--${k}`); return i >= 0 && args[i + 1] && !args[i + 1].startsWith('--') ? args[i + 1] : d; };
|
||||
const here = fileURLToPath(new URL('.', import.meta.url));
|
||||
(function loadEnv() { let dir = here; for (let i = 0; i < 4; i++) { const p = join(dir, '.env'); if (existsSync(p)) for (const line of readFileSync(p, 'utf8').split('\n')) { const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/); if (m && !process.env[m[1]]) process.env[m[1]] = m[2].replace(/^["']|["']$/g, ''); } dir = dirname(dir); } })();
|
||||
const KEY = process.env.YOUTUBE_API_KEY;
|
||||
if (!KEY) { console.error('YOUTUBE_API_KEY 없음'); process.exit(2); }
|
||||
const input = opt('channel'); if (!input) { console.error('--channel 필요'); process.exit(2); }
|
||||
const OUT = resolve(opt('out', join(here, '../src/data/videos.json')));
|
||||
const MAX = Number(opt('max', '2000'));
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
// 정보형이 아닌 제목 (게이트 BANNED_VIDEO_TITLE 과 같은 계열 + 확장). 후기·경험담·토크·이벤트는 사이트 원칙(§3-8)상 싣지 않는다.
|
||||
const NOT_INFO = /전후|리뷰|후기|성공|번호따|변신|역대급|토크|브이로그|vlog|먹방|챌린지|이벤트|할인|특가|메이크오버|make\s?over|비포|애프터|before|after|실화|대박|충격|ㅋㅋ|😱|🔥|브랜드\s?필름|CF|광고|메이킹|연예인|인플루언서|아이돌|모음|트렌드|테스트|망한|반전|응원|캠페인|썰|레전드|처럼|의혹|결심한 이유|효과는 대단|리얼|스토리|공개|달라진|생기는 일|댓글|만뷰|변화|개월 후|년 후|💎|💞|👑/i;
|
||||
const MIN_LONG_SEC = 90; // 설명형 롱폼은 90초 이상 (짧은 홍보 영상 제외)
|
||||
|
||||
const api = async (path, params) => {
|
||||
const u = new URL(`https://www.googleapis.com/youtube/v3/${path}`); for (const [k, v] of Object.entries({ ...params, key: KEY })) u.searchParams.set(k, v);
|
||||
const r = await fetch(u); const j = await r.json(); if (!r.ok) throw new Error(`${path} ${r.status} ${JSON.stringify(j).slice(0, 200)}`); return j;
|
||||
};
|
||||
|
||||
// 채널 해석: UC id / @handle / URL
|
||||
async function resolveChannel(s) {
|
||||
let id = null, handle = null;
|
||||
const m = s.match(/(UC[\w-]{20,})/); if (m) id = m[1];
|
||||
const h = s.match(/@([\w.-]+)/); if (h) handle = h[1];
|
||||
const params = id ? { id } : handle ? { forHandle: handle } : null;
|
||||
if (!params) throw new Error(`채널 식별 불가: ${s}`);
|
||||
const j = await api('channels', { part: 'snippet,statistics,contentDetails', ...params });
|
||||
const c = j.items?.[0]; if (!c) throw new Error(`채널 없음: ${s}`);
|
||||
return c;
|
||||
}
|
||||
const c = await resolveChannel(input);
|
||||
const uploads = c.contentDetails.relatedPlaylists.uploads;
|
||||
console.log(`채널 ${c.snippet.title} (${c.snippet.customUrl}) · 영상 ${c.statistics.videoCount} · 조회수 ${c.statistics.viewCount}`);
|
||||
|
||||
// uploads 전량
|
||||
const ids = []; let pageToken;
|
||||
do {
|
||||
const j = await api('playlistItems', { part: 'contentDetails', playlistId: uploads, maxResults: 50, ...(pageToken ? { pageToken } : {}) });
|
||||
for (const it of j.items ?? []) ids.push(it.contentDetails.videoId);
|
||||
pageToken = j.nextPageToken;
|
||||
process.stdout.write(`\r 목록 ${ids.length}`);
|
||||
} while (pageToken && ids.length < MAX);
|
||||
console.log();
|
||||
|
||||
// videos.list 50개 배치
|
||||
const iso = (d) => { const m = d.match(/PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?/); return m ? (Number(m[1] ?? 0) * 3600 + Number(m[2] ?? 0) * 60 + Number(m[3] ?? 0)) : 0; };
|
||||
const all = [];
|
||||
for (let i = 0; i < ids.length; i += 50) {
|
||||
const j = await api('videos', { part: 'snippet,statistics,contentDetails,status', id: ids.slice(i, i + 50).join(',') });
|
||||
for (const v of j.items ?? []) {
|
||||
if (v.status?.privacyStatus !== 'public') continue;
|
||||
all.push({ id: v.id, title: v.snippet.title, published: v.snippet.publishedAt.slice(0, 10), views: Number(v.statistics.viewCount ?? 0), likes: v.statistics.likeCount != null ? Number(v.statistics.likeCount) : null, comments: v.statistics.commentCount != null ? Number(v.statistics.commentCount) : null, duration: iso(v.contentDetails.duration), embeddable: v.status.embeddable, privacy: v.status.privacyStatus, description: (v.snippet.description ?? '').slice(0, 300) });
|
||||
}
|
||||
process.stdout.write(`\r 상세 ${all.length}/${ids.length}`);
|
||||
}
|
||||
console.log();
|
||||
all.sort((a, b) => b.views - a.views);
|
||||
|
||||
// 쇼츠 판별: 상위 후보(길이 3분 이하) 중 조회수 상위 120개만 HEAD 확인 (요청 수 절약). 그 밖은 60초 이하를 쇼츠로 본다.
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
async function isShort(id) {
|
||||
try { const r = await fetch(`https://www.youtube.com/shorts/${id}`, { method: 'HEAD', redirect: 'manual', signal: AbortSignal.timeout(10000) }); return r.status === 200; } catch { return null; }
|
||||
}
|
||||
const cand = all.filter((v) => v.duration <= 180).slice(0, 120);
|
||||
let checked = 0;
|
||||
for (const v of cand) { const s = await isShort(v.id); v.isShort = s === null ? v.duration <= 60 : s; checked++; await sleep(120); process.stdout.write(`\r 쇼츠 판별 ${checked}/${cand.length}`); }
|
||||
for (const v of all) if (v.isShort === undefined) v.isShort = v.duration <= 60;
|
||||
for (const v of all) if (/#\s?shorts/i.test(v.title)) v.isShort = true; // 제목에 #shorts 가 있으면 쇼츠로 본다
|
||||
console.log();
|
||||
|
||||
// 정보형 + 발행 게이트 통과(영상 제목 금칙·본문 금칙 표현) 둘 다 만족해야 사이트에 싣는다. all[].info 로도 남겨 다른 스크립트(default_briefs)가 같은 판정을 쓴다.
|
||||
const info = (v) => !NOT_INFO.test(v.title) && !R.BANNED_VIDEO_TITLE.test(v.title) && R.checkBannedBody(v.title).length === 0;
|
||||
for (const v of all) v.info = info(v);
|
||||
const strip = ({ description, ...v }) => v;
|
||||
const out = {
|
||||
fetchedAt: today,
|
||||
channel: { id: c.id, handle: c.snippet.customUrl, url: `https://www.youtube.com/${c.snippet.customUrl ?? 'channel/' + c.id}`, title: c.snippet.title, subscribers: fmtKo(Number(c.statistics.subscriberCount)), videos: Number(c.statistics.videoCount), totalViews: Number(c.statistics.viewCount) },
|
||||
top: all.slice(0, 10),
|
||||
topLong: all.filter((v) => !v.isShort && v.duration >= MIN_LONG_SEC && info(v) && v.embeddable !== false).slice(0, 10).map(strip),
|
||||
topShorts: all.filter((v) => v.isShort && info(v)).slice(0, 10).map(strip),
|
||||
shortsInfo: all.filter((v) => v.isShort && info(v)).slice(0, 10).map((v) => ({ ...strip(v), answer: '' })),
|
||||
all: all.map(strip),
|
||||
shortsDetection: `youtube.com/shorts/{id} HEAD 200 (상위 ${cand.length}편 확인, 나머지는 60초 이하), ${today}`,
|
||||
note: 'topLong·topShorts 는 정보형(후기·전후·토크·이벤트 제목 제외). shortsInfo.answer 는 사람이 영상을 보고 채운다(자동 생성하지 않음).',
|
||||
};
|
||||
writeFileSync(OUT, JSON.stringify(out, null, 1));
|
||||
console.log(`저장 ${OUT} · 전체 ${all.length} · 롱폼 정보형 ${out.topLong.length} · 쇼츠 정보형 ${out.topShorts.length}`);
|
||||
function fmtKo(n) { return n >= 10000 ? `${(n / 10000).toFixed(1).replace(/\.0$/, '')}만` : n.toLocaleString('ko-KR'); }
|
||||
@@ -89,7 +89,7 @@ for (const a of topAreas) add({
|
||||
id: `procedure-${a.area.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`, category: 'D', categoryLabel: '시술 정보', qbIds: ['D-01', 'D-06'],
|
||||
title: `${name} ${areaLabel(a)}${eun(areaLabel(a))} 어떤 방법이 있고 시술 시간·마취·회복은 어떻게 되나요?`,
|
||||
intent: `${areaLabel(a)} 시술 페이지들이 공개한 방법·대상·수술 시간·마취·입원·실밥·일상 복귀를 방법별 조건 표로. 페이지에 없는 칸은 "확인". 효과 서술은 옮기지 않고 절차·조건만.`,
|
||||
pages: a.list.slice(0, 4).map((p) => p.url), reviewer: rep,
|
||||
pages: a.list.slice(0, 4).map((p) => p.url), reviewer: rep, area: a,
|
||||
});
|
||||
if (!candidates.some((c) => c.id === 'consult-questions') && topAreas.length >= 2) add({
|
||||
id: 'consult-questions', category: 'C', categoryLabel: '선택 기준', qbIds: ['C-02', 'E-08'],
|
||||
@@ -98,10 +98,28 @@ if (!candidates.some((c) => c.id === 'consult-questions') && topAreas.length >=
|
||||
pages: [...new Set(topAreas.flatMap((a) => a.list.slice(0, 2).map((p) => p.url)))].slice(0, 5), reviewer: rep,
|
||||
});
|
||||
|
||||
const posts = candidates.filter((c) => c.pages.length).slice(0, max).map(({ pages: pg, reviewer, ...c }) => ({
|
||||
// 글 ↔ 원장 영상 매칭: 사이트 데이터 videos.json(collect_youtube.mjs 산출)의 정보형 롱폼 중 제목이 글 주제 키워드와 겹치는 것 최대 3편.
|
||||
// 영상은 "이어서 볼 영상"과 카드 썸네일로만 쓴다. 자막이 없으므로 발언은 인용하지 않는다(§4-2).
|
||||
const videosPath = join(SITE, 'src/data/videos.json');
|
||||
const vdata = existsSync(videosPath) ? JSON.parse(readFileSync(videosPath, 'utf8')) : null;
|
||||
// 후보 = 정보형(info) 롱폼(쇼츠 아님, 90초 이상, 제목에 #shorts 없음)만. collect_youtube 가 붙인 info 판정을 그대로 쓴다.
|
||||
const longs = (vdata?.topLong ?? []).concat((vdata?.all ?? []).filter((v) => !v.isShort && v.duration >= 90 && v.info !== false && !/#\s?shorts/i.test(v.title))).filter((v, i, a) => a.findIndex((x) => x.id === v.id) === i);
|
||||
// 병원 소개·방문 안내는 영상을 붙이지 않는다(주제와 맞는 영상이 없고 아무 영상이나 붙으면 오해를 준다)
|
||||
const KW = {
|
||||
'what-is-clinic': [], 'visit-guide': [], 'safety-system': ['안전', '마취', '응급', 'CCTV', '검진'],
|
||||
'precautions-guide': ['주의사항', '수술 후', '관리', '실밥', '부기', '붓기'], 'aftercare-program': ['관리', '애프터', '회복', '수술 후'], 'consult-questions': ['상담', '질문', '고를 때', '기준', '체크'],
|
||||
};
|
||||
const areaKw = (a) => { const t = areaLabel(a); return [t, ...t.split(/[·,/\s]+/).filter((w) => w.length >= 2), a.area]; };
|
||||
function matchVideos(c) {
|
||||
if (!longs.length) return [];
|
||||
const kws = (KW[c.id] ?? []).concat(c.area ? areaKw(c.area) : []).filter(Boolean);
|
||||
if (!kws.length) return [];
|
||||
return longs.filter((v) => kws.some((k) => v.title.includes(k))).slice(0, 3).map((v) => ({ id: v.id, title: v.title, published: v.published }));
|
||||
}
|
||||
const posts = candidates.filter((c) => c.pages.length).slice(0, max).map(({ pages: pg, reviewer, area, ...c }) => ({
|
||||
...c, avoid: AVOID, reviewerCandidate: reviewer ?? undefined,
|
||||
evidence: { pages: [...new Set(pg)], shorts: [], news: [], regulation: [], platform: false },
|
||||
videos: [], gallery: [],
|
||||
videos: matchVideos({ ...c, area }), gallery: [],
|
||||
}));
|
||||
|
||||
const out = { clinic, generatedAt: new Date().toISOString().slice(0, 10), note: '근거 수집 결과에서 자동 제안한 첫 배치. 사람이 확인·수정한 뒤 생성기에 넣는다(v2 §3-11).', evidenceTypes: index.byType, posts };
|
||||
|
||||
@@ -4,11 +4,13 @@ interface Props { post: any }
|
||||
const { post } = Astro.props;
|
||||
const d = post.data;
|
||||
const v0 = d.videos?.[0] ?? d.video;
|
||||
const thumb = d.thumbnail ?? d.hero?.src ?? (v0 ? `https://i.ytimg.com/vi/${v0.id}/hqdefault.jpg` : S.buildingImage?.src ?? '/favicon.svg');
|
||||
const thumbAlt = d.hero?.alt ?? (v0 ? `유튜브 영상 썸네일: ${v0.title}` : S.buildingImage?.alt ?? `${fact.shortName} 건물 외관`);
|
||||
// 썸네일 우선순위: 지정 썸네일 → 히어로 → 첫 영상 → 건물 사진 → 병원 로고. 전부 없으면 이미지 없이 낸다(프레임워크 기본 파비콘을 쓰지 않는다).
|
||||
const thumb = d.thumbnail ?? d.hero?.src ?? (v0 ? `https://i.ytimg.com/vi/${v0.id}/hqdefault.jpg` : S.buildingImage?.src ?? S.logo?.src ?? null);
|
||||
const thumbAlt = d.hero?.alt ?? (v0 ? `유튜브 영상 썸네일: ${v0.title}` : S.buildingImage?.alt ?? S.logo?.alt ?? `${fact.shortName} 로고`);
|
||||
const isLogo = !d.thumbnail && !d.hero?.src && !v0 && !S.buildingImage?.src && Boolean(S.logo?.src);
|
||||
---
|
||||
<article class="card has-thumb">
|
||||
<a class="thumb" href={`/posts/${post.id}`}><img src={thumb} alt={thumbAlt} loading="lazy" /></a>
|
||||
<article class={`card ${thumb ? 'has-thumb' : ''}`}>
|
||||
{thumb && <a class={`thumb ${isLogo ? 'thumb-logo' : ''}`} href={`/posts/${post.id}`}><img src={thumb} alt={thumbAlt} loading="lazy" /></a>}
|
||||
<div class="body">
|
||||
<div class="cat">{d.category} · {CATEGORY_LABELS[d.category]}</div>
|
||||
<h3><a href={`/posts/${post.id}`}>{d.title}</a></h3>
|
||||
|
||||
@@ -239,6 +239,8 @@ td { color: var(--slate-700); }
|
||||
.figure.portrait img { aspect-ratio: auto; }
|
||||
.card.has-thumb { padding: 0; overflow: hidden; }
|
||||
.card.has-thumb .thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
|
||||
.card.has-thumb .thumb.thumb-logo { display: block; background: #F7F8FC; aspect-ratio: 16 / 9; }
|
||||
.card.has-thumb .thumb.thumb-logo img { object-fit: contain; padding: 18% 22%; box-sizing: border-box; }
|
||||
.card.has-thumb .body { padding: 1.2rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
|
||||
.card.has-thumb .body p { flex: 1; }
|
||||
.doctor-strip { display: flex; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--slate-100); border-radius: 16px; padding: 1rem 1.2rem; margin: 1.4rem 0; box-shadow: var(--shadow); }
|
||||
|
||||
Reference in new issue
Block a user