youtube: cgi: add sort option for rating - frontends - front-ends for some site… | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 6f3fa93b7099d8bf5df5ba3fc04958aedd1bb099 | |
parent 806c9596bc3cf06561007bb8c202053123302859 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Wed, 2 Sep 2020 17:47:41 +0200 | |
youtube: cgi: add sort option for rating | |
Diffstat: | |
M youtube/cgi.c | 4 +++- | |
M youtube/youtube.c | 2 ++ | |
2 files changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/youtube/cgi.c b/youtube/cgi.c | |
@@ -37,7 +37,8 @@ parsecgi(void) | |
if (decodeparam(order, sizeof(order), p) == -1 || | |
(strcmp(order, "date") && | |
strcmp(order, "relevance") && | |
- strcmp(order, "views"))) | |
+ strcmp(order, "views") && | |
+ strcmp(order, "rating"))) | |
order[0] = '\0'; | |
} | |
if (!order[0]) | |
@@ -113,6 +114,7 @@ render(struct search_response *r) | |
printf(" <option value=\"date\"%s>Creation date… | |
printf(" <option value=\"relevance\"%s>Relevanc… | |
printf(" <option value=\"views\"%s>Views</optio… | |
+ printf(" <option value=\"rating\"%s>Rating</opt… | |
OUT( | |
" </select>\n" | |
" </td>\n" | |
diff --git a/youtube/youtube.c b/youtube/youtube.c | |
@@ -272,6 +272,8 @@ request_search(const char *s, const char *page, const char … | |
strlcat(path, "video_relevance", sizeof(path)); | |
else if (!strcmp(order, "views")) | |
strlcat(path, "video_view_count", sizeof(path)); | |
+ else if (!strcmp(order, "rating")) | |
+ strlcat(path, "video_avg_rating", sizeof(path)); | |
} | |
/* force older youtube layout, else youtube will try to randomly serve |