WebExtrator 웹 페이지 렌더링 API 통합 가이드

POST https://api.yxai-tech.top/webextrator/render

WebExtrator 웹 페이지 렌더링 API에 URL을 제공하면, 완전히 렌더링된 HTML(JS로 주입된 콘텐츠 포함), 일반 텍스트, 페이지 제목 및 최종 URL을 반환합니다.

구조화된 추출 결과(기사 본문, 상품 가격, 레시피 재료 등)가 필요한 경우 /webextrator/extract를 사용하세요.

신청 절차

WebExtrator 서비스 페이지를 사용하려면 먼저 AI 聚合 콘솔에서 API Token을 발급받아 준비해 두세요.

아직 로그인하거나 가입하지 않았다면 자동으로 로그인 페이지로 이동하여 가입 및 로그인을 안내하며, 완료 후 현재 페이지로 자동 복귀합니다.

일반 애플리케이션의 API Key는 계정에 활성화된 서비스에 사용할 수 있으며, 전용 애플리케이션의 Key는 해당 애플리케이션의 서비스 범위에 따라 사용합니다. Key의 권한, 유효 기간 및 한도를 확인하고, 애플리케이션 잔액이 이번 요청 비용을 지불하기에 충분한지 확인하세요. 사용 가능한 체험 한도는 계정에 표시된 내용을 기준으로 하며, 잔액이 부족하면 「충전」 버튼을 클릭하면 됩니다.

📘 전체 문서: WebExtrator 서비스 페이지 →

인증

모든 WebExtrator 인터페이스는 표준 Bearer Token 인증을 사용합니다.

Authorization: Bearer YOUR_API_KEY
Content-Type:  application/json

요청 매개변수

필드 유형 필수 기본값 설명
url string ✅ — 렌더링할 페이지 URL로, http(s)://여야 합니다.
user_agent string ❌ 자동 선택 사용자 지정 User-Agent.
timeout integer ❌ 30 단일 탐색 시간 초과(양의 정수 초).
wait_until enum ❌ load 로드 완료 이벤트: load / domcontentloaded / networkidle / commit.
delay integer ❌ 0 wait_until이 발생한 후의 추가 대기 시간(초)(음이 아닌 정수)(SPA의 2차 렌더링에 사용).
wait_for_selector string ❌ — 해당 CSS 선택자가 나타날 때까지 기다리며, networkidle보다 안정적입니다.
block_resources string[] ❌ ["image","font","media"] 차단할 리소스 유형, 선택 가능: image / font / media / stylesheet / xhr / fetch.
headers object ❌ — 추가 HTTP 요청 헤더(예: {"Accept-Language": "en-US"}).
cookies array ❌ — 탐색 전에 주입할 Cookie이며, 구조는 아래를 참조하세요.
callback_url string ❌ — 비동기 모드의 콜백 주소로, 플랫폼이 작업 완료 시 전체 결과를 이 주소로 POST합니다.
bypass_cache boolean ❌ false 캐시 읽기를 건너뜁니다(단, 이번 결과는 여전히 캐시에 기록합니다).
cache_ttl_seconds integer ❌ 3600 이번에 기록할 캐시 TTL을 사용자 지정하며, 0을 전달하면 이번 응답을 캐시하지 않습니다.
async boolean ❌ false true로 설정하면 task_id를 즉시 반환하며, 결과는 callback_url 또는 Tasks API를 통해 가져옵니다.

요청 매개변수는 모두 snake_case를 사용합니다.

{
  "name":      "string",
  "value":     "string",
  "domain":    "string",
  "path":      "/",
  "expires":   1735689600,
  "httpOnly":  false,
  "secure":    true,
  "sameSite":  "Lax"
}

동기 응답

{
  "success": true,
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "trace_id": "550e8400-e29b-41d4-a716-446655440001",
  "started_at": 1777717800.123,
  "finished_at": 1777717801.234,
  "elapsed": 1.111,
  "data": {
    "kind": "render",
    "url": "https://example.com",
    "finalUrl": "https://example.com/",
    "title": "Example Domain",
    "status": 200,
    "html": "<!DOCTYPE html><html>...</html>",
    "text": "Example Domain\nThis domain is for use in illustrative examples...",
    "userAgent": "Mozilla/5.0 ...",
    "elapsedMs": 1108
  }
}
필드 유형 설명
data.kind string 고정값 "render".
data.url string 제출한 URL.
data.finalUrl string 리디렉션을 따른 후의 최종 URL.
data.title string 렌더링된 document.title.
data.status number | null 주 탐색의 HTTP 상태 코드.
data.html string 완전히 렌더링된 HTML.
data.text string document.body.innerText 스냅샷(더 깔끔한 본문이 필요하면 Extract를 사용하세요).
data.userAgent string 실제 사용된 UA.
data.elapsedMs number 브라우저 렌더링에만 걸린 시간.
data.cached boolean? 캐시가 적중한 경우 true.
data.cacheStoredAt number? 캐시 항목이 처음 기록된 Unix 밀리초 타임스탬프.

비동기 응답

async=true인 경우(또는 callback_url을 제공한 경우) 즉시 반환합니다(HTTP 200).

{
  "success": true,
  "task_id": "550e8400-...",
  "trace_id": "6ba7b810-...",
  "started_at": 1777717800.123
}

결과는 POST를 통해 callback_url로 푸시되거나(설정된 경우), /webextrator/tasks를 통해 직접 조회할 수 있습니다.

콜백 구조

플랫폼은 동기 모드와 완전히 동일한 엔벨로프를 callback_url로 POST하며, Content-Type: application/json입니다. 임의의 2xx를 반환하면 확인된 것으로 간주하며, 5xx는 지수 백오프로 약 5분 동안 재시도합니다.

오류 응답

HTTP error.code 의미
400 bad_request 요청 매개변수가 유효하지 않습니다(예: url이 누락되었거나 타입이 올바르지 않음).
401 unauthorized Authorization: Bearer …가 누락되었거나 유효하지 않습니다.
402 (x402) 플랫폼 잔액이 부족하여 x402 결제 요구 envelope를 반환합니다.
408 timeout 탐색이 timeout을 초과했습니다.
429 queue_busy 동기 큐가 혼잡하므로 다시 시도하거나 async=true를 사용하세요.
500 internal_error 서비스에 오류가 발생했으므로 나중에 다시 시도하세요.

오류 구조:

{
  "success": false,
  "task_id": "...",
  "trace_id": "...",
  "started_at": 1777717800.123,
  "finished_at": 1777717800.135,
  "elapsed": 0.012,
  "error": { "code": "bad_request", "message": "url: Invalid url" }
}

예시

cURL

curl -X POST https://api.yxai-tech.top/webextrator/render \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "wait_until": "networkidle",
    "block_resources": ["image", "media", "font"]
  }'

Python (requests)

import os, requests

API_KEY = os.environ["ACEDATA_API_KEY"]

resp = requests.post(
    "https://api.yxai-tech.top/webextrator/render",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json",
    },
    json={
        "url": "https://example.com",
        "wait_until": "networkidle",
        "block_resources": ["image", "media", "font"],
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
print(data["title"], data["status"], len(data["html"]))

Node.js (fetch)

const apiKey = process.env.ACEDATA_API_KEY;

const res = await fetch('https://api.yxai-tech.top/webextrator/render', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com',
    wait_until: 'networkidle',
    block_resources: ['image', 'media', 'font'],
  }),
});
const { data } = await res.json();
console.log(data.title, data.status, data.html.length);

비동기 + 콜백

curl -X POST https://api.yxai-tech.top/webextrator/render \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "async": true,
    "callback_url": "https://your-app.example.com/hooks/webextrator"
  }'

즉시 { "success": true, "task_id": "...", "trace_id": "...", "started_at": 1777717800.123 }를 반환합니다. 작업이 완료되면 플랫폼이 전체 결과를 사용자의 callback_url로 POST합니다.

캐시 강제 우회

curl -X POST https://api.yxai-tech.top/webextrator/render \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "bypass_cache": true
  }'

팁과 주의사항

  • wait_until을 올바르게 선택하는 것이 중요합니다. networkidle이 가장 안정적이지만 가장 느립니다. domcontentloaded는 빠르지만 비동기로 주입된 콘텐츠가 누락될 수 있습니다. load는 전통적인 정적 페이지에 적합합니다.
  • 캐시 키는 async를 무시합니다. 동일한 URL의 동기 및 비동기 요청은 동일한 캐시 항목에 적중하며, 자유롭게 전환해도 캐시가 무효화되지 않습니다.
  • 캐시 키는 bypass_cache와 cache_ttl_seconds를 무시합니다. 이 둘은 동작 스위치이므로 응답 내용에 영향을 주지 않습니다.
  • cookies와 headers에 따라 캐시가 분리됩니다. 이 둘을 사용자 지정하면 동일한 조합의 첫 요청은 캐시에 적중하지 않습니다.
  • 무거운 SPA는 기본값인 30초를 자주 초과합니다. timeout: 60, wait_until: "domcontentloaded", delay: 4를 사용하고, wait_for_selector를 함께 사용하여 실제로 필요한 요소를 기다리는 것이 좋습니다.
  • block_resources는 지연 시간을 줄이는 가장 빠른 방법입니다. 기본적으로 이미지 / 글꼴 / 미디어가 차단되어 있습니다. 추출 작업이 CSS 레이아웃에 의존하지 않는다면 stylesheet를 추가하여 더 빠르게 처리할 수 있습니다.