youtube: fix sorting - frontends - front-ends for some sites (experiment)
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit a94eeabf90a0a793d8da134d8798d44eb8d7ba10
(DIR) parent 1ed634d2500469ba288a12b6f0ae917a6b45734c
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 21 Sep 2021 18:00:03 +0200
youtube: fix sorting
The old parameters are not supported anymore by Youtube for a while now.
Diffstat:
M youtube/youtube.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/youtube/youtube.c b/youtube/youtube.c
@@ -28,21 +28,21 @@ request_search(const char *s, const char *page, const char *order)
snprintf(path, sizeof(path), "/results?search_query=%s", s);
+ /* NOTE: pagination doesn't work at the moment:
+ this parameter is not supported anymore by Youtube */
if (page[0]) {
strlcat(path, "&page=", sizeof(path));
strlcat(path, page, sizeof(path));
}
- if (order[0]) {
- strlcat(path, "&search_sort=", sizeof(path));
+ if (order[0] && strcmp(order, "relevance")) {
+ strlcat(path, "&sp=", sizeof(path));
if (!strcmp(order, "date"))
- strlcat(path, "video_date_uploaded", sizeof(path));
- else if (!strcmp(order, "relevance"))
- strlcat(path, "video_relevance", sizeof(path));
+ strlcat(path, "CAI%3D", sizeof(path));
else if (!strcmp(order, "views"))
- strlcat(path, "video_view_count", sizeof(path));
+ strlcat(path, "CAM%3D", sizeof(path));
else if (!strcmp(order, "rating"))
- strlcat(path, "video_avg_rating", sizeof(path));
+ strlcat(path, "CAE%3D", sizeof(path));
}
/* check if request is too long (truncation) */