Enterprise Developer Manual

คู่มือการเชื่อมต่อระบบ LnwthaiLive / ThaiGoLive API

ระบบโครงสร้างข้อมูลกีฬา, สตรีมมิ่งความเร็วสูง, AskMeBet Embed Player และ Multi-Sports 17+ ชนิดกีฬา

Version: 1.5.0 Production
Base URL: https://lnwthailive.online
API Key ตัวอย่าง: tgl-enterprise-8655529a5afc52d0

1. ขั้นตอนเริ่มต้นใช้งานด่วน (Quick Start)

ระบบให้บริการข้อมูลกีฬาในรูปแบบ RESTful JSON และสตรีมมิ่งความคมชัดสูง HLS / iFrame โดยเริ่มต้นได้ใน 3 ขั้นตอน:

1

นำ API Key ไปใช้งาน

นำคีย์ Enterprise เช่น tgl-enterprise-8655529a5afc52d0 แนบไปกับ Request

2

ส่ง Request เรียกข้อมูล

ยิงคำขอไปยัง Endpoint เช่น /api/askmebet/live หรือ /api/ge-sports

3

แสดงผลหรือฝัง Player

นำค่าสกอร์ไปโชว์ หรือนำ embed_url / iframe_snippet ไปเปิดเล่นวิดีโอ

2. การยืนยันตัวตนและการใส่ API Key (Authentication)

ช่องทาง ตัวอย่างการใช้งาน คำแนะนำ
1. HTTP Header
แนะนำสูงสุด
x-api-key: tgl-enterprise-8655529a5afc52d0 ปลอดภัยสูงสุด สำหรับ Server-to-Server และ Backend ดึงข้อมูล
2. Query Parameter ?api_key=tgl-enterprise-8655529a5afc52d0 สะดวก สำหรับทดสอบบน Browser หรือป้อนให้ Video Player

3. ระดับแพ็กเกจและข้อจำกัดการเรียกใช้งาน (Tiers & Rate Limits)

แพ็กเกจ Rate Limit ขอบเขตการเข้าถึงข้อมูล (Permissions) การใช้งานที่เหมาะสม
Starter 60 req / min ผลบอลสด, ตารางคะแนน, ผลย้อนหลัง เว็บไซต์ขนาดเล็ก-บล็อกกีฬา
Pro 180 req / min ฟุตบอลสด, เหตุการณ์สด, มวยไทย, สถิติวิเคราะห์ เว็บไซต์ผลบอลและข่าวสารขนาดกลาง
Enterprise Unlimited (ไม่จำกัด) ครบทุกบริการ 100% + AMB Embed + 17+ กีฬาสากล + วัวชน/ไก่ชน + HLS Dedicated เว็บสายกีฬาขนาดใหญ่ / Mobile Apps
IPTV Only 300 req / min ผังช่องทีวีดิจิตอล + ช่องกีฬาสตรีม HLS ระบบ Smart TV / กล่อง Android

4. ระบบ AskMeBet (AMB) Live Football & Embed Player (หัวข้อพิเศษ)

ระบบ AskMeBet ให้บริการตารางบอลสดระดับโลกพร้อมเครื่องเล่นวิดีโอ iFrame Player สำเร็จรูป ที่ล็อก IP ปลายทางอัตโนมัติ:

✨ จุดเด่นของระบบ AskMeBet Embed Player
  • ไม่ต้องเขียน Player เอง: ได้รับโค้ด <iframe> หรือ embed_url พร้อมปุ่มควบคุมและเสียงพากย์ไทย
  • ระบบตรวจจับและล็อก IP อัตโนมัติ: ป้องกันการขโมยลิงก์ไปแชร์ต่อภายนอก
  • สัญญาณถ่ายทอดสดครอบคลุม: มีครบทั้งลีกใหญ่ ลีกรอง บอลถ้วย และกระชับมิตรทั่วโลก

4.1 ดึงตารางบอลสด AskMeBet (GET /api/askmebet/live)

curl -X GET "https://lnwthailive.online/api/askmebet/live" -H "x-api-key: tgl-enterprise-8655529a5afc52d0"

