Skip to content

Search Videos

Create a new search job

Initiate a new search job to search for videos on Youtube. The API will return a response with a request_id that can be used to check the status of the job. The API will also send initial results to the callback_url provided in the request.

if you want to find videos from a specific channel, you can provide the channel URL in the url parameter. Meanwhile, if you want to search for videos based on a keyword, you can provide the keyword parameter. You can use either of these parameters, but not both at the same time.

Base URL

POST https://youtube-scraper-api.datashake.com/v1/search

Request payload

callback_url

Field type: string
Required: true
Description: A URL to receive API results via a JSON POST request.

keyword

Field type: string
Required: false
Description: Keyword that will be used to run search on YouTube.

url

Field type: string
Required: false
Description: YouTube channel URL.

external_identifier

Field type: string
Required: false
Description: A custom identifier for tracking your request. This value will be included in the callback payload.

Code example
curl --location 'https://youtube-scraper-api.datashake.com/v1/search' --header 'x-api-key: your-api-key' --header 'Content-Type: application/json' --request POST --data '{"keyword": "skincare", "callback_url": "https://example.com/callback", "external_identifier": "my-custom-id"}'
import requests

url = "https://youtube-scraper-api.datashake.com/v1/search"

payload = {
    "keyword": "skincare",
    "callback_url": "https://example.com/callback",
    "external_identifier": "my-custom-id"
}
headers = {
    "x-api-key": "your-api-key",
}

response = requests.post(url=url, headers=headers, json=payload)

Rules and restrictions

  • Sending either keyword or url parameter is required.
  • The callback_url parameter is required.

Response and callback payload

API response example
{
    "status": "created",
    "message": "Your request was successfully submitted.",
    "request_id": "1742515679047322765-7538bd54-2bd7-45"
}
Callback payload example
{
    "request_id":"1743405100371218948-5cb5a508-e516-42",
    "status":"completed",
    "credits_used":200,
    "request_metadata": {
        "keyword": "skincare",
        "callback_url": "http://example.com/callback",
        "external_identifier": "my-custom-id",
        "url": null
    },
    "results":[
        {
            "video_id":"_mYtKUIalEo",
            "thumbnail_url":"https://i.ytimg.com/vi/_mYtKUIalEo/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBzgWAAoAKigIMCAAQARhlIGUoZTAP&rs=AOn4CLDl_IC8_neXt5oEeLOGJFt6JcM-2Q",
            "title":"Skincare routine ✨ #asmr #skincareroutine #asmrsounds #relax",
            "snippet":null,
            "channel_name":"Eyeful ASMR",
            "channel_url":"https://www.youtube.com/@AAAsmr-pi7vl",
            "upload_date":"2024-05-01",
            "duration":"00:00:19",
            "view_count":186072496,
            "video_url":"https://www.youtube.com/watch?v=_mYtKUIalEo",
            "verified":false
        },
        {
            "video_id":"_Kv3jDo7cqA",
            "thumbnail_url":"https://i.ytimg.com/vi/_Kv3jDo7cqA/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBtgiAAoAPigIMCAAQARhyIEooIjAP&rs=AOn4CLD62eEDKlqPCv4eHIKcHNRnxp8uYA",
            "title":"Blue skincare routine🩵 Who can guess the next color?)",
            "snippet":null,
            "channel_name":"Candy Superstar",
            "channel_url":"https://www.youtube.com/@candy.superstar",
            "upload_date":"2024-09-30",
            "duration":"00:00:44",
            "view_count":67514049,
            "video_url":"https://www.youtube.com/watch?v=_Kv3jDo7cqA",
            "verified":true
        },
        ...
    ],
    "summary":{
        "total_videos":100,
        "total_views":1586822075,
        "average_views_per_video":15868220,
        "unique_channels_count":60,
    },
    "pagination":{
        "total":100,
        "page":1,
        "per_page":10,
        "total_pages":10
    }
}

Get search results

Use this endpoint to retrieve results in a synchronous manner.

Note that this endpoint is not intended for polling - make sure to check if your request has completed before calling it.

Base URL

GET https://youtube-scraper-api.datashake.com/v1/search/:request_id

Path parameters

request_id

Field type: string
Required: true
Description: The unique identifier for the request.

Request parameters

page

Field type: integer
Required: false
Description: The page number of the results to retrieve.

per_page

Field type: integer
Required: false
Description: The number of results to retrieve per page.

Code example
curl --location 'https://youtube-scraper-api.datashake.com/v1/search/1742546457946506999-897b27cc-acd7-4a?page=1&per_page=10' --header 'x-api-key: your-api-key'
import requests

url = "https://youtube-scraper-api.datashake.com/v1/search/1742546457946506999-897b27cc-acd7-4a"

params = {
    "page": 1,
    "per_page": 10
}
headers = {
    "x-api-key": "your-api-key",
}

response = requests.get(url=url, headers=headers, params=params)

Response

API response example
{
    "request_id":"1743405100371218948-5cb5a508-e516-42",
    "status":"completed",
    "credits_used":200,
    "request_metadata": {
        "keyword": "skincare",
        "callback_url": "http://example.com/callback",
        "external_identifier": "my-custom-id",
        "url": null,
    },
    "results":[
        {
            "video_id":"_mYtKUIalEo",
            "thumbnail_url":"https://i.ytimg.com/vi/_mYtKUIalEo/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBzgWAAoAKigIMCAAQARhlIGUoZTAP&rs=AOn4CLDl_IC8_neXt5oEeLOGJFt6JcM-2Q",
            "title":"Skincare routine ✨ #asmr #skincareroutine #asmrsounds #relax",
            "snippet":null,
            "channel_name":"Eyeful ASMR",
            "channel_url":"https://www.youtube.com/@AAAsmr-pi7vl",
            "upload_date":"2024-05-01",
            "duration":"00:00:19",
            "view_count":186072496,
            "video_url":"https://www.youtube.com/watch?v=_mYtKUIalEo",
            "verified":false
        },
        {
            "video_id":"_Kv3jDo7cqA",
            "thumbnail_url":"https://i.ytimg.com/vi/_Kv3jDo7cqA/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGABwAcABBvABAfgBtgiAAoAPigIMCAAQARhyIEooIjAP&rs=AOn4CLD62eEDKlqPCv4eHIKcHNRnxp8uYA",
            "title":"Blue skincare routine🩵 Who can guess the next color?)",
            "snippet":null,
            "channel_name":"Candy Superstar",
            "channel_url":"https://www.youtube.com/@candy.superstar",
            "upload_date":"2024-09-30",
            "duration":"00:00:44",
            "view_count":67514049,
            "video_url":"https://www.youtube.com/watch?v=_Kv3jDo7cqA",
            "verified":true
        },
        ...
    ],
    "summary":{
        "total_videos":100,
        "total_views":1586822075,
        "average_views_per_video":15868220,
        "unique_channels_count":60,
    },
    "pagination":{
        "total":100,
        "page":1,
        "per_page":10,
        "total_pages":10
    }
}