aw-cli 2.3__tar.gz → 2.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {aw_cli-2.3 → aw_cli-2.3.1}/PKG-INFO +1 -1
  2. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/providers/animeworld.py +3 -2
  3. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/providers/provider.py +19 -9
  4. aw_cli-2.3.1/uv.lock +773 -0
  5. aw_cli-2.3/uv.lock +0 -749
  6. {aw_cli-2.3 → aw_cli-2.3.1}/.github/workflows/python-publish.yml +0 -0
  7. {aw_cli-2.3 → aw_cli-2.3.1}/.github/workflows/release.yml +0 -0
  8. {aw_cli-2.3 → aw_cli-2.3.1}/.gitignore +0 -0
  9. {aw_cli-2.3 → aw_cli-2.3.1}/.pre-commit-config.yaml +0 -0
  10. {aw_cli-2.3 → aw_cli-2.3.1}/LICENSE +0 -0
  11. {aw_cli-2.3 → aw_cli-2.3.1}/README.md +0 -0
  12. {aw_cli-2.3 → aw_cli-2.3.1}/disclaimer.md +0 -0
  13. {aw_cli-2.3 → aw_cli-2.3.1}/pyproject.toml +0 -0
  14. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/__init__.py +0 -0
  15. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/anilist.py +0 -0
  16. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/anime.py +0 -0
  17. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/arg_parser.py +0 -0
  18. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/download.py +0 -0
  19. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/fzf/__init__.py +0 -0
  20. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/fzf/fzf.py +0 -0
  21. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/history.py +0 -0
  22. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/providers/__init__.py +0 -0
  23. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/providers/animeunity.py +0 -0
  24. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/providers/local.py +0 -0
  25. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/run.py +0 -0
  26. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/update.py +0 -0
  27. {aw_cli-2.3 → aw_cli-2.3.1}/src/aw_cli/utilities.py +0 -0
  28. {aw_cli-2.3 → aw_cli-2.3.1}/tests/__init__.py +0 -0
  29. {aw_cli-2.3 → aw_cli-2.3.1}/tests/empty +0 -0
  30. {aw_cli-2.3 → aw_cli-2.3.1}/tests/search_dragonball +0 -0
  31. {aw_cli-2.3 → aw_cli-2.3.1}/tests/search_onepiece +0 -0
  32. {aw_cli-2.3 → aw_cli-2.3.1}/tests/test_anime.py +0 -0
  33. {aw_cli-2.3 → aw_cli-2.3.1}/tests/test_fzf.py +0 -0
  34. {aw_cli-2.3 → aw_cli-2.3.1}/tests/test_history.py +0 -0
  35. {aw_cli-2.3 → aw_cli-2.3.1}/tests/test_rich_integration.py +0 -0
  36. {aw_cli-2.3 → aw_cli-2.3.1}/tests/test_run.py +0 -0
  37. {aw_cli-2.3 → aw_cli-2.3.1}/tests/theeminenceinshadowep13 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aw-cli
3
- Version: 2.3
3
+ Version: 2.3.1
4
4
  Summary: Guarda anime dal terminale e molto altro!
5
5
  License-Expression: GPL-3.0
6
6
  License-File: LICENSE
@@ -1,6 +1,7 @@
1
1
  from functools import lru_cache
2
2
  import re
3
3
  from html import unescape
4
+ from urllib.parse import quote_plus
4
5
  from ..anime import Anime, AnimeStatus
5
6
  from .provider import Provider, HTTPError
6
7
 
@@ -42,7 +43,7 @@ class Animeworld(Provider):
42
43
  match = re.search(r'(SecurityAW-\w+)=(.*) ;', response.text)
43
44
  if not match:
44
45
  raise HTTPError("Errore: Cookies non trovati")
45
- self.Client.cookies = {match.group(1): match.group(2)}
46
+ self.Client.cookies.set(match.group(1), match.group(2))
46
47
  response = self.Client.get(url)
