How to set ordering settings for YouTube playlist - youtube-api

Ordering is no longer available natively:
After the new UI update, YouTube has following as the option:
Is there a way I can set ordering as manual?

Related

Is it possible to manage the Blocked Words list via a YouTube API?

As a YouTube Creator, in YouTube Studio under Settings -> Community there's a "Blocked Words" list which I can manage. The words that I block change daily, and I do this manually at the moment (this is related to blocking spoilers for games where the answer changes daily). Ideally, I would like to automatically update this list with a cron job, but I can't find if that is possible via any YouTube APIs.
So far, I've looked at the YouTube Data API reference and I think I've looked at every item but couldn't locate it, unless it's under some different name. The Channels: update endpoint seemed the most promising but I couldn't find it there.
Is it possible to update the Blocked Words list via a YouTube API? If it's not available through an API, is there any alternative solution that might work?

Localization in PlaylistItems YouTube API

I have an application that uses the YouTube API to display a list of playlists and videos from a particular YouTube Channel. The application supports multiple languages so I also used the localizations feature YouTube API offers and it works great with v3/videos and v3/playlists using the hl param, but the only problem I faced was with v3/playlistItems as it doesn't have support for localizations.
Please help me in adding localizations using v3/playlistItems so that all videos under a particular playlist displays localized title and description.
An ugly work around is to send two requests. First fetch the video-ids by using v3/playlistItems, then use v3/videos with the video-ids separated by comma, to get the translation with the available hl param.
There is currently no indicated way of doing this from the PlaylistItems docs. Try filing for a feature request here.

YouTube Data API (v3) search filters are broken

Note: I am using a YouTube Iframe from a webview inside a Chrome App.
This is what YouTube's API states:
videoSyndicated
The videoSyndicated parameter lets you to restrict a search to only
videos that can be played outside youtube.com. If you specify a value
for this parameter, you must also set the type parameter's value to
video.
videoLicense
The videoLicense parameter filters search results to only include
videos with a particular license. YouTube lets video uploaders choose
to attach either the Creative Commons license or the standard YouTube
license to each of their videos. If you specify a value for this
parameter, you must also set the type parameter's value to video.
videoEmbeddable
The videoEmbeddable parameter lets you to restrict a search to only
videos that can be embedded into a webpage. If you specify a value for
this parameter, you must also set the type parameter's value to video.
Even if I turn them all on, I still get error messages like
This video contains content from X
Example video: https://www.youtube.com/watch?v=TMSIR210mRg
Q: Why is this the case, and how do I ensure that the search results only include the videos that are playable from my website?
I realized it's not that the filters are broken, it's that the videos have domain-specific blacklists. For example, certain videos cannot be played from mobile devices or in my case, from a chrome app that has chrome-extension:// domain.
There is a separate check for copyright claims. The legal copyright holder of some content on the video ( usually the music ) has the legal right to restrict or block the embed on certain sites. This info is currently not available through the YouTube API.

Sorting youtube API, newest first

How to reverse this videos list?
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLYQWoSxgWOXMjtLQJIikS56pu7eJusSKW&maxResults=25&pageToken=CB4QAA&key=AIzaSyDEm5wGLsWi2G3WG40re-DAJcWioQSpJ6o
I need newest first! (by publishedAt sorting newest first)
Unfortunately this is not supported for playlistItems.
You could try reading in the entire playlist and doing the sort yourself.
You need to use the order parameter in your REST API call to fetch the video is some specific order. As mentioned in your question you need to fetch the data in sorted order where the published recently should be at the top. Hence you need to set the value of order to date in your REST API call. Other values that are supported, rating, relevance (by default), title, videoCount and ViewCount.
For additional details read the official documentation and also try the web service.
https://developers.google.com/youtube/2.0/developers_guide_protocol
Add orderby=time to your URL
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLYQWoSxgWOXMjtLQJIikS56pu7eJusSKW&maxResults=25&pageToken=CB4QAA&key=AIzaSyDEm5wGLsWi2G3WG40re-DAJcWioQSpJ6o&orderby=time

YouTube API v3 Order Parameter Possible Bug

Looking at the YouTube API v3 Search documentation, it states that the order parameter is used to control ordering of API response resource results. However, when attempting to order by date, I'm not receiving the results in reverse chronological order as specified. In fact, they are not in any order whatsoever.
API Request with order date using API Explorer UI:
Is there some other way I should be requesting for results to be ordered by the time they were published on YouTube? Is there a bug in the handling of the order API parameter?
There's no bug; the 'order' parameter will sort results based on when the resources were created, This value may be slightly different than when a video is published, as a resource is created when an upload begins but a video is published when the upload finishes and is processed.
In this case, it looks like the 10 or so most recent videos were all uploaded at the exact same time (YouTube.com has a batch uploader), so you're getting the order they were created in, even though the published dates reflect minor differences (maybe a couple took a bit longer to upload or something). IF you scan the full list of results, though, you'll see they play out just fine in terms of their reverse chronological order. And generally you probably won't have so many videos that were batch uploaded like this.

Resources