We are using Google's YouTube Data API to pull videos from our YouTube channel.
Our expected outcome is to pull the list of videos from our channel once a day, but we encountered the following issues when calling the API:
If we only set forMine=true without setting publishedBefore/publishedAfter, a full pull will be performed, which consumes a large number of QPS quotas and leads to quotaExceeded:
- Request Details:
curl --location --request GET 'https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&forMine=true&maxResults=50' \
--header 'Authorization: Bearer redacted' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: www.googleapis.com' \
--header 'Connection: keep-alive'
- Response Details:
{
"kind": "youtube#searchListResponse",
"etag": "redacted",
"nextPageToken": "redacted",
"pageInfo": {
"totalResults": 57,
"resultsPerPage": 50
},
"items": [
{…… #Skip detailed video specifics
}
},
"channelTitle": "Qingquan Hou",
"liveBroadcastContent": "none",
"publishTime": "2025-07-15T03:39:33Z"
}
}
]
}
If we set the request condition as forMine=true along with publishedBefore, it results in an invalidSearchFilter error :
- Request Details:
curl --location --request GET 'https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&forMine=true&maxResults=50&publishedAfter=2025-07-01T19:59:59Z' \
--header 'Authorization: Bearer redacted' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: www.googleapis.com' \
--header 'Connection: keep-alive'
- Response Details:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
If we do not set forMine=true in the request condition, although adding publishedBefore does not cause an error, the returned value is 0:
- Request Details:
curl --location --request GET 'https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=50&publishedAfter=2025-07-01T19:59:59Z' \
--header 'Authorization: Bearer redacted' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: www.googleapis.com' \
--header 'Connection: keep-alive'
- Response Details:
{
"kind": "youtube#searchListResponse",
"etag": "redacted",
"regionCode": "KR",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}
The API documentation we are using is: https://developers.google.com/youtube/v3/docs/search/list?apix_params=%7B%22part%22%3A%5B%22snippet%22%5D%2C%22channelId%22%3A%22UCBaxnqrfeeoxOxoMpPhqefA%22%2C%22maxResults%22%3A25%2C%22type%22%3A%5B%22video%22%5D%7D&hl=zh-cn
What can we do to achieve our goal of pulling videos within a specified date range?