Introduction
Introduction Statistics Contact Development Disclaimer Help
youtube/cli: add "-c channelid" option to list channel videos - frontends - fro…
Log
Files
Refs
README
LICENSE
---
commit 6623393565f6397c68240f8b77b8f05b87ad9f18
parent ea04b0e0744e1b41f06f4f85effc29ea48eef37c
Author: Hiltjo Posthuma <[email protected]>
Date: Sun, 19 Feb 2023 14:40:44 +0100
youtube/cli: add "-c channelid" option to list channel videos
Diffstat:
M youtube/cli.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/youtube/cli.c b/youtube/cli.c
@@ -114,7 +114,7 @@ render(struct search_response *r)
static void
usage(const char *argv0)
{
- fprintf(stderr, "usage: %s <keywords>\n", argv0);
+ fprintf(stderr, "usage: %s <keyword> | <-c channelid>\n", argv0);
exit(1);
}
@@ -139,10 +139,15 @@ main(int argc, char *argv[])
if (argc < 2 || !argv[1][0])
usage(argv[0]);
- if (!uriencode(argv[1], search, sizeof(search)))
- usage(argv[0]);
-
- r = youtube_search(search, "", "relevance");
+ if (!strcmp(argv[1], "-c")) {
+ if (argc < 3)
+ usage(argv[0]);
+ r = youtube_channel_videos(argv[2]);
+ } else {
+ if (!uriencode(argv[1], search, sizeof(search)))
+ usage(argv[0]);
+ r = youtube_search(search, "", "relevance");
+ }
if (!r || r->nitems == 0) {
OUT("No videos found\n");
exit(1);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.