How to search content across multiple channel in youtube api?
Asked Answered
F

3

12

I want to search youtube videos in a list of channels. In the code below, I am able to pass only one "Channelid" to the youtube api. Is there a way to pass multiple channel Ids ??

def youtube_search(options):
  youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,
    developerKey=DEVELOPER_KEY)

  # Call the search.list method to retrieve results matching the specified
  # query term.
  search_response = youtube.search().list(
    q=options.q,
    part="id,snippet",
    maxResults=options.max_results,
    channelId=options.channelId
  ).execute() 
Flashgun answered 10/2, 2014 at 2:3 Comment(1)
did you find any solution for this ?Gilemette
R
4

You can not add comma separated channels here. Either you can leave it blank to search all channels, or you can have a request per each channel and merge results. There is no multichannel search API.

Rubenstein answered 10/2, 2014 at 18:15 Comment(3)
That would be expensive and would exhaust my daily api requests quota very fast. Is there any way to achieve this feature ?Flashgun
@Mayank: Have you found a better solution to club multiple channelIds in one search ?Blockus
Do we have any solution for this in 2020 ?Gilemette
D
2

As @Ibrahim has pointed out searching with multiple ChannelIDs is not possible. What can be done instead is do a search with no ChannelIDs at all. Each video result that you get will have the ChannelID for each of it. So you can loop through the result for items with your preferred list of channelIDs, and the matching ones can thus be filter.

Decipher answered 27/4, 2016 at 9:5 Comment(1)
any better solution to club multiple channelIds in one search in 2020 ?Gilemette
O
0

This still s*cks in 2023... Can't search multiple channelId, 10k in quota so 100 search, voilà. I want to aggregate things, I can't even "visit" a page without using this awful search api, the youtube api experience is a nightmare --'

Olsewski answered 3/7, 2023 at 11:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.