ตัวอย่าง Response จริง (200 OK - พบ 27 คู่สด / 170 คู่ประจำวัน):

{
  "ok": true,
  "service": "AskMeBet Football Live API v2",
  "client_ip": "49.237.108.102",
  "live_count": 27,
  "today_count": 170,
  "live_now": [
    {
      "match_id": "72151048",
      "league": { "name_en": "Japan J2 League", "name_th": "ญี่ปุ่น เจ ลีก 2", "flag_logo": "https://data.askmescore.live/static/images/tournaments/402" },
      "start_time": "2026-08-16T10:00:00.000Z",
      "status_time": "2H 26",
      "home_team": { "name_en": "Tokushima Vortis", "name_th": "โตกุชิม่า โวร์ติส", "logo": "..." },
      "away_team": { "name_en": "Sagan Tosu", "name_th": "สากัน โตสู", "logo": "..." },
      "score": "1 - 0",
      "red_card": { "home": 0, "away": 0 },
      "yellow_card": { "home": 1, "away": 2 },
      "embed_api_url": "/api/askmebet/embed?matchId=72151048"
    }
  ]
}

4.2 ดึง iFrame Embed Player (GET /api/askmebet/embed)

curl -X GET "https://lnwthailive.online/api/askmebet/embed?matchId=72151048" -H "x-api-key: tgl-enterprise-8655529a5afc52d0"

ตัวอย่าง Response จริง (200 OK):

{
  "ok": true,
  "matchId": "72151048",
  "client_ip": "49.237.108.102",
  "embed_url": "https://www.638662097312.com/livetv/1/amb/amb/20348091/913b8f0c-6a51-456c-acb5-f8ef3e493e9b/.../1786880032?=&fs=1&lang=th",
  "iframe_snippet": "<iframe src=\"https://www.638662097312.com/livetv/...\" width=\"100%\" height=\"100%\" frameborder=\"0\" allowfullscreen></iframe>"
}

4.3 ตัวอย่างการนำ iFrame ไปแปะใน HTML

HTML5 / Web Embed
<div style="width: 100%; max-width: 900px; height: 480px; background: #000; border-radius: 12px; overflow: hidden;">
  <iframe src="https://www.638662097312.com/livetv/1/amb/amb/20348091/.../1786880032?=&fs=1&lang=th" width="100%" height="100%" frameborder="0" allow="autoplay; fullscreen; encrypted-media" allowfullscreen></iframe>
</div>

5. หมวดกีฬาสากลอื่นๆ ครบ 17+ ชนิดกีฬา (Multi-Sports API) ⭐

ระบบรองรับการดึงข้อมูลกีฬาสากลยอดนิยมระดับโลกมากกว่า 17 ชนิดกีฬา พร้อมผลสด สกอร์ นาทีแข่งขัน รายชื่อทีม โลโก้ และลิงก์ดูสด:

รหัสประเภท (type=) ชนิดกีฬา รายการแข่งขันหลักที่ครอบคลุม สถานะสด
Basketball 🏀 บาสเกตบอล NBA, WNBA, EuroLeague, FIBA, CBA 26 แมตช์
Tennis 🎾 เทนนิส Grand Slam, Wimbledon, US Open, ATP 1000, WTA 25 แมตช์
Volleyball 🏐 วอลเลย์บอล VNL, World Championship, U17/U20, ลีกตุรกี/อิตาลี 8 แมตช์
Baseball ⚾ เบสบอล Major League Baseball (MLB), NPB (ญี่ปุ่น), KBO 23 แมตช์
Badminton 🏸 แบดมินตัน BWF World Tour, All England, Thomas & Uber Cup พร้อมใช้งาน
Fighting 🥊 MMA / UFC / มวยสากล UFC Main Card, ONE Championship, Bellator 3 แมตช์
Cycling 🚴 จักรยานทางไกล Tour de France, Giro d'Italia, UCI Pro Series 6 แมตช์
AustralianFootball 🏉 ออสเตรเลียนฟุตบอล AFL Premiership (Australia) 5 แมตช์
Rugby 🏉 รักบี้ NRL, Six Nations, Super Rugby, Rugby Championship 9 แมตช์
Futsal ⚽ ฟุตซอล & ลีกสากล Futsal World Cup, MLS, South American Leagues 156 แมตช์
MotoGP / motor 🏎️ มอเตอร์สปอร์ต / F1 MotoGP, Formula 1, World Superbike พร้อมใช้งาน
Golf ⛳ กอล์ฟ PGA Tour, DP World Tour, LIV Golf, The Masters พร้อมใช้งาน
IceHockey / Cricket 🏒 ฮอกกี้ / คริกเก็ต NHL, KHL, ICC World Cup, IPL, The Ashes พร้อมใช้งาน
Darts / Athletics 🎯 ปาเป้า / กรีฑา / เนตบอล PDC World Darts, Diamond League, Netball Super พร้อมใช้งาน

