1

Currently I am working on a project that requires to return unlisted videos for a Oauth 2 logged in user. Because I am trying to get unlisted videos, I have to use ForMine variable. So what I got is

https://content.googleapis.com/youtube/v3/search?part=snippet&maxResults=5&forMine=true&type=video&order=date

and it is working fine. However, I want to do an incremental load. That requires to get videos only published after a certain time. Once I add the Published After parameter "publishedAfter=1970-01-01T00%3A00%3A00Z", with this url https://www.googleapis.com/youtube/v3/search?part=snippet&forMine=true&maxResults=25&order=date&publishedAfter=1970-01-01T00%3A00%3A00Z&type=video, the API is returning error

"The request contains an invalid combination of search filters and/or restrictions. Note that you must set the type parameter to video if you set either the forContentOwner or forMine parameters to true. You must also set the type parameter to video if you set a value for the eventType, videoCaption, videoCategoryId, videoDefinition, videoDimension, videoDuration, videoEmbeddable, videoLicense, videoSyndicated, or videoType parameters."

I read it from here Youtube API V3, search , publishedAfter, invalidSearchFilter, looks like ForMine and PublishedAfter do not work together. However, this is exactly what I need.

Is this a bug or intentional design? Is there any walk around of this problem>

Joey.Lu
  • 125
  • 8
  • When you are trying to change to `type = "video"`, what error are you getting? Have you also checked [this SO post](https://stackoverflow.com/questions/30436458/invalid-combination-of-search-filters-and-or-restrictions-for-youtube-data-api-v)? – MαπμQμαπkγVπ.0 Nov 07 '18 at 09:00
  • @MαπμQμαπkγVπ.0 Type='video' is required when I put 'forMine' in the query. To me, this looks like a generic error message Google set for unexpected parameters, instead of giving you the real error. – Joey.Lu Nov 07 '18 at 16:00

1 Answers1

0

I can confirm you that it is possible with the following workaround to be able to list unlisted videos from your YouTube channel. After getting them you can sort them by date as you were specifying. To retrieve the unlisted videos from your YouTube channel your just have to follow the following procedure using OAuth access and not API key.

I would recommend you to use this approach to retrieve all YouTube videos of a given YouTube channel. The approach consists in getting the uploads auto-created playlist id of the YouTube channel by using Channels: list with contentDetails in part and then use PlaylistItems: list to retrieve all public videos uploaded on this YouTube channel.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33