To use the YouTube Downloader API, send a GET request to the following URL with the required parameters:
https:///ytdl?url=[video_url]&type=[mp3/mp4]
If you want to download the video as an MP3 or MP4, use the "type" parameter in the request:
const axios = require('axios'); axios.get('https://${window.location.hostname}/ytdl?url=&type=mp4') .then(response => { console.log(response.data); }) .catch(error => { console.error(error); });
import requests url = 'https://${window.location.hostname}/ytdl?url=&type=mp4' response = requests.get(url) print(response.json())
curl "https://${window.location.hostname}/ytdl?url=&type=mp4"
&type=mp4'; $response = file_get_contents($url); echo $response; ?>
import java.io.*; import java.net.*; public class YouTubeDownloader { public static void main(String[] args) throws IOException { String url = "https://${window.location.hostname}/ytdl?url=&type=mp4"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } }
For more details, check out the source code and contribute on GitHub!