Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search command #217

Merged
merged 8 commits into from
Jun 19, 2023
Merged

Add search command #217

merged 8 commits into from
Jun 19, 2023

Conversation

bytedream
Copy link
Member

@bytedream bytedream commented Jun 19, 2023

This PR adds a search command. It is not as user friendly as the yt-dlp search (e.g. #70 (comment)) but has nearly the same functionality.

The search can be done in two ways:

  • By providing a url, just like you'd do to use download or archive
  • By providing a search term which then gets searched, just like the search bar on the Crunchyroll website

The search command is designed to show only the specific information you want. This is done with the -o/--output flag.
You can specify keywords in a specific pattern and they will get replaced in the output text. The required pattern for this begins with {{, then the keyword, and closes with }} (e.g. {{episode.title}}). For example, if you want to get the title of an episode, you can use Title {{episode.title}} and {{episode.title}} will be replaced with the episode title.

See the following list/code snippet for all keywords and their meaning:

/// series.title → Series title
/// series.description → Series description
///
/// season.title → Season title
/// season.description → Season description
/// season.number → Season number
///
/// episode.title → Episode title
/// episode.description → Episode description
/// episode.locale → Episode locale/language
/// episode.number → Episode number
/// episode.sequence_number → Episode number. This number is unique unlike `episode.number` which sometimes can be duplicated
///
/// movie_listing.title → Movie listing title
/// movie_listing.description → Movie listing description
///
/// movie.title → Movie title
/// movie.description → Movie description
///
/// music_video.title → Music video title
/// music_video.description → Music video description
///
/// concert.title → Concert title
/// concert.description → Concert description
///
/// stream.locale → Stream locale/language
/// stream.dash_url → Stream url in DASH format
/// stream.hls_url → Stream url in HLS format
///
/// subtitle.locale → Subtitle locale/language
/// subtitle.url → Subtitle url

Other flags

Besides output formatting there are also other flags to filter the output even more.

  • --audio - audio languages to include (can be specified multiple times)
  • --search-top-results-limit - limit of search results to parse
    • --search-series-limit - limit of series to search
    • --search-movie-listing-limit - limit of movies to search
    • --search-episode-limit - limit of episodes to search
    • --search-music-limit - limit of music to search

Examples

Get the stream url of the first Darling in the FranXX episode in English

$ crunchy search --audio en-US -o "{{stream.dash_url}}" https://www.crunchyroll.com/series/GY8VEQ95Y/darling-in-the-franxx[E1]

Get the English subtitles of the first Darling in the FranXX episode in English

$ crunchy search --audio en-US -o "{{subtitle.url}}" https://www.crunchyroll.com/series/GY8VEQ95Y/darling-in-the-franxx[E1]

Print all episodes of Darling in the FranXX with their season number, episode number, title and language in English and German

$ crunchy search --audio en-US --audio de-DE -o "S{{season.number}}E{{episode.number}} - {{episode.title}} ({{episode.locale}})" https://www.crunchyroll.com/series/GY8VEQ95Y/darling-in-the-franxx

This was linked to issues Jun 19, 2023
@bytedream bytedream marked this pull request as ready for review June 19, 2023 22:22
@bytedream bytedream merged commit f7af983 into master Jun 19, 2023
3 checks passed
@bytedream bytedream deleted the feature/search branch June 19, 2023 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Subtitle/Audio Only Request for CLI Search Command
1 participant