Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Why does the YouTube search API with `channelId` specified return videos from other channels?

$
0
0

I am querying the YouTube API to search for videos from a particular channel, with a given query.

For example:

  • channelId: UCIG1k8umaCIIrujZPzZPIMA ("Made by Google" channel)
  • query: town hall

Sample query, as taken from the YouTube API dashboard:

curl \'https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UCIG1k8umaCIIrujZPzZPIMA&q=town%20hall&key=[YOUR_API_KEY]' \  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \  --header 'Accept: application/json' \  --compressed

This produces the following results:

{"kind": "youtube#searchListResponse","etag": "s6StXaHbEt-uwoGClbHgkFWOb1A","nextPageToken": "CAUQAA","regionCode": "GB","pageInfo": {"totalResults": 10699,"resultsPerPage": 5  },"items": [    {"kind": "youtube#searchResult","etag": "K_bX_NIF7PuKSUGdsbE8nP9R35c","id": {"kind": "youtube#video","videoId": "zm4HLTm9n9I"      },"snippet": {"publishedAt": "2023-10-10T04:24:44Z","channelId": "UCL_A4jkwvKuMyToAPy3FQKQ","title": "Virtual Town Hall: The Conflict in the Middle East","description": "CFR President Michael Froman leads a town hall discussion with CFR Fellows and members on the current crisis in the Middle ...","thumbnails": {"default": {"url": "https://i.ytimg.com/vi/zm4HLTm9n9I/default.jpg","width": 120,"height": 90          },"medium": {"url": "https://i.ytimg.com/vi/zm4HLTm9n9I/mqdefault.jpg","width": 320,"height": 180          },"high": {"url": "https://i.ytimg.com/vi/zm4HLTm9n9I/hqdefault.jpg","width": 480,"height": 360          }        },"channelTitle": "Council on Foreign Relations","liveBroadcastContent": "none","publishTime": "2023-10-10T04:24:44Z"      }    },    ...etc

Notice that the first video is from a completely different channel, with a different channel id.

Am I doing something wrong, or is the API broken?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>