https://videomentions.com/api/v1/video-search?query=${QUERY}&filters=${FILTERS}&continuation=${CONTINUATION}
This endpoint can be used to search for YouTube videos.
query
- string. The search query.filters
- object. (optional) A UTF-8 encoded JSON object of search filters. uploadDate
- ”all” | ”hour” | ”today” | ”week” | ”month” | ”year”. (optional) Filter by upload date. Default is ”all“.duration
- ”all” | ”short” | ”medium” | ”long”. (optional) Filter by video duration. Default is ”all“.sortBy
- ”relevance” | ”rating” | ”upload_date” | ”view_count”. (optional) How the results should be sorted. Default is ”relevance“.features
- string[]: one or more of these values: ”hd”, ”subtitles”, ”creative_commons”, ”3d”, ”live”, ”purchased”, ”4k”, ”360”, ”location”, ”hdr”, ”vr180”. (optional) Filter the results based on video features.continuation
- string. (optional) Continuation string to get the next page of results.estimatedResults
- integer. Estimated number of total search results.results
- array. Array of objects representing the videos. id
- string. Video ID.title
- string. Video title.authorId
- string Author ID.thumbnails
- array. Video thumbnails. url
- string. Thumbnail URL.width
- integer. Thumbnail width in pixels.height
- integer. Thumbnail height in pixels.duration
- integer|null. Length of the video in seconds. This value will be null
if video is streaming live and does not yet have a total duration.viewCount
- integer. Number of views.publishedText
- string|null. Human-readable text indicating when the video was published. null
if data is unavailable.continuation
- string|null. Continuation string to be included in subsequent requests for paginated data. This value is null
when no more pages remain.filters
filtering options mean, please refer to this guide.results
array typically includes about 16-20 records.continuation
parameter is provided, a 400 Bad Request
error response will be returned.Below is an example showing how to search for videos that match “news”.
curl -X GET
-H "API-Key: your-api-key"
-H "API-Secret: your-api-secret"
https://videomentions.com/api/v1/video-search?query=news
{
"estimatedResults": 7428834262,
"results": [
{
"id": "nwZ4evCiL-Y",
"title": "NBC News NOW - Dec. 6",
"authorId": "UCeY0bbntWzzVIaj2z3QigXg",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/nwZ4evCiL-Y/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAOXvKVPwqeAKziH8i4HweXAE39Zg",
"width": 720,
"height": 404
},
{
"url": "https://i.ytimg.com/vi/nwZ4evCiL-Y/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLB2WpPaHSztV6G_UqLUINssxUvjPg",
"width": 360,
"height": 202
}
],
"duration": 591,
"viewCount": 8611,
"publishedText": "1 hour ago"
},
{
"id": "gfHEbSbkiKY",
"title": "BREAKING: Kevin McCarthy says he will leave Congress by the end of the year",
"authorId": "UCaXkIU1QidjPwiAYu6GcHjg",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/gfHEbSbkiKY/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBKpkQbppPBn9hbVYJxjxIk6Mn_XA",
"width": 720,
"height": 404
},
{
"url": "https://i.ytimg.com/vi/gfHEbSbkiKY/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD4iAVeWjbwyKCvjd3hynR2Va4GLQ",
"width": 360,
"height": 202
}
],
"duration": 300,
"viewCount": 115515,
"publishedText": "3 weeks ago"
}
// etc.
],
"continuation": "ErsDEgRuZXdzGrIDRWdCSUZJSUJEMUpFVGxOWk9YQnRVMUJ4VlVVdGE0SUJEMUpFVGxOeU1VWnNUV1V5YVdkWlRZSUJEMUpFVGxONFpEQjJabTVQUmtWMlRZSUJDMjUzV2pSbGRrTnBUQzFaZ2dFTFoyWklSV0pUWW10cFMxbUNBUXRLU0RWbGFGQkdjME50TklJQkN6QXdaRVpIY0c5a1JWZ3dnZ0VZVlVOTGFsVXpTM3BrWWtwRk1VVkdZMGhXY1ZoRE0xOW5nZ0VMY1dkSlREaFhSVTQ1TWsyQ0FRdHFSbTVyZEdOUmJXNW1XWUlCQ3psc2NGbFdhVEpQYTNkUmdnRUxObTFGYWxCbE5sTTBXRy1DQVF0Q1lXSmxTRTU0UlU0d1o0SUJDM0I0UWpSbVNIaEVUSHBSZ2dFTGQzRkdOMGxYWkcweFdXT0NBUXRGYUhaeFNEaE9ZbXhqU1lJQkMyMHpjREpIVW5Ob2VERm5nZ0VMT0VkNVV6UjBZM0pEYTFtQ0FRdDZWMWhNTFdOelVGTTVkNElCQzFWUU9XRk5aMUpaTmtaTnNnRUdDZ1FJR1JBQzZnRUNDQUklM0QYgeDoGCILc2VhcmNoLWZlZWQ%3D"
}
Below is an example showing how to get filtered search results in JavaScript/TypeScript.
const query = 'local news';
const filters = {
uploadDate: 'month',
duration: 'medium',
sortBy: 'view_count',
features: ['hd', 'subtitles'],
};
const filtersEncoded = encodeURIComponent(JSON.stringify(filters));
const response = await fetch(
`https://videomentions.com/api/v1/video-search?query=${query}&filters=${filtersEncoded}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const responseData = await response.json();
console.log('Response data:', responseData);
{
"estimatedResults": 210312,
"results": [
{
"id": "PLNJ01GuZZI",
"title": "Chase with U-Haul van ends with suspect hanging from Turnpike overpass",
"authorId": "UCgVZ0mrM3liHNhRYC5Mchgg",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/PLNJ01GuZZI/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLAK81liSuUY0eipdP9hfhuGMMr0Tw",
"width": 720,
"height": 404
},
{
"url": "https://i.ytimg.com/vi/PLNJ01GuZZI/hq720.jpg?sqp=-oaymwEjCOgCEMoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBgmQsl5zzA5NWG-lq24v8tlIl_kg",
"width": 360,
"height": 202
}
],
"duration": 468,
"viewCount": 2891566,
"publishedText": "3 weeks ago"
},
{
"id": "yoSRj0XlaS0",
"title": "Latest on deadly Ohio bus crash",
"authorId": "UCAKK8dbcSmckr2sWJhv5ezA",
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/yoSRj0XlaS0/hqdefault.jpg?sqp=-oaymwEjCOADEI4CSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCjo5NR5OIQbht9p5jO-U-5mREtfw",
"width": 480,
"height": 270
}
],
"duration": 594,
"viewCount": 882295,
"publishedText": "3 weeks ago"
}
// etc.
],
"continuation": "EqkDEgpsb2NhbCBuZXdzGpoDQ0FNU0NnZ0VFQUVZQXlBQktBRklGSUlCQzFCTVRrb3dNVWQxV2xwSmdnRUxlVzlUVW1vd1dHeGhVekNDQVF0alZqY3dWRmRoTkhCSFFZSUJDMGRGTkZoVFV6aHplbmROZ2dFTFFtVlRkVVEyUzFnMGRrR0NBUXRFUjNoVWVFZHVSekU1U1lJQkN6bFJYMTlIYlUxR1ZYbEpnZ0VMUzNRNU5FcGZielJhUnpDQ0FRdFRWbUl5VlRjM05HODNaNElCQzNKV1NURmFWRFJvYTFSRmdnRUxZVzA0Y0RJMVFWWjJUSE9DQVFzd1VsZG5WalY1UVVZdE9JSUJDMWx5ZGtKbGNqTkdjVnB6Z2dFTFExWkdaMFZzVkVaelYyLUNBUXR5VUUxNGEzTlFOWE5qTklJQkMyaFNaalZFTjNORFJVaHpnZ0VMZG04NGFWWk1OWEF0WmtXQ0FRc3lWR3N4TlRsb1FWVXhPSUlCQ3pWNmQwTllSV3B3Y1hNMGdnRUxObWxVYms5Wlgxb3dTRTJ5QVFZS0JBZ1pFQUklM0QYgeDoGCILc2VhcmNoLWZlZWQ%3D"
}
Below is an example showing how to get paginated results in JavaScript/TypeScript.
Notice that the continuation
string from page 1 is provided as a parameter to get page 2. This process can be repeated to get pages 3, 4, etc. When no more pages remain, the value of continuation
will be null
.
const query = 'news';
// Fetch page 1
const pageOneResponse = await fetch(
`https://videomentions.com/api/v1/video-search?query=${query}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const pageOneData = await pageOneResponse.json();
console.log('Page 1 results:', pageOneData.results);
// Verify that a next page exists
const haveNextPage = pageOneData.continuation !== null;
if (!haveNextPage) {
// Don't attempt to fetch the next page if no more pages remain
return;
}
// Fetch page 2
const pageTwoResponse = await fetch(
`https://videomentions.com/api/v1/video-search?continuation=${pageOneData.continuation}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const pageTwoData = await pageTwoResponse.json();
console.log('Page 2 results:', pageTwoData.results);