47
48
 
48
49
  if response.status_code != 200 or "Errore 404" in response.text:
@@ -51,7 +52,7 @@ class Animeworld(Provider):
51
52
  return response.text
52
53
 
53
54
  def _search(self, input: str) -> list[Anime]:
54
- search_url = self.BASE_URL + "/search?keyword=" + input.replace(" ", "+")
55
+ search_url = self.BASE_URL + "/search?keyword=" + quote_plus(input)
55
56
  html = self._get_html(search_url)
56
57
  if re.search(r'<div class="alert alert-danger">', html):
57
58
  return []
@@ -1,5 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
- from httpx import Client, HTTPError #, AsyncClient
2
+ from httpx import Client, HTTPError # , AsyncClient
3
3
  from ..anime import Anime
4
4
  from .. import utilities as ut
5
5
 
@@ -8,6 +8,7 @@ def error_handler(relink=False):
8
8
  """
9
9
  Decoratore per gestire gli errori delle funzioni.
10
10
  """
11
+
11
12
  def decorator(func):
12
13
  def wrapper(self, *args, **kwargs):
13
14
  try:
@@ -15,11 +16,17 @@ def error_handler(relink=False):
15
16
  except Exception as e:
16
17
  if relink and isinstance(e, HTTPError):
17
18
  return update_link(self, func, *args, **kwargs)
18
- ut.console.print(f"Errore {e.__class__.__name__} durante {func.__name__}: {e}", style="error")
19
+ ut.console.print(
20
+ f"Errore {e.__class__.__name__} durante {func.__name__}: {e}",
21
+ style="error",
22
+ )
19
23
  return None
24
+
20
25
  return wrapper
26
+
21
27
  return decorator
22
28
 
29
+
23
30
  def update_link(self, callback, anime: Anime, episode: Anime.Episode | None = None):
24
31
  """
25
32
  Gestisce il caso in cui il riferimento dell'anime o all'episodio non è più valido
@@ -30,9 +37,11 @@ def update_link(self, callback, anime: Anime, episode: Anime.Episode | None = No
30
37
  return callback(self, anime, anime.episode(episode.num))
31
38
  else:
32
39
  ut.console.print("Il link dell'anime è stato cambiato", style="warning")
33
- res: list[Anime] = self.search(anime.name)
34
- if len(res) == 0:
35
- raise LookupError(f"Nessun risultato trovato per {anime.name} su {self.__class__.__name__}")
40
+ res: list[Anime] | None = self.search(anime.name)
41
+ if not res:
42
+ raise LookupError(
43
+ f"Errore o nessun risultato durante la ricerca di {anime.name} su {self.__class__.__name__}"
44
+ )
36
45
  anime.ref = res[0].ref
37
46
  return callback(self, anime)
38
47
 
@@ -45,6 +54,7 @@ class Provider(ABC):
45
54
  _url (str): l'url del sito del provider.
46
55
  _headers (dict): gli headers da utilizzare per le richieste HTTP.
47
56
  """
57
+
48
58
  def __init__(self, url: str):
49
59
  """
50
60
  Costruisce un'instanza di Provider.
@@ -55,10 +65,11 @@ class Provider(ABC):
55
65
  self.BASE_URL = url
56
66
  self.Client = Client(
57
67
  headers={
58
- 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
68
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
69
+ "Connection": "close"
59
70
  },
60
71
  follow_redirects=True,
61
- timeout=10
72
+ timeout=10,
62
73
  )
63
74
 
64
75
  @error_handler(relink=False)
@@ -131,8 +142,7 @@ class Provider(ABC):
131
142
  anime (Anime): l'anime di riferimento.
132
143
  """
133
144
  anime.update_episodes(
134
- self._episodes(anime),
135
- ut.config_data["general"]["specials"]
145
+ self._episodes(anime), ut.config_data["general"]["specials"]
136
146
  )
137
147
 
138
148
  @abstractmethod