From 3b9fc5289066b696565c52e1f14209c583ea8664 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 28 Jan 2024 01:03:39 +0100 Subject: [PATCH] Add notice & warning that an anonymous or non-premium account may result to incomplete results with `search` (#288) --- README.md | 4 ++++ crunchy-cli-core/src/search/command.rs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index be97bec..f088fd7 100644 --- a/README.md +++ b/README.md @@ -517,6 +517,10 @@ The `archive` command lets you download episodes with multiple audios and subtit ### Search +The `search` command is a powerful tool to query the Crunchyroll library. +It behaves like the regular search on the website but is able to further process the results and return everything it can find, from the series title down to the raw stream url. +_Using this command with the `--anonymous` flag or a non-premium account may return incomplete results._ + **Supported urls/input** - Single episode (with [episode filtering](#episode-filtering)) diff --git a/crunchy-cli-core/src/search/command.rs b/crunchy-cli-core/src/search/command.rs index c357ab4..3d03d28 100644 --- a/crunchy-cli-core/src/search/command.rs +++ b/crunchy-cli-core/src/search/command.rs @@ -7,6 +7,7 @@ use anyhow::{bail, Result}; use crunchyroll_rs::common::StreamExt; use crunchyroll_rs::search::QueryResults; use crunchyroll_rs::{Episode, Locale, MediaCollection, MovieListing, MusicVideo, Series}; +use log::warn; #[derive(Debug, clap::Parser)] #[clap(about = "Search in videos")] @@ -102,6 +103,10 @@ pub struct Search { impl Execute for Search { async fn execute(self, ctx: Context) -> Result<()> { + if !ctx.crunchy.premium() { + warn!("Using `search` anonymously or with a non-premium account may return incomplete results") + } + let input = if crunchyroll_rs::parse::parse_url(&self.input).is_some() { match parse_url(&ctx.crunchy, self.input.clone(), true).await { Ok(ok) => vec![ok],