Video Download API Documentation

Our Any4K.com Video Download API allows you to easily download videos from popular social media platforms including YouTube, TikTok, and Twitter and more. The API supports various video qualities, formats, and provides both video and audio extraction capabilities.

API Endpoints

Video Information Check

Retrieves video metadata and available download formats.

Endpoint: https://api.any4k.com/v1/dlp/check
Method: POST
Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
urlstringYesThe video URL to download
langstringNoLanguage code (default: en)
countrystringNoCountry code (default: US)
platformstringNoPlatform name (default: Web)
deviceIdstringNoUnique device identifier

Example Request

cURL
curl -X POST https://api.any4k.com/v1/dlp/check \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.youtube.com/watch?v=VIDEO_ID",
    "lang": "en",
    "country": "US",
    "platform": "Web",
    "deviceId": "your-device-id"
  }'
Node.js
const axios = require('axios');

async function checkVideo() {
  try {
    const response = await axios.post('https://api.any4k.com/v1/dlp/check', {
      url: 'https://www.youtube.com/watch?v=VIDEO_ID',
      lang: 'en',
      country: 'US',
      platform: 'Web',
      deviceId: 'your-device-id'
    }, {
      headers: {
        'Content-Type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
}

Response Format

{
  "err_code": 0,
  "err_msg": "",
  "data": {
    "id": "VIDEO_ID",
    "title": "Video Title",
    "description": "Video description",
    "duration": 180,
    "view_count": 1000000,
    "upload_date": "20240401",
    "extractor": "youtube",
    "is_live": false,
    "thumbnail": "https://example.com/thumbnail.jpg",
    "download": [
      {
        "id": "format_id",
        "ext": "mp4",
        "res_text": "1080p",
        "filesize": 104857600
      }
    ],
    "raw_video": [
      {
        "id": "format_id",
        "ext": "mp4",
        "res_text": "4K",
        "filesize": 524288000,
        "vcodec": "h264"
      }
    ],
    "raw_audio": [
      {
        "id": "format_id",
        "ext": "m4a",
        "filesize": 3145728,
        "acodec": "aac",
        "asr": 44100
      }
    ]
  }
}

Video Download

Downloads the video in the specified format.

Endpoint: https://api.any4k.com/v1/dlp/download
Method: POST
Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
urlstringYesThe video URL
formatstringYesFormat ID from check response
langstringNoLanguage code (default: en)
countrystringNoCountry code (default: US)

Example Request

cURL
curl -X POST https://api.any4k.com/v1/dlp/download \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.youtube.com/watch?v=VIDEO_ID",
    "format": "format_id",
    "lang": "en",
    "country": "US"
  }'
Node.js
const axios = require('axios');

async function downloadVideo() {
  try {
    const response = await axios.post('https://api.any4k.com/v1/dlp/download', {
      url: 'https://www.youtube.com/watch?v=VIDEO_ID',
      format: 'format_id',
      lang: 'en',
      country: 'US'
    }, {
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'stream'
    });
    
    // Handle the video stream
    response.data.pipe(fs.createWriteStream('video.mp4'));
  } catch (error) {
    console.error('Error:', error.message);
  }
}

Error Codes

CodeDescription
0Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
403Forbidden - Access denied
404Not Found - Video not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error
502Bad Gateway - Video platform error

Supported Platforms

  • YouTube
  • TikTok
  • Twitter
  • Instagram
  • Facebook
  • Vimeo
  • Dailymotion
  • And more...

Rate Limits

  • Free tier: 100 requests per day
  • Pro tier: 1000 requests per day
  • Enterprise tier: Custom limits

Best Practices

  1. Always check video information before downloading
  2. Handle rate limits appropriately
  3. Implement proper error handling
  4. Cache responses when possible
  5. Use appropriate timeout values

Support

For technical support or questions, please contact:

Copyright © 2010 - 2024 Any4K.com