mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-01-03 16:27:38 -08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d2cf7ed66 | ||
|
|
aa6dc2b98e | ||
|
|
2e5cde3365 | ||
|
|
d75a03e594 |
28
README.md
28
README.md
@@ -350,13 +350,18 @@ fastanime download -t <anime-title> -t <anime-title> -r '-5'
|
|||||||
|
|
||||||
# Download specific episode range
|
# Download specific episode range
|
||||||
# be sure to observe the range Syntax
|
# be sure to observe the range Syntax
|
||||||
fastanime download <anime-title> -r '<episodes-start>:<episodes-end>:<step>'
|
fastanime download -t <anime-title> -r '<episodes-start>:<episodes-end>:<step>'
|
||||||
|
|
||||||
fastanime download <anime-title> -r '<episodes-start>:<episodes-end>'
|
fastanime download -t <anime-title> -r '<episodes-start>:<episodes-end>'
|
||||||
|
|
||||||
fastanime download <anime-title> -r '<episodes-start>:'
|
fastanime download -t <anime-title> -r '<episodes-start>:'
|
||||||
|
|
||||||
|
fastanime download -t <anime-title> -r ':<episodes-end>'
|
||||||
|
|
||||||
|
# download specific episode
|
||||||
|
# remember python indexing starts at 0
|
||||||
|
fastanime download -t <anime-title> -r '<episode-1>:<episode>'
|
||||||
|
|
||||||
fastanime download <anime-title> -r ':<episodes-end>'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### search subcommand
|
#### search subcommand
|
||||||
@@ -404,7 +409,8 @@ Uses a list slicing syntax similar to that of python as the value of the `-r` op
|
|||||||
**Syntax:**
|
**Syntax:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# print all available episodes
|
# --- print anime info + episode streams ---
|
||||||
|
|
||||||
# multiple titles can be specified with the -t option
|
# multiple titles can be specified with the -t option
|
||||||
fastanime grab -t <anime-title> -t <anime-title>
|
fastanime grab -t <anime-title> -t <anime-title>
|
||||||
|
|
||||||
@@ -425,6 +431,18 @@ fastanime grab -t <anime-title> -r '<start>:<stop>:<step>'
|
|||||||
fastanime grab -t <anime-title> -r '<start>:'
|
fastanime grab -t <anime-title> -r '<start>:'
|
||||||
|
|
||||||
fastanime grab -t <anime-title> -r ':<end>'
|
fastanime grab -t <anime-title> -r ':<end>'
|
||||||
|
|
||||||
|
# --- grab options ---
|
||||||
|
|
||||||
|
# print search results only
|
||||||
|
fastanime grab -t <anime-title> -r <range> --search-results-only
|
||||||
|
|
||||||
|
# print anime info only
|
||||||
|
fastanime grab -t <anime-title> -r <range> --anime-info-only
|
||||||
|
|
||||||
|
# print episode streams only
|
||||||
|
fastanime grab -t <anime-title> -r <range> --episode-streams-only
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### downloads subcommand
|
#### downloads subcommand
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ if sys.version_info < (3, 10):
|
|||||||
) # noqa: F541
|
) # noqa: F541
|
||||||
|
|
||||||
|
|
||||||
__version__ = "v2.2.3"
|
__version__ = "v2.2.4"
|
||||||
|
|
||||||
APP_NAME = "FastAnime"
|
APP_NAME = "FastAnime"
|
||||||
AUTHOR = "Benex254"
|
AUTHOR = "Benex254"
|
||||||
|
|||||||
@@ -26,11 +26,29 @@ if TYPE_CHECKING:
|
|||||||
"-r",
|
"-r",
|
||||||
help="A range of episodes to download (start-end)",
|
help="A range of episodes to download (start-end)",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--search-results-only",
|
||||||
|
"-s",
|
||||||
|
help="print only the search results to stdout",
|
||||||
|
is_flag=True,
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--anime-info-only", "-i", help="print only selected anime title info", is_flag=True
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--episode-streams-only",
|
||||||
|
"-e",
|
||||||
|
help="print only selected anime episodes streams of given range",
|
||||||
|
is_flag=True,
|
||||||
|
)
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def grab(
|
def grab(
|
||||||
config: "Config",
|
config: "Config",
|
||||||
anime_titles: tuple,
|
anime_titles: tuple,
|
||||||
episode_range,
|
episode_range,
|
||||||
|
search_results_only,
|
||||||
|
anime_info_only,
|
||||||
|
episode_streams_only,
|
||||||
):
|
):
|
||||||
import json
|
import json
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
@@ -52,6 +70,11 @@ def grab(
|
|||||||
)
|
)
|
||||||
if not search_results:
|
if not search_results:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
if search_results_only:
|
||||||
|
# grab only search results skipping all lines after this
|
||||||
|
grabbed_animes.append(search_results)
|
||||||
|
continue
|
||||||
|
|
||||||
search_results = search_results["results"]
|
search_results = search_results["results"]
|
||||||
search_results_ = {
|
search_results_ = {
|
||||||
search_result["title"]: search_result for search_result in search_results
|
search_result["title"]: search_result for search_result in search_results
|
||||||
@@ -68,6 +91,11 @@ def grab(
|
|||||||
episodes = sorted(
|
episodes = sorted(
|
||||||
anime["availableEpisodesDetail"][config.translation_type], key=float
|
anime["availableEpisodesDetail"][config.translation_type], key=float
|
||||||
)
|
)
|
||||||
|
if anime_info_only:
|
||||||
|
# grab only the anime data skipping all lines after this
|
||||||
|
grabbed_animes.append(anime)
|
||||||
|
continue
|
||||||
|
|
||||||
# where the magic happens
|
# where the magic happens
|
||||||
if episode_range:
|
if episode_range:
|
||||||
if ":" in episode_range:
|
if ":" in episode_range:
|
||||||
@@ -94,10 +122,14 @@ def grab(
|
|||||||
else:
|
else:
|
||||||
episodes_range = sorted(episodes, key=float)
|
episodes_range = sorted(episodes, key=float)
|
||||||
|
|
||||||
grabbed_anime = dict(anime)
|
if not episode_streams_only:
|
||||||
grabbed_anime["requested_episodes"] = episodes_range
|
grabbed_anime = dict(anime)
|
||||||
grabbed_anime["translation_type"] = config.translation_type
|
grabbed_anime["requested_episodes"] = episodes_range
|
||||||
grabbed_anime["episodes_streams"] = {}
|
grabbed_anime["translation_type"] = config.translation_type
|
||||||
|
grabbed_anime["episodes_streams"] = {}
|
||||||
|
else:
|
||||||
|
grabbed_anime = {}
|
||||||
|
|
||||||
# lets download em
|
# lets download em
|
||||||
for episode in episodes_range:
|
for episode in episodes_range:
|
||||||
try:
|
try:
|
||||||
@@ -108,14 +140,23 @@ def grab(
|
|||||||
)
|
)
|
||||||
if not streams:
|
if not streams:
|
||||||
continue
|
continue
|
||||||
grabbed_anime["episodes_streams"][episode] = {
|
episode_streams = {server["server"]: server for server in streams}
|
||||||
server["server"]: server for server in streams
|
|
||||||
}
|
if episode_streams_only:
|
||||||
|
grabbed_anime[episode] = episode_streams
|
||||||
|
else:
|
||||||
|
grabbed_anime["episodes_streams"][
|
||||||
|
episode
|
||||||
|
] = episode_streams # pyright:ignore
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
|
# grab the full data for single title and appen to final result or episode streams
|
||||||
grabbed_animes.append(grabbed_anime)
|
grabbed_animes.append(grabbed_anime)
|
||||||
if len(grabbed_animes) == 1:
|
|
||||||
print(json.dumps(grabbed_animes[0]))
|
# print out the final result either {} or [] depending if more than one title os requested
|
||||||
else:
|
if len(grabbed_animes) == 1:
|
||||||
print(json.dumps(grabbed_animes))
|
print(json.dumps(grabbed_animes[0]))
|
||||||
|
else:
|
||||||
|
print(json.dumps(grabbed_animes))
|
||||||
|
|||||||
@@ -183,8 +183,7 @@ class AnimePaheApi(AnimeProvider):
|
|||||||
|
|
||||||
# get the episode title
|
# get the episode title
|
||||||
episode_title = (
|
episode_title = (
|
||||||
episode["title"] + f"; {episode['episode']}"
|
f"{episode["title"] or anime['title']}; Episode {episode['episode']}"
|
||||||
or f"{anime['title']}; Episode {episode['episode']}"
|
|
||||||
)
|
)
|
||||||
# get all links
|
# get all links
|
||||||
streams = {
|
streams = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "fastanime"
|
name = "fastanime"
|
||||||
version = "2.2.3"
|
version = "2.2.4"
|
||||||
description = "A browser anime site experience from the terminal"
|
description = "A browser anime site experience from the terminal"
|
||||||
authors = ["Benextempest <benextempest@gmail.com>"]
|
authors = ["Benextempest <benextempest@gmail.com>"]
|
||||||
license = "UNLICENSE"
|
license = "UNLICENSE"
|
||||||
|
|||||||
Reference in New Issue
Block a user