Get the videos in a playlist
curl --request POST \
--url https://api.stophy.dev/v1/youtube/playlist \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"playlist": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({playlist: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI'})
};
fetch('https://api.stophy.dev/v1/youtube/playlist', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/youtube/playlist"
payload = { "playlist": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"videos": [
{
"type": "video",
"url": "<string>",
"isShort": true,
"isLive": true,
"id": "<string>",
"title": "<string>",
"channel": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"durationSeconds": 0,
"views": 0,
"thumbnail": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"playlist": {
"url": "<string>",
"id": "<string>",
"title": "<string>",
"description": "<string>",
"channel": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"videos": 0,
"views": 0,
"thumbnail": "<string>"
},
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}YouTube
YouTube playlist API
Call the YouTube playlist API to get playlist and videos, as JSON or markdown. 1 credit per 100 items, at least 1 credit.
POST
/
v1
/
youtube
/
playlist
Get the videos in a playlist
curl --request POST \
--url https://api.stophy.dev/v1/youtube/playlist \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"playlist": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({playlist: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI'})
};
fetch('https://api.stophy.dev/v1/youtube/playlist', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.stophy.dev/v1/youtube/playlist"
payload = { "playlist": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"videos": [
{
"type": "video",
"url": "<string>",
"isShort": true,
"isLive": true,
"id": "<string>",
"title": "<string>",
"channel": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"durationSeconds": 0,
"views": 0,
"thumbnail": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}
],
"playlist": {
"url": "<string>",
"id": "<string>",
"title": "<string>",
"description": "<string>",
"channel": {
"id": "<string>",
"username": "<string>",
"name": "<string>",
"url": "<string>",
"avatar": "<string>",
"isVerified": true
},
"videos": 0,
"views": 0,
"thumbnail": "<string>"
},
"cursor": "<string>"
},
"creditsUsed": 123,
"requestId": "<string>"
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}{
"success": false,
"error": {
"code": "cliSessionCompleted",
"message": "<string>",
"retryable": true,
"requestId": "<string>",
"retryAfterSeconds": 123
}
}- Endpoint:
youtube.playlist - Returns:
datahasplaylist,videos. - Cost: 1 credit per 100 items, at least 1 credit. Failed calls cost nothing.
- Paging: Yes. Send the
cursorfrom the response to get the next page. See Paging.
Example
import { Stophy } from "stophy";
const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
const result = await stophy.youtube.playlist({ playlist: "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI" });
console.log(result.data.playlist);
from stophy import Stophy
stophy = Stophy() # reads STOPHY_API_KEY
result = stophy.youtube.playlist(playlist="PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI")
print(result["data"]["playlist"])
curl -X POST https://api.stophy.dev/v1/youtube/playlist \
-H "Authorization: Bearer $STOPHY_API_KEY" \
-H "content-type: application/json" \
-d '{"playlist":"PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI"}'
stophy youtube playlist PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json