เอกสารประกอบ API

สำหรับราคา API คลิกที่นี่

API ของ Yout.com ถูกโฮสต์อยู่ที่ dvr.yout.com


การรับรองความถูกต้อง

หากต้องการเข้าถึง API ของ Yout.com คุณต้องระบุรหัส API เฉพาะของคุณ คุณสามารถรับรหัส API ได้โดยลงทะเบียนด้วยที่อยู่อีเมลของคุณ โปรดจำไว้ว่าต้องรักษารหัส API ของคุณไว้เป็นความลับ

การตรวจสอบสิทธิ์ด้วย API จะดำเนินการผ่านส่วนหัว HTTP คำขอทั้งหมดต้องมีส่วนหัวการอนุญาตที่มีคีย์ API ของคุณในรูปแบบคีย์: YOUR_API_KEY โดยที่ YOUR_API_KEY คือคีย์ที่มีอยู่ในหน้าบัญชีของคุณ

เพื่อความปลอดภัย คำขอทั้งหมดจะต้องถูกส่งผ่านการเชื่อมต่อ HTTPS ที่เข้ารหัสเพื่อปกป้องข้อมูลของคุณระหว่างการส่ง


การเปลี่ยนรูปแบบ MP3

ส่ง URL วิดีโอ/เสียงไปที่ Yout.com API เพื่อเปลี่ยนรูปแบบ MP3 API จะตรวจจับเสียง/วิดีโอโดยอัตโนมัติและเตรียมให้พร้อมสำหรับการเล่นที่เหมาะสมที่สุดบนอุปกรณ์ต่างๆ

ตัวอย่างการเปลี่ยนรูปแบบ MP3

แทนที่ YOUR_API_KEY ด้วยคีย์ API เฉพาะของคุณ (พบได้ในหน้าบัญชี Yout.com ของคุณ) และแทนที่ AUDIO_URL ด้วย URL เสียง/วิดีโอ:

import requests
import base64

headers = {"Authorization": "API_KEY"}
audio_url = base64.b64encode("AUDIO_URL")
r = requests.post(
    url="http://dvr.yout.com/mp3",
    headers=headers,
    data={
        "video_url": audio_url,
        "start_time": False,
        "end_time": False,
        "title": "Hello world",
        "artist": "Hello world",
        "audio_quality": '128k',
    }
)

with open("audio.mp3" "wb") as fd:
    for chunk in r.iter_content(chunk_size=128):
        fd.write(chunk)
const axios = require('axios');

const headers = {
  Authorization: "API_KEY"
};

const audioUrl = Buffer.from("AUDIO_URL").toString('base64');

const data = {
  video_url: audioUrl,
  start_time: false,
  end_time: false,
  title: "Hello world",
  artist: "Hello world",
  audio_quality: "128k"
};

axios
  .post("http://dvr.yout.com/mp3", data, { headers })
  .then(response => {
    const fs = require('fs');
    const fileStream = fs.createWriteStream("audio.mp3");

    response.data.pipe(fileStream);

    fileStream.on('finish', () => {
      console.log("Archivo descargado con éxito como audio.mp3");
    });

    fileStream.on('error', error => {
      console.error("Error al escribir el archivo:", error);
    });
  })
  .catch(error => {
    console.error("Error en la solicitud:", error);
  });
<?php
$audio_url = base64_encode("AUDIO_URL");

// Datos para enviar en la solicitud POST
$data = [
    "video_url" => $audio_url,
    "start_time" => false,
    "end_time" => false,
    "title" => "Hello world",
    "artist" => "Hello world",
    "audio_quality" => "128k"
];

// Convertir los datos a formato URL-encoded
$postData = http_build_query($data);

// Configurar la solicitud cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://dvr.yout.com/mp3");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: API_KEY",
    "Content-Type: application/x-www-form-urlencoded"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Ejecutar la solicitud
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    // Guardar el archivo de audio
    $file = fopen("audio.mp3", "wb");
    fwrite($file, $response);
    fclose($file);
    echo "Archivo descargado con éxito como audio.mp3";
} else {
    echo "Error en la solicitud. Código HTTP: $httpCode";
}
?>
curl -X POST "http://dvr.yout.com/mp3" \
         -H "Authorization: API_KEY" \
         -H "Content-Type: application/x-www-form-urlencoded" \
         -d "video_url=$(echo -n 'AUDIO_URL' | base64)" \
         -d "start_time=false" \
         -d "end_time=false" \
         -d "title=Hello world" \
         -d "artist=Hello world" \
         -d "audio_quality=128k" \
         --output audio.mp3
    

การเปลี่ยนรูปแบบ MP4

