A guide for integrating the YouTube Scraper API from CognifyAPI to search YouTube content and retrieve video, channel, and comment information and get search data with JSON results.
- API Documentation: YouTube Data API Docs
- More Info: YouTube Data API
- Official Website: CognifyAPI.com
- CognifyAPI Studio: Get an API key
- Search videos, channels, and Shorts.
- Retrieve video details by video ID.
- Retrieve comments and replies for a video.
| Endpoint | Description | Example parameters | Response example |
|---|---|---|---|
/youtube-search |
Search YouTube content. | query=Mr Beast |
JSON sample |
/youtube-video-search |
Search videos. | query=Mr Beast |
JSON sample |
/youtube-channel-search |
Search channels. | query=Mr Beast |
JSON sample |
/youtube-shorts-search |
Search Shorts. | query=Mr Beast |
JSON sample |
/youtube-video-details |
Retrieve video metadata. | videoId=Af6i6ChAVTw |
JSON sample |
/youtube-video-comments |
Retrieve comments for a video. | videoId=Af6i6ChAVTw |
JSON sample |
/youtube-video-reply-comments |
Retrieve replies for a comment. | videoId=Af6i6ChAVTw&commentKey=... |
JSON sample |
Each linked file is an endpoint-specific JSON example for the request shown in its row. The comments fixture has two comment entries although its result count is 20.
Base URL: https://api.cognifyapi.com
Send your API key in the x-cognifyapi-key header. Install Axios with npm install axios, set COGNIFY_API_KEY, then run index.js.
x-cognifyapi-key: YOUR_COGNIFY_API_KEY
The runnable script demonstrates all seven endpoints. For reply comments, the commentKey must identify a comment on the requested video.
{
"status": "success",
"query": "Mr Beast",
"data": {
"channels": [],
"videos": [
{
"videoId": "Af6i6ChAVTw",
"title": "Last To Leave Mansion, Keeps It",
"author": "MrBeast",
"published": "3 months ago",
"duration": "57:51",
"viewCount": "142,280,353 views",
"url": "https://www.youtube.com/watch?v=Af6i6ChAVTw"
}
]
}
}