5.1 ดึงข้อมูลกีฬาสากล (GET /api/ge-sports?type=Basketball)

curl -X GET "https://lnwthailive.online/api/ge-sports?type=Basketball" -H "x-api-key: tgl-enterprise-8655529a5afc52d0"

ตัวอย่าง Response จริงของบาสเกตบอล (200 OK):

{
  "success": true,
  "count": 26,
  "matches": [
    {
      "id": "rb_2207714",
      "time": "07:00",
      "league": "Women's National Basketball Association",
      "teamHome": "ลาสเวกัส เอซ",
      "teamAway": "มินเนโซต้า ลินซ์",
      "homeLogo": "/api/imgproxy?url=...",
      "awayLogo": "/api/imgproxy?url=...",
      "isLive": false,
      "score": "98 - 95",
      "streamUrl": "/api/streams/rb_2207714",
      "channels": [ { "id": "main", "name": "รับชมสด (HD)" } ],
      "matchStatus": "จบเกม",
      "sport": "basketball",
      "day": "today"
    }
  ]
}

6. รายละเอียด API Endpoints กีฬาพื้นบ้านและฟุตบอลสดระบบหลัก

หมวดหมู่ Method & Endpoint คำอธิบาย
⚽ ผลบอลสดระบบหลัก GET /api/public/matches รายการแมตช์วันนี้ (48+ คู่) + สกอร์สด + ลิงก์ดูสด
⚡ เหตุการณ์สดในเกม GET /api/public/matches/live-incidents ดึงประตู ใบเหลือง/แดง เปลี่ยนตัวสด (ระบุ ?ids=...)
📊 ตารางคะแนน GET /api/public/standings ตารางคะแนนพรีเมียร์ลีก ลาลีกา กัลโช่ บุนเดสลีกา
🥊 มวยไทยสด GET /api/public/boxing โปรแกรมมวยไทยเวทีราชดำเนิน ลุมพินี ช่อง 7 สี (29 รายการ)
🥊 มวยพักยก GET /api/public/muay-pakyok อัตราต่อรองสด OneBX พร้อมลิงก์สตรีมทีวี
🐂 วัวชน & ไก่ชน GET /api/public/wuachon ตารางชนวัว/ไก่ชน + สถานะสด + ลิงก์ดูสด (205 รายการ)
📺 ทีวี & IPTV GET /api/iptv/channels รายการช่องทีวีดิจิตอลและกีฬา พร้อม Stream Token
🧠 วิเคราะห์บอล VIP GET /api/analyse/today บทวิเคราะห์บอลระดับ VIP ฟันธง และสถิติ 14 จุด

6.1 ตัวอย่าง Response วัวชน & ไก่ชน (/api/public/wuachon)

{
  "ok": true, "total": 205, "tier": "enterprise",
  "data": [
    {
      "id": 69130, "roundName": "ยกที่ 4 - ไก่ชน สนามชนไก่เรืองชัย", "type": "cock", "typeLabel": "ไก่ชน",
      "redCorner": { "name": "ซุ้ม ส.สมหมาย" }, "blueCorner": { "name": "ซุ้ม เพชรนำชัย" },
      "status": "live", "isLive": true,
      "stream": { "url": "https://lnwthailive.online/api/public/wuachon/stream?code=CH5&stk=api_token", "type": "hls" }
    }
  ]
}

