{e(m.get("category") or "")}
{kicker}
{heading}
{lead}
{action_html}import html import json import shutil from pathlib import Path HERE = Path(__file__).parent TPL = HERE / "tpl-story" OUT = HERE / "build3" PAYLOAD = json.loads((HERE / "stay3-payload.json").read_text()) ORIGIN = "https://web4ai.o2osolution.ai" BASE = "/s/stay3" place = PAYLOAD["place"] narrative = PAYLOAD["narrative"] units = PAYLOAD["units"] media = PAYLOAD["media"] facts = {f["key"]: f for f in PAYLOAD["facts"]} faqs = PAYLOAD["faqs"] links = PAYLOAD["links"] local = PAYLOAD["local"] sections = {s["id"]: (json.loads(s["data"]) if isinstance(s.get("data"), str) else None) for s in PAYLOAD["theme"]["sections"]} NAME = place["name"] PHONE = place["phone"] BOOK_URL = next((l["url"] for l in links if l.get("channel") == 7), "#") INSTA_URL = next((l["url"] for l in links if l.get("channel") == 4), None) ABOUT = narrative["about"] PRICE_FROM = "198,000" def e(text): return html.escape(str(text or ""), quote=True) def unit_fact(unit, key): for f in unit["facts"]: if f["key"] == key: return f return None def unit_value(unit, key, default=""): f = unit_fact(unit, key) if not f: return default unit_text = f.get("unit") or "" joiner = "" if unit_text in ("명", "원") else " " return f["value"] + (joiner + unit_text if unit_text else "") def unit_title(unit): return unit["name"].split("(")[0].strip() def unit_subtitle(unit): raw = unit["name"] return raw[raw.find("(") + 1:raw.rfind(")")].strip() if "(" in raw else "" def pics(category=None, limit=None, skip=0): rows = [m for m in media if category is None or m.get("category") == category] rows = rows[skip:] return rows[:limit] if limit else rows def naver(query): from urllib.parse import quote return f"https://search.naver.com/search.naver?query={quote(query)}" HEAD = """
{p}
" for p in paragraphs) klass = "spotlight style1 orient-%s content-align-left image-position-center onscroll-image-fade-in" % orient if invert: klass += " invert" return f"""{e(m.get("category") or "")}
{v}
{e(unit_subtitle(u))}
주중 1박 {e(f"{int(unit_value(u, 'weekday_price').replace('원', '').strip()):,}")}원
이 동 자세히 보기담을 나서면 근대 도심입니다. 걸어서 닿는 곳과 계절마다 열리는 축제, 하루를 통째로 짜 둔 일정 {len(sections['itinerary']['items'])}가지를 따로 모아 두었습니다.
{e(f['answer'])}
{e(unit_subtitle(u))}
{e(unit_value(u, 'room_intro'))}
{e(f['answer'])}
{e(facts['cancel_policy']['value'])}
도보 시간은 직선거리를 분속 80m로 환산한 값입니다.
한국관광공사 TourAPI 기준. 일정은 주최 측 사정으로 바뀔 수 있습니다.
{e(i['why'])}
" + "".join( f"머뭄에서 나서고 머뭄으로 돌아옵니다 — {len(itin)}가지
{e(r['body'])}
" f"{e(r['source']['name'])}