YouTube-Clone Link
https://rapidapi.com/ytdlfree/api/youtube-v31/
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/captions',
params: {
part: 'snippet',
videoId: 'M7FIvfx5J10'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/search',
params: {
relatedToVideoId: '7ghhRHRP6t4',
part: 'id,snippet',
type: 'video',
maxResults: '50'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/search',
params: {
q: 'music',
part: 'snippet,id',
regionCode: 'US',
maxResults: '50',
order: 'date'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/commentThreads',
params: {
part: 'snippet',
videoId: '7ghhRHRP6t4',
maxResults: '100'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/comments',
params: {
part: 'snippet',
id: 'UgzZ696zk0n_CBhYMK14AaABAg'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/videos',
params: {
part: 'contentDetails,snippet,statistics',
id: '7ghhRHRP6t4'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/channels',
params: {
part: 'snippet,statistics',
id: 'UCBVjMGOIkavEAhyqpxJ73Dw'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/search',
params: {
channelId: 'UCBVjMGOIkavEAhyqpxJ73Dw',
part: 'snippet,id',
order: 'date',
maxResults: '50'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/playlistItems',
params: {
playlistId: 'RDZiQo7nAkQHU',
part: 'snippet',
maxResults: '50'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-v31.p.rapidapi.com/playlists',
params: {
id: 'RDZiQo7nAkQHU',
part: 'snippet'
},
headers: {
'X-RapidAPI-Key': 'SIGN-UP-FOR-KEY',
'X-RapidAPI-Host': 'youtube-v31.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}