6.2 ตัวอย่าง Response มวยพักยก OneBX (/api/public/muay-pakyok)

{
  "ok": true, "total": 4, "live": 1,
  "data": [
    {
      "id": 69254, "league": "มวยไทย - ศึกท่อน้ำไทยเกียรติเพชร ที.เค.โอ.(ช่อง ททบ.5)", "status": "live",
      "redCorner": { "name": "เพชรดำ เกียรติเพชร" }, "blueCorner": { "name": "ยอดขุนศึก ศิษย์ครูเยี่ยม" },
      "odds": { "redPrice": "10/9", "bluePrice": "10/8" }, "tvChannel": "ช่อง 5 HD",
      "stream": { "url": "https://lnwthailive.online/api/iptv/stream/10000129?stk=api_token", "type": "hls" }
    }
  ]
}

7. ตัวอย่างโค้ดเชื่อมต่อระบบจริง (Production Code)

JavaScript (Node.js 18+)
import axios from 'axios';
const API_KEY = 'tgl-enterprise-8655529a5afc52d0';
const BASE = 'https://lnwthailive.online';

// ดึงบาสเกตบอลสด
const { data: bball } = await axios.get(`${BASE}/api/ge-sports`, {
  headers: { 'x-api-key': API_KEY },
  params: { type: 'Basketball' }
});
console.log(`บาสสด: ${bball.count} คู่`);

// ดึงบอลสด AMB
const { data: amb } = await axios.get(`${BASE}/api/askmebet/live`, {
  headers: { 'x-api-key': API_KEY }
});
console.log(`บอลสด AMB: ${amb.live_count} คู่`);
PHP (cURL Implementation)
<?php
$apiKey = "tgl-enterprise-8655529a5afc52d0";
$url = "https://lnwthailive.online/api/ge-sports?type=Tennis";

$ch = curl_init($url);
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["x-api-key: " . $apiKey]
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($res && $res['success']) {
  echo "เทนนิสสด: " . $res['count'] . " แมตช์";
}
?>

8. ระบบสตรีมมิ่ง HLS และข้อควรระวังสำคัญ (Security & Gotchas)

⚠️ กฎเหล็กป้องกันข้อผิดพลาด 403 Forbidden (ระบบล็อก IP-Binding)

ลิงก์สตรีมมิ่ง HLS ที่มีพารามิเตอร์ stk=... จะทำการผูกเข้ากับ IP แรกที่โหลดวิดีโอทันที
❌ ข้อห้าม: ห้าม Backend Server ยิงคำขอเช็คลิงก์ m3u8 ล่วงหน้า เพราะโทเค็นจะติด IP เซิร์ฟเวอร์ ทำให้คนดูปลายทางเปิดไม่ได้
✅ ข้อปฏิบัติ: ให้ Backend ส่งลิงก์ไปยัง Browser/App ของผู้ใช้โดยตรง เพื่อให้เครื่องเล่นวิดีโอ (Player) เป็นผู้โหลดเอง

9. รหัสสถานะและคำแนะนำ Caching (HTTP Status & Caching)

Status ความหมาย คำอธิบาย
200 OK สำเร็จ ส่งข้อมูล JSON หรือ URL สตรีมมิ่งถูกต้อง
400 / 401 พารามิเตอร์ไม่ครบ / ขาดคีย์ ตรวจสอบค่า type, matchId หรือแนบ x-api-key
403 Forbidden ถูกปฏิเสธ คีย์หมดอายุ หรือเกิด IP Mismatch บน Stream Token
429 Rate Limit เรียกถี่เกินไป ยิงเกินโควตาคำขอต่อนาที (แนะนำให้ทำ Cache)
444 Offline ไม่มีสัญญาณ แมตช์ยังไม่เริ่มแข่งขัน หรือจบเกมแล้ว
💡 คำแนะนำการทำ Caching เพื่อประสิทธิภาพสูงสุด

บอลสด AMB (`/api/askmebet/live`): Cache 10-15s | กีฬาสากล (`/api/ge-sports`): Cache 15-30s | ผลบอลสด (`/api/public/matches`): Cache 5-10s | ตารางคะแนน & วิเคราะห์: Cache 60-300s