Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect sort order of videos in a channel #612

Open
Dikowda opened this issue Jun 5, 2019 · 8 comments
Open

Incorrect sort order of videos in a channel #612

Dikowda opened this issue Jun 5, 2019 · 8 comments

Comments

@Dikowda
Copy link

Dikowda commented Jun 5, 2019

For some Youtube channels the list of videos is not in chronological order. It's been bugging me for a while now and causes me to miss videos because they end up appearing on later pages.

A good example is JustKiddingNews channel. They past multiple videos per day (not sure if that has anything to do with it). With default, date or date added sort order, page 1 of the channel video list has missing videos compared to Youtube in a web browser. These videos appear on later pages.

Further information is here...
https://forum.kodi.tv/showthread.php?tid=325740&pid=2857221#pid2857221
...and has also been confirmed by forum user anxdpanic, quote - 'I can confirm this is happening, it appears to be a disparity between the public and private api.'

Notes:
This occurs when signed in (with my private keys) or signed out.
Originally found on version 6.4.0 and also 6.4.1.

@anxdpanic
Copy link
Collaborator

Thanks for opening the issue, I would like to have this resolved as well.

The api doesn't include a way to filter or request the playlist with sorting, so we can only sort the returned videos.

Atm the only reliable way to resolve this would be to request the whole Uploads playlist, which isn't reasonable, as you can imagine how large they can be.

I will post any progress made on the issue here.

@Dikowda
Copy link
Author

Dikowda commented Jun 6, 2019

I have done a few tests myself using API v3. Not sure whether this is what is used in the Kodi addon, but the request does allow the sort order to be defined.

GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCfPhyExfcaqJBKc3HO3cNBw&maxResults=50&order=date&key=[YOUR_API_KEY]

@anxdpanic
Copy link
Collaborator

Will look into using search hopefully this evening/tomorrow.

What we're currently using is https://developers.google.com/youtube/v3/docs/playlistItems/list with the channels Uploads playlist. Which should be the playlist that shows when you choose Videos for a channel on the website.

One down side is going to be the quota cost going from 5~7 points to 100 points. If it resolves the channel order I think it'll be worth the cost. May need to expose the Uploads playlist in some other way as well, since the search is limited to 500 results.

Note: Search results are constrained to a maximum of 500 videos if your request specifies a value for the channelId parameter and sets the type parameter value to video,...

@anxdpanic
Copy link
Collaborator

v6.5.0~alpha2 has the changes to use search and adds the Uploads playlist to channel playlists.
Installation - In-development
It seems to be better but is still not a 1:1

@Dikowda
Copy link
Author

Dikowda commented Jun 7, 2019

That's better. Thanks
Still the odd video that is not in order like https://www.youtube.com/watch?v=94Oqqzghsos. It was published 23/05/2019 but does not appear in the api results around that date. But it does appear on the channel page in a web browser in the correct place.

@anxdpanic
Copy link
Collaborator

Thanks for confirming it's improved.
Since it's still not 1:1, will leave this issue open for any future improvements

@Dikowda
Copy link
Author

Dikowda commented Jun 15, 2019

I notice that the channel list now includes live streams. This means you could remove the Live page on the channel page. Just a thought.

@Dikowda
Copy link
Author

Dikowda commented Jun 20, 2019

I have been plying and noticed that I get 1:1 results when published dates are used.
eg GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCfPhyExfcaqJBKc3HO3cNBw&maxResults=50&order=date&publishedAfter=2019-06-13T00:00:00Z&publishedBefore=2019-06-20T00:00:00Z&safeSearch=none&key=[YOUR_API_KEY]

The problem will be how to deal with the variable number of results in the app and the quota cost. Some channels would have 1 video per month and some 10 videos per day.
Maybe a 1 day search can be run multiple times working back from today's date/time until an array of results is filled. Then these are shown on a page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants