invidious icon indicating copy to clipboard operation
invidious copied to clipboard

[Bug] sort_by=upload_date does not work

Open greenfoo opened this issue 1 year ago • 5 comments

Calling the search endpoint with sort_by=upload_date does not return the results ordered by upload date.

Examples:

  • https://watch.thekitty.zone/api/v1/search/?q=Real+Madrid&sort_by=upload_date
  • https://invidious.snopyta.org/api/v1/search/?q=Real+Madrid&sort_by=upload_date

I would expect (maybe I'm wrong?) for the results to be sorted according to the "published" property so that they match the order returned by this equivalent YouTube search:

  • https://www.youtube.com/results?search_query=real+madrid&sp=CAI%253D

But #2824 is similar, but not the same, as there is no colon in any of the parameters.

greenfoo avatar Apr 11 '23 18:04 greenfoo

I just noticed that this seems to be a more general problem with sort_by:

  • sort_by=upload_date and sort_by=view_count do not return results in the expected order.
  • sort_by=rating and sort_by=relevance might or might not work, as I don't know which returned field to check... but in any case they return results in the same order (which is also the same order returned by upload_date and view_count).

In other words... it looks like the sort_by has no effect, no matter the argument used.

Either I'm doing something wrong (quite posible!) or there is a bug or the documentation needs to be updated to remove that parameter if no longer supported. Does this make sense?

greenfoo avatar Apr 11 '23 18:04 greenfoo

Same issue here, sort_by: upload_date doesn't actually sort by date, but private browser window search by upload_date gives different ordered results than normal search so it seems to be a bug with invidious

update: I was looking through the code, it seems the doc is just wrong, param is just sort not sort_by and value is date and not upload_date.

Everything works. I think the issue can be closed, maybe update the doc.

DrSocket avatar Apr 17 '23 19:04 DrSocket

sort=date and sort=views seem to be used instead.

@SamantazFox should the api docs be updated or should the code be updated to support both? The parameter name (sort_by => sort) and some of the values (upload_date => date, view_count => views) in the api docs don't match what is used in Invidious

ChunkyProgrammer avatar Apr 20 '23 13:04 ChunkyProgrammer

This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.

github-actions[bot] avatar Apr 20 '24 01:04 github-actions[bot]

PR is still open in the docs repo so this can stay open

ChunkyProgrammer avatar Apr 20 '24 01:04 ChunkyProgrammer