ทำตาม 4 ขั้นตอนนี้ เพื่อให้วีดีโอจาก VaultCMS ขึ้นบนเว็บของคุณได้เลย
vk_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4https://yoursite.com แล้วรอ Admin อนุมัติ domain ก่อน API จะทำงานได้ส่ง API Key ไปกับทุก request ผ่าน HTTP Header
X-API-Key: your_api_key_hereBase URL: https://66url.org
| Method | Endpoint | หน้าที่ |
|---|---|---|
| GET | /api/videos | ดึงรายการวีดีโอทั้งหมด |
| GET | /api/videos?category=หนังไทย | กรองตามหมวดหมู่ |
| GET | /api/videos?q=ชื่อเรื่อง | ค้นหาวีดีโอ |
| GET | /api/videos?limit=12&offset=0 | Pagination |
| GET | /api/v1/me | ข้อมูล account ของคุณ |
| Parameter | Type | คำอธิบาย |
|---|---|---|
| category optional | string | กรองตามหมวดหมู่ เช่น หนังไทย, อนิเมะ |
| q optional | string | ค้นหาจากชื่อเรื่อง, นักแสดง, ผู้กำกับ |
| year optional | string | กรองตามปีที่ออก เช่น 2024 |
| tag optional | string | กรองตาม tag เช่น ตลก, โรแมนติก |
| sort optional | string | date (ใหม่สุด), rating (คะแนน), az (A-Z) |
| limit optional | int | จำนวนผลลัพธ์ (default: 50) |
| offset optional | int | เริ่มต้นที่รายการที่เท่าไหร่ (Pagination) |
ทุก response เป็น JSON เสมอ
{
"ok": true,
"total": 48,
"videos": [
{
"token": "7fccbc46...",
"title": "สายลับรักเธอ",
"category": "หนังไทย",
"tags": ["โรแมนติก", "ตลก"],
"cast": ["นักแสดง A", "นักแสดง B"],
"director": "ผู้กำกับ",
"year": "2024",
"synopsis": "เรื่องย่อ...",
"rating": 8.5,
"rating_count": 42,
"thumb_url": "https://66url.org/uploads/vdo/.../name_thumb.jpg",
"player_url": "https://66url.org/v/TOKEN",
"hls_url": "https://66url.org/str?t=TOKEN&hls=1",
"hls_ready": true,
"episodes": [{ "title": "EP.1", "url": "..." }]
}
]
}2 วิธีหลักสำหรับ WordPress — แนะนำ Shortcode เพราะง่ายที่สุดครับ
เพิ่มโค้ดนี้ใน functions.php ของ Theme:
// วาง code นี้ใน wp-content/themes/your-theme/functions.php add_shortcode('66url', function($atts) { $atts = shortcode_atts([ 'category' => '', 'limit' => 12, 'sort' => 'date', 'columns' => 4, ], $atts); // ใส่ API Key และ domain ของคุณ $api_key = 'YOUR_API_KEY_HERE'; $base_url = 'https://66url.org'; $url = $base_url . '/api/videos?limit=' . $atts['limit']; if ($atts['category']) $url .= '&category=' . urlencode($atts['category']); if ($atts['sort']) $url .= '&sort=' . urlencode($atts['sort']); $res = wp_remote_get($url, [ 'headers' => ['X-API-Key' => $api_key], 'timeout' => 10, ]); if (is_wp_error($res)) return '<p>ไม่สามารถโหลดวีดีโอได้</p>'; $data = json_decode(wp_remote_retrieve_body($res), true); $videos = $data['videos'] ?? []; if (empty($videos)) return '<p>ไม่พบวีดีโอ</p>'; $cols = max(1, min(6, (int)$atts['columns'])); $w = round(100 / $cols, 2); $out = '<div style="display:flex;flex-wrap:wrap;gap:16px;margin:16px 0">'; foreach ($videos as $v) { $thumb = !empty($v['thumb_url']) ? $v['thumb_url'] : ''; $out .= '<a href="' . esc_url($v['player_url']) . '" target="_blank" style="width:calc(' . $w . '% - 16px);border-radius:10px;overflow:hidden; background:#111;display:block;text-decoration:none;color:#fff">'; if ($thumb) { $out .= '<img src="' . esc_url($thumb) . '" style="width:100%;aspect-ratio:16/9;object-fit:cover;display:block">'; } else { $out .= '<div style="aspect-ratio:16/9;background:#222;display:flex; align-items:center;justify-content:center;font-size:32px">🎬</div>'; } $rating = $v['rating'] ? '⭐ ' . number_format($v['rating'], 1) : ''; $out .= '<div style="padding:10px 12px"> <strong style="font-size:14px;display:block;margin-bottom:4px">' . esc_html($v['title']) . '</strong> <span style="font-size:12px;color:#888">' . esc_html($v['category']) . ($rating ? ' · ' . $rating : '') . '</span> </div></a>'; } $out .= '</div>'; return $out; });
จากนั้นใส่ Shortcode นี้ใน Page หรือ Post ได้เลย:
[66url] ← แสดงทั้งหมด [66url category="หนังไทย" limit="8"] ← กรองหมวดหมู่ [66url sort="rating" columns="3"] ← เรียงตามคะแนน 3 คอลัมน์
สำหรับเว็บที่ใช้ PHP โดยตรง ไม่ใช่ WordPress
<?php $api_key = 'YOUR_API_KEY_HERE'; $url = 'https://66url.org/api/videos?limit=12'; $opts = ['http' => [ 'header' => "X-API-Key: $api_key\r\n", 'timeout' => 10, ]]; $data = json_decode(file_get_contents($url, false, stream_context_create($opts)), true); $videos = $data['videos'] ?? []; ?> <div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px"> <?php foreach($videos as $v): ?> <a href="<?= $v['player_url'] ?>" target="_blank" style="border-radius:10px;overflow:hidden;background:#111;display:block;color:#fff;text-decoration:none"> <?php if($v['thumb_url']): ?> <img src="<?= $v['thumb_url'] ?>" style="width:100%;aspect-ratio:16/9;object-fit:cover"> <?php endif; ?> <div style="padding:10px"> <strong><?= htmlspecialchars($v['title']) ?></strong><br> <span style="color:#888;font-size:12px"><?= $v['category'] ?></span> </div> </a> <?php endforeach; ?> </div>
สำหรับเว็บ Static หรือ React/Vue — ควรใช้ร่วมกับ server proxy เพื่อซ่อน API Key
// ⚠️ ใช้กับ domain ที่ whitelist แล้วเท่านั้น fetch('https://66url.org/api/videos?limit=12', { headers: { 'X-API-Key': 'YOUR_API_KEY' } }) .then(r => r.json()) .then(data => { const videos = data.videos || []; const grid = document.getElementById('video-grid'); videos.forEach(v => { grid.innerHTML += ` <a href="${v.player_url}" target="_blank"> <img src="${v.thumb_url}" /> <p>${v.title}</p> </a> `; }); });
วาง iframe เพื่อแสดง player ในเว็บได้เลย ไม่ต้องใช้ API Key
<iframe src="https://66url.org/v/TOKEN" width="100%" height="500" frameborder="0" allowfullscreen allow="autoplay; fullscreen" ></iframe>
https://66url.org/v/7fccbc46... — copy ส่วนหลัง /v/ ไปได้เลยURL ตัวอย่างสำหรับกรองและค้นหา
# ดึงหนังทั้งหมด https://66url.org/api/videos # กรองหมวดหมู่ "หนังไทย" https://66url.org/api/videos?category=หนังไทย # ค้นหาชื่อ/นักแสดง/ผู้กำกับ https://66url.org/api/videos?q=ชื่อเรื่อง # กรองปี 2024 https://66url.org/api/videos?year=2024 # เรียงตามคะแนนสูงสุด https://66url.org/api/videos?sort=rating # Pagination — หน้าที่ 2 (12 ต่อหน้า) https://66url.org/api/videos?limit=12&offset=12 # รวม filter https://66url.org/api/videos?category=อนิเมะ&year=2024&sort=rating&limit=6