# -*- coding: utf-8 -*-

import requests
import json

article_no = "2624635265"

url = f"https://new.land.naver.com/api/articles/{article_no}"

headers = {
    "User-Agent": "Mozilla/5.0",
    "Referer": f"https://new.land.naver.com/offices?articleNo={article_no}",
}

response = requests.get(url, headers=headers)

print("status:", response.status_code)
print(response.text[:3000])

if response.status_code == 200:
    try:
        data = response.json()

        with open("article_api.json", "w", encoding="utf-8") as f:
            json.dump(data, f, ensure_ascii=False, indent=2)

        print("JSON 저장 완료")

    except Exception as e:
        print("JSON 파싱 실패:", e)