mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Add notice & warning that an anonymous or non-premium account may result to incomplete results with search (#288)
This commit is contained in:
parent
444dc65a29
commit
3b9fc52890
2 changed files with 9 additions and 0 deletions
|
|
@ -517,6 +517,10 @@ The `archive` command lets you download episodes with multiple audios and subtit
|
||||||
|
|
||||||
### Search
|
### 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**
|
**Supported urls/input**
|
||||||
|
|
||||||
- Single episode (with [episode filtering](#episode-filtering))
|
- Single episode (with [episode filtering](#episode-filtering))
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use anyhow::{bail, Result};
|
||||||
use crunchyroll_rs::common::StreamExt;
|
use crunchyroll_rs::common::StreamExt;
|
||||||
use crunchyroll_rs::search::QueryResults;
|
use crunchyroll_rs::search::QueryResults;
|
||||||
use crunchyroll_rs::{Episode, Locale, MediaCollection, MovieListing, MusicVideo, Series};
|
use crunchyroll_rs::{Episode, Locale, MediaCollection, MovieListing, MusicVideo, Series};
|
||||||
|
use log::warn;
|
||||||
|
|
||||||
#[derive(Debug, clap::Parser)]
|
#[derive(Debug, clap::Parser)]
|
||||||
#[clap(about = "Search in videos")]
|
#[clap(about = "Search in videos")]
|
||||||
|
|
@ -102,6 +103,10 @@ pub struct Search {
|
||||||
|
|
||||||
impl Execute for Search {
|
impl Execute for Search {
|
||||||
async fn execute(self, ctx: Context) -> Result<()> {
|
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() {
|
let input = if crunchyroll_rs::parse::parse_url(&self.input).is_some() {
|
||||||
match parse_url(&ctx.crunchy, self.input.clone(), true).await {
|
match parse_url(&ctx.crunchy, self.input.clone(), true).await {
|
||||||
Ok(ok) => vec![ok],
|
Ok(ok) => vec![ok],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue