feat(supporters): haewon 결정 반영 — 채널 인기 전체 탭 제거, 단가 상한 $10 기본, 큐 폴러(poll.mjs)+launchd, /supporters/:id 페이지, URL 신청→빌드 큐, 수집기 UA·슬래시 수정, 기획 목록 일반화(원진 6편)
WIP: 원진성형외과 회귀는 글 생성 단계에서 네트워크 끊김(fetch failed)으로 중단. 다음 세션에 --from generate 로 재실행. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
190ffdf7ab
commit
ee8c06f53b
18 files changed
+380
-125
No files matched your search
@@ -21,7 +21,7 @@ const CLINIC = arg('--clinic'); const START = arg('--url');
|
||||
if (!CLINIC || !START) { console.error('사용법: --clinic <id> --url <https://...>'); process.exit(2); }
|
||||
const OUT = join(arg('--out', fileURLToPath(new URL('../../evidence/', import.meta.url))), CLINIC);
|
||||
const MAX = Number(arg('--max', 250)); const DELAY = Number(arg('--delay', 400));
|
||||
const UA = 'Mozilla/5.0 (compatible; INFINITH-evidence/0.1; +https://infinith-demo.vercel.app)';
|
||||
const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36 INFINITH-supporters-evidence/1.0 (+mailto:o2oteam@o2o.kr)'; // 일부 병원(원진)은 비브라우저 UA 를 403 으로 막는다. 브라우저 UA + 식별 문자열
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
// ---------- 페이지 유형 ----------
|
||||
@@ -82,8 +82,10 @@ function normalize(href, base) {
|
||||
const u = new URL(href, base);
|
||||
if (!/^https?:$/.test(u.protocol)) return null;
|
||||
u.hash = ''; u.search = '';
|
||||
// 슬래시를 강제로 붙이지 않는다. 뷰성형외과(WordPress)는 /x → /x/ 로 301 하지만, 원진(k-wonjin.co.kr)은 /x/ 가 404 다.
|
||||
// 키는 슬래시 없는 형태로 통일하고(루트 제외), 404 면 collect() 에서 반대 형태를 한 번 더 시도한다.
|
||||
let s = u.toString();
|
||||
if (!/\.[a-z0-9]{2,5}$/i.test(u.pathname) && !s.endsWith('/')) s += '/';
|
||||
if (u.pathname !== '/' && s.endsWith('/')) s = s.slice(0, -1);
|
||||
return s;
|
||||
} catch { return null; }
|
||||
}
|
||||
@@ -218,7 +220,12 @@ console.log(` 유형 확정 ${typedRest.length} · 의료진 상세 ${doctorDet
|
||||
const pages = [];
|
||||
const slugOf = (u) => (new URL(u).pathname.replace(/^\/|\/$/g, '').replace(/[^a-zA-Z0-9가-힣]+/g, '-') || 'home');
|
||||
async function collect(t) {
|
||||
const r = await fetchText(t.url);
|
||||
let r = await fetchText(t.url);
|
||||
if (r.status === 404) { // 슬래시 유무 반대 형태 재시도
|
||||
const alt = t.url.endsWith('/') ? t.url.slice(0, -1) : t.url + '/';
|
||||
const r2 = await fetchText(alt);
|
||||
if (r2.status === 200) r = r2;
|
||||
}
|
||||
if (r.status !== 200 || !/html/.test(r.contentType)) { pages.push({ url: t.url, slug: slugOf(t.url), type: t.type, status: r.status, error: r.error ?? 'non-html', items: [], images: [], links: [], flags: {} }); return; }
|
||||
const ex = extract(r.body, r.finalUrl);
|
||||
const h1 = ex.items.find((i) => i.kind === 'h' && i.level === 1)?.text ?? null;
|
||||
|
||||
Reference in new issue
Block a user