ส่ง URL วิดีโอ/เสียงไปที่ Yout.com API เพื่อเปลี่ยนรูปแบบ MP4 API จะตรวจจับเสียง/วิดีโอโดยอัตโนมัติและเตรียมให้พร้อมสำหรับการเล่นที่เหมาะสมที่สุดบนอุปกรณ์ต่างๆ

ตัวอย่างการเปลี่ยนรูปแบบ MP4

แทนที่ YOUR_API_KEY ด้วยคีย์ API เฉพาะของคุณ (พบได้ในหน้าบัญชี Yout.com ของคุณ) และแทนที่ VIDEO_URL ด้วย URL เสียง/วิดีโอ:

import requests
import base64

headers = {"Authorization": "API_KEY"}
video_url = base64.b64encode("VIDEO_URL")
r = requests.post(
    url="http://dvr.yout.com/mp4",
    headers=headers,
    data={
        "video_url": video_url,
        "start_time": False,
        "end_time": False,
        "title": "hello world",
        "video_quality": 720
    }
)

with open("audio.mp4" "wb") as fd:
    for chunk in r.iter_content(chunk_size=128):
        fd.write(chunk)
const axios = require('axios');

const headers = {
  Authorization: "API_KEY"
};

const audioUrl = Buffer.from("AUDIO_URL").toString('base64');

const data = {
  video_url: video_url,
  start_time: false,
  end_time: false,
  title" "hello world",
  video_quality: 720
};

axios
  .post("http://dvr.yout.com/mp3", data, { headers })
  .then(response => {
    const fs = require('fs');
    const fileStream = fs.createWriteStream("audio.mp3");

    response.data.pipe(fileStream);

    fileStream.on('finish', () => {
      console.log("Archivo descargado con éxito como audio.mp3");
    });

    fileStream.on('error', error => {
      console.error("Error al escribir el archivo:", error);
    });
  })
  .catch(error => {
    console.error("Error en la solicitud:", error);
  });
<?php
$video_url = base64_encode("VIDEO_URL");

$data = [
    "video_url" => $video_url,
    "start_time" => false,
    "end_time" => false,
    "title" => "hello world",
    "video_quality" => 720
];

$postData = http_build_query($data);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://dvr.yout.com/mp4");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: API_KEY",
    "Content-Type: application/x-www-form-urlencoded"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 200) {
    $file = fopen("video.mp4", "wb");
    fwrite($file, $response);
    fclose($file);
    echo "Archivo descargado con éxito como video.mp4";
} else {
    echo "Error en la solicitud. Código HTTP: $httpCode";
}
?>
curl -X POST "http://dvr.yout.com/mp4" \
     -H "Authorization: API_KEY" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "video_url=$(echo -n 'VIDEO_URL' | base64)" \
     -d "start_time=false" \
     -d "end_time=false" \
     -d "title=hello world" \
     -d "video_quality=720" \
     --output video.mp4

Glossary of parameters

video_url
string (required)

URL เสียง/วิดีโอใน base64 ตรวจสอบหน้าทั้งหมดที่เรารองรับ คลิกที่นี่

start_time
int

ใช้เพื่อตัดเสียงหรือวิดีโอ และแสดงวินาทีที่คุณต้องการให้บันทึกเสียงหรือวิดีโอเริ่มต้น คุณสามารถส่ง false เพื่อระบุว่าควรเริ่มตั้งแต่วินาทีที่ 0

end_time
int / bool (false)

ใช้เพื่อตัดเสียงหรือวิดีโอ และแสดงวินาทีที่คุณต้องการให้การบันทึกเสียง/วิดีโอสิ้นสุดลง คุณสามารถส่ง <code>false</code> ได้หากคุณไม่ต้องการตัดเสียง/วิดีโอ

title
string (required)

ชื่อเรื่องที่จะบันทึกเสียง/วิดีโอไว้ นอกจากนี้ยังใช้เพื่อตั้งชื่อไฟล์ที่สร้างขึ้นด้วย

artist
string

ชื่อศิลปินที่จะบันทึกไฟล์ไว้

audio_quality
string

คุณภาพที่ไฟล์เสียงจะถูกบันทึก คุณภาพที่มีให้เลือกคือ 32k , 64k , 128k , 256k หรือ 320k

video_quality
string

คุณภาพที่ไฟล์วิดีโอจะถูกบันทึก คุณภาพที่มีให้เลือกคือ 144 , 240 , 360 , 480 , 720 (สำหรับ HD), 1080 (สำหรับ UHD), 2160 (สำหรับ 4k) หรือ 4320 (สำหรับ 8k)

เกี่ยวกับเรา API นโยบายความเป็นส่วนตัว เงื่อนไขการบริการ ติดต่อเรา ติดตามเราได้ที่ BlueSky

2025 Yout LLC | ผลิตโดย nadermx