StreamingCommunity 2.9.5__py3-none-any.whl → 2.9.6__py3-none-any.whl

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.

Potentially problematic release.


This version of StreamingCommunity might be problematic. Click here for more details.

Files changed (34) hide show
  1. StreamingCommunity/Api/Player/sweetpixel.py +49 -0
  2. StreamingCommunity/Api/Site/1337xx/site.py +3 -3
  3. StreamingCommunity/Api/Site/1337xx/title.py +4 -6
  4. StreamingCommunity/Api/Site/altadefinizione/film.py +1 -1
  5. StreamingCommunity/Api/Site/altadefinizione/series.py +1 -2
  6. StreamingCommunity/Api/Site/altadefinizione/site.py +3 -3
  7. StreamingCommunity/Api/Site/animeunity/film_serie.py +3 -4
  8. StreamingCommunity/Api/Site/animeunity/site.py +4 -4
  9. StreamingCommunity/Api/Site/animeworld/__init__.py +71 -0
  10. StreamingCommunity/Api/Site/animeworld/serie.py +107 -0
  11. StreamingCommunity/Api/Site/animeworld/site.py +111 -0
  12. StreamingCommunity/Api/Site/animeworld/util/ScrapeSerie.py +79 -0
  13. StreamingCommunity/Api/Site/cb01new/film.py +1 -1
  14. StreamingCommunity/Api/Site/cb01new/site.py +3 -3
  15. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +2 -2
  16. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +3 -3
  17. StreamingCommunity/Api/Site/guardaserie/series.py +1 -1
  18. StreamingCommunity/Api/Site/guardaserie/site.py +3 -3
  19. StreamingCommunity/Api/Site/mostraguarda/film.py +1 -1
  20. StreamingCommunity/Api/Site/streamingcommunity/film.py +1 -1
  21. StreamingCommunity/Api/Site/streamingcommunity/series.py +1 -2
  22. StreamingCommunity/Api/Site/streamingcommunity/site.py +3 -3
  23. StreamingCommunity/Lib/Downloader/HLS/segments.py +1 -3
  24. StreamingCommunity/Lib/Downloader/TOR/downloader.py +397 -227
  25. StreamingCommunity/Lib/FFmpeg/util.py +12 -0
  26. StreamingCommunity/Lib/M3U8/estimator.py +5 -8
  27. StreamingCommunity/Upload/version.py +1 -1
  28. StreamingCommunity/run.py +12 -2
  29. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info}/METADATA +4 -6
  30. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info}/RECORD +34 -29
  31. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info}/WHEEL +1 -1
  32. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info}/entry_points.txt +0 -0
  33. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info/licenses}/LICENSE +0 -0
  34. {streamingcommunity-2.9.5.dist-info → streamingcommunity-2.9.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,49 @@
1
+ # 21.03.25
2
+
3
+ import logging
4
+
5
+
6
+ # External libraries
7
+ import httpx
8
+
9
+
10
+ # Internal utilities
11
+ from StreamingCommunity.Util.config_json import config_manager
12
+ from StreamingCommunity.Util.headers import get_userAgent
13
+
14
+
15
+ # Variable
16
+ MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
17
+
18
+
19
+ class AnimeWorldPlayer:
20
+ def __init__(self, full_url, episode_data, session_id, csrf_token):
21
+ """Initialize the AnimeWorldPlayer with session details, episode data, and URL."""
22
+ self.session_id = session_id
23
+ self.csrf_token = csrf_token
24
+ self.episode_data = episode_data
25
+ self.number = episode_data['number']
26
+ self.link = episode_data['link']
27
+
28
+ # Create an HTTP client with session cookies, headers, and base URL.
29
+ self.client = httpx.Client(
30
+ cookies={"sessionId": session_id},
31
+ headers={"User-Agent": get_userAgent(), "csrf-token": csrf_token},
32
+ base_url=full_url,
33
+ timeout=MAX_TIMEOUT
34
+ )
35
+
36
+ def get_download_link(self):
37
+ """Fetch the download link from AnimeWorld using the episode link."""
38
+ try:
39
+ # Make a POST request to the episode link and follow any redirects
40
+ res = self.client.post(self.link, follow_redirects=True)
41
+ data = res.json()
42
+
43
+ # Extract the first available server link and return it after modifying the URL
44
+ server_link = data["links"]["9"][list(data["links"]["9"].keys())[0]]["link"]
45
+ return server_link.replace('download-file.php?id=', '')
46
+
47
+ except Exception as e:
48
+ logging.error(f"Error in new API system: {e}")
49
+ return None
@@ -26,12 +26,12 @@ table_show_manager = TVShowManager()
26
26
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
27
27
 
28
28
 
29
- def title_search(word_to_search: str) -> int:
29
+ def title_search(query: str) -> int:
30
30
  """
31
31
  Search for titles based on a search query.
32
32
 
33
33
  Parameters:
34
- - title_search (str): The title to search for.
34
+ - query (str): The query to search for.
35
35
 
36
36
  Returns:
37
37
  - int: The number of titles found.
@@ -39,7 +39,7 @@ def title_search(word_to_search: str) -> int:
39
39
  media_search_manager.clear()
40
40
  table_show_manager.clear()
41
41
 
42
- search_url = f"{site_constant.FULL_URL}/search/{word_to_search}/1/"
42
+ search_url = f"{site_constant.FULL_URL}/search/{query}/1/"
43
43
  console.print(f"[cyan]Search url: [yellow]{search_url}")
44
44
 
45
45
  try:
@@ -33,9 +33,8 @@ def download_title(select_title: MediaItem):
33
33
  - select_title (MediaItem): The media item to be downloaded. This should be an instance of the MediaItem class, containing attributes like `name` and `url`.
34
34
  """
35
35
  start_message()
36
- console.print(f"[yellow]Download: [red]{select_title.name} \n")
37
- print()
38
-
36
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
37
+
39
38
  # Define output path
40
39
  title_name = os_manager.get_sanitize_file(select_title.name)
41
40
  mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
@@ -58,6 +57,5 @@ def download_title(select_title: MediaItem):
58
57
 
59
58
  # Tor manager
60
59
  manager = TOR_downloader()
61
- manager.add_magnet_link(final_url)
62
- manager.start_download()
63
- manager.move_downloaded_files(mp4_path)
60
+ manager.add_magnet_link(final_url, save_path=mp4_path)
61
+ manager.start_download()
@@ -56,7 +56,7 @@ def download_film(select_title: MediaItem) -> str:
56
56
  TelegramSession.updateScriptId(script_id, select_title.name)
57
57
 
58
58
  start_message()
59
- console.print(f"[yellow]Download: [red]{select_title.name} \n")
59
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
60
60
 
61
61
  # Extract mostraguarda link
62
62
  try:
@@ -55,8 +55,7 @@ def download_video(index_season_selected: int, index_episode_selected: int, scra
55
55
 
56
56
  # Get info about episode
57
57
  obj_episode = scrape_serie.seasons_manager.get_season_by_number(int(index_season_selected)).episodes.get(index_episode_selected-1)
58
- console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.name}")
59
- print()
58
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [bold magenta]{obj_episode.name}[/bold magenta] ([cyan]S{index_season_selected}E{index_episode_selected}[/cyan]) \n")
60
59
 
61
60
  if site_constant.TELEGRAM_BOT:
62
61
  bot = get_bot_instance()
@@ -26,12 +26,12 @@ table_show_manager = TVShowManager()
26
26
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
27
27
 
28
28
 
29
- def title_search(title_search: str) -> int:
29
+ def title_search(query: str) -> int:
30
30
  """
31
31
  Search for titles based on a search query.
32
32
 
33
33
  Parameters:
34
- - title_search (str): The title to search for.
34
+ - query (str): The query to search for.
35
35
 
36
36
  Returns:
37
37
  int: The number of titles found.
@@ -42,7 +42,7 @@ def title_search(title_search: str) -> int:
42
42
  media_search_manager.clear()
43
43
  table_show_manager.clear()
44
44
 
45
- search_url = f"{site_constant.FULL_URL}/?story={title_search}&do=search&subaction=search"
45
+ search_url = f"{site_constant.FULL_URL}/?story={query}&do=search&subaction=search"
46
46
  console.print(f"[cyan]Search url: [yellow]{search_url}")
47
47
 
48
48
  try:
@@ -55,8 +55,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
55
55
  if obj_episode is not None:
56
56
 
57
57
  start_message()
58
- console.print(f"[yellow]Download: [red]EP_{obj_episode.number} \n")
59
- console.print("[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
58
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] ([cyan]E{obj_episode.number}[/cyan]) \n")
60
59
 
61
60
  if site_constant.TELEGRAM_BOT:
62
61
  bot.send_message(f"Download in corso:\nTitolo:{scrape_serie.series_name}\nEpisodio: {obj_episode.number}", None)
@@ -70,7 +69,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
70
69
  video_source.get_embed(obj_episode.id)
71
70
 
72
71
  # Create output path
73
- title_name = f"{scrape_serie.series_name}_EP_{dynamic_format_number(str(obj_episode.number))}.mp4"
72
+ mp4_name = f"{scrape_serie.series_name}_EP_{dynamic_format_number(str(obj_episode.number))}.mp4"
74
73
 
75
74
  if scrape_serie.is_series:
76
75
  mp4_path = os_manager.get_sanitize_path(os.path.join(site_constant.ANIME_FOLDER, scrape_serie.series_name))
@@ -84,7 +83,7 @@ def download_episode(index_select: int, scrape_serie: ScrapeSerieAnime, video_so
84
83
  # Start downloading
85
84
  path, kill_handler = MP4_downloader(
86
85
  url=str(video_source.src_mp4).strip(),
87
- path=os.path.join(mp4_path, title_name)
86
+ path=os.path.join(mp4_path, mp4_name)
88
87
  )
89
88
 
90
89
  return path, kill_handler
@@ -83,12 +83,12 @@ def get_real_title(record):
83
83
  return record['title_it']
84
84
 
85
85
 
86
- def title_search(title: str) -> int:
86
+ def title_search(query: str) -> int:
87
87
  """
88
- Function to perform an anime search using a provided title.
88
+ Function to perform an anime search using a provided query.
89
89
 
90
90
  Parameters:
91
- - title_search (str): The title to search for.
91
+ - query (str): The query to search for.
92
92
 
93
93
  Returns:
94
94
  - int: A number containing the length of media search manager.
@@ -106,7 +106,7 @@ def title_search(title: str) -> int:
106
106
  'user-agent': get_userAgent(),
107
107
  'x-csrf-token': data.get('csrf_token')
108
108
  }
109
- json_data = {'title': title}
109
+ json_data = {'title': query}
110
110
 
111
111
  # Send a POST request to the API endpoint for live search
112
112
  try:
@@ -0,0 +1,71 @@
1
+ # 21.03.25
2
+
3
+ # External library
4
+ from rich.console import Console
5
+ from rich.prompt import Prompt
6
+
7
+
8
+ # Internal utilities
9
+ from StreamingCommunity.Api.Template import get_select_title
10
+ from StreamingCommunity.Api.Template.config_loader import site_constant
11
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
12
+
13
+
14
+ # Logic class
15
+ from .site import title_search, media_search_manager, table_show_manager
16
+ from .serie import download_series
17
+
18
+
19
+ # Variable
20
+ indice = 8
21
+ _useFor = "anime"
22
+ _deprecate = False
23
+ _priority = 2
24
+ _engineDownload = "mp4"
25
+
26
+ msg = Prompt()
27
+ console = Console()
28
+
29
+
30
+
31
+ def process_search_result(select_title):
32
+ """
33
+ Handles the search result and initiates the download for either a film or series.
34
+ """
35
+ if select_title.type == "TV":
36
+ download_series(select_title)
37
+
38
+ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_item: dict = None):
39
+ """
40
+ Main function of the application for search film, series and anime.
41
+
42
+ Parameters:
43
+ string_to_search (str, optional): String to search for
44
+ get_onlyDatabase (bool, optional): If True, return only the database object
45
+ direct_item (dict, optional): Direct item to process (bypass search)
46
+ """
47
+ if direct_item:
48
+ select_title = MediaItem(**direct_item)
49
+ process_search_result(select_title)
50
+ return
51
+
52
+ # Get the user input for the search term
53
+ string_to_search = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
54
+
55
+ # Perform the database search
56
+ len_database = title_search(string_to_search)
57
+
58
+ ##If only the database is needed, return the manager
59
+ if get_onlyDatabase:
60
+ return media_search_manager
61
+
62
+ if len_database > 0:
63
+ select_title = get_select_title(table_show_manager, media_search_manager)
64
+ process_search_result(select_title)
65
+
66
+ else:
67
+ console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
68
+
69
+ # If no results are found, ask again
70
+ string_to_search = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
71
+ search()
@@ -0,0 +1,107 @@
1
+ # 11.03.24
2
+
3
+ import os
4
+ import logging
5
+ from typing import Tuple
6
+
7
+
8
+ # External library
9
+ from rich.console import Console
10
+ from rich.prompt import Prompt
11
+
12
+
13
+ # Internal utilities
14
+ from StreamingCommunity.Util.os import os_manager
15
+ from StreamingCommunity.Util.message import start_message
16
+ from StreamingCommunity.Lib.Downloader import MP4_downloader
17
+
18
+
19
+ # Logic class
20
+ from .util.ScrapeSerie import ScrapSerie
21
+ from StreamingCommunity.Api.Template.config_loader import site_constant
22
+ from StreamingCommunity.Api.Template.Util import manage_selection, dynamic_format_number, map_episode_title
23
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
24
+
25
+
26
+ # Player
27
+ from StreamingCommunity.Api.Player.sweetpixel import AnimeWorldPlayer
28
+
29
+
30
+ # Variable
31
+ console = Console()
32
+ msg = Prompt()
33
+ KILL_HANDLER = bool(False)
34
+
35
+
36
+
37
+ def download_episode(index_select: int, scrape_serie: ScrapSerie, episodes) -> Tuple[str,bool]:
38
+ """
39
+ Downloads the selected episode.
40
+
41
+ Parameters:
42
+ - index_select (int): Index of the episode to download.
43
+
44
+ Return:
45
+ - str: output path
46
+ - bool: kill handler status
47
+ """
48
+ start_message()
49
+
50
+ # Get information about the selected episode
51
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] ([cyan]E{index_select+1}[/cyan]) \n")
52
+
53
+ # Define filename and path for the downloaded video
54
+ mp4_name = f"{scrape_serie.get_name()}_EP_{dynamic_format_number(str(index_select+1))}.mp4"
55
+ mp4_path = os.path.join(site_constant.ANIME_FOLDER, scrape_serie.get_name())
56
+
57
+ # Create output folder
58
+ os_manager.create_path(mp4_path)
59
+
60
+ # Collect mp4 link
61
+ video_source = AnimeWorldPlayer(site_constant.FULL_URL, episodes[index_select], scrape_serie.session_id, scrape_serie.csrf_token)
62
+ mp4_link = video_source.get_download_link()
63
+
64
+ # Start downloading
65
+ path, kill_handler = MP4_downloader(
66
+ url=str(mp4_link).strip(),
67
+ path=os.path.join(mp4_path, mp4_name)
68
+ )
69
+
70
+ return path, kill_handler
71
+
72
+
73
+ def download_series(select_title: MediaItem):
74
+ """
75
+ Function to download episodes of a TV series.
76
+
77
+ Parameters:
78
+ - tv_id (int): The ID of the TV series.
79
+ - tv_name (str): The name of the TV series.
80
+ """
81
+ start_message()
82
+
83
+ scrape_serie = ScrapSerie(select_title.url, site_constant.FULL_URL)
84
+
85
+ # Get the count of episodes for the TV series
86
+ episodes = scrape_serie.get_episodes()
87
+ episoded_count = len(episodes)
88
+ console.print(f"[cyan]Episodes find: [red]{episoded_count}")
89
+
90
+ # Prompt user to select an episode index
91
+ last_command = msg.ask("\n[cyan]Insert media [red]index [yellow]or [red]* [cyan]to download all media [yellow]or [red]1-2 [cyan]or [red]3-* [cyan]for a range of media")
92
+
93
+ # Manage user selection
94
+ list_episode_select = manage_selection(last_command, episoded_count)
95
+
96
+ # Download selected episodes
97
+ if len(list_episode_select) == 1 and last_command != "*":
98
+ path, _ = download_episode(list_episode_select[0]-1, scrape_serie, episodes)
99
+ return path
100
+
101
+ # Download all other episodes selecter
102
+ else:
103
+ kill_handler = False
104
+ for i_episode in list_episode_select:
105
+ if kill_handler:
106
+ break
107
+ _, kill_handler = download_episode(i_episode-1, scrape_serie, episodes)
@@ -0,0 +1,111 @@
1
+ # 21.03.25
2
+
3
+ import logging
4
+
5
+ # External libraries
6
+ import httpx
7
+ from bs4 import BeautifulSoup
8
+ from rich.console import Console
9
+
10
+
11
+ # Internal utilities
12
+ from StreamingCommunity.Util.config_json import config_manager
13
+ from StreamingCommunity.Util.headers import get_userAgent, get_headers
14
+ from StreamingCommunity.Util.table import TVShowManager
15
+
16
+
17
+ # Logic class
18
+ from StreamingCommunity.Api.Template.config_loader import site_constant
19
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
20
+
21
+
22
+ # Variable
23
+ console = Console()
24
+ media_search_manager = MediaManager()
25
+ table_show_manager = TVShowManager()
26
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
27
+
28
+
29
+ def get_session_and_csrf() -> dict:
30
+ """
31
+ Get the session ID and CSRF token from the website's cookies and HTML meta data.
32
+ """
33
+ # Send an initial GET request to the website
34
+ response = httpx.get(site_constant.FULL_URL, headers=get_headers())
35
+
36
+ # Extract the sessionId from the cookies
37
+ session_id = response.cookies.get('sessionId')
38
+ logging.info(f"Session ID: {session_id}")
39
+
40
+ # Use BeautifulSoup to parse the HTML and extract the CSRF-Token
41
+ soup = BeautifulSoup(response.text, 'html.parser')
42
+
43
+ # Try to find the CSRF token in a meta tag or hidden input
44
+ csrf_token = None
45
+ meta_tag = soup.find('meta', {'name': 'csrf-token'})
46
+ if meta_tag:
47
+ csrf_token = meta_tag.get('content')
48
+
49
+ # If it's not in the meta tag, check for hidden input fields
50
+ if not csrf_token:
51
+ input_tag = soup.find('input', {'name': '_csrf'})
52
+ if input_tag:
53
+ csrf_token = input_tag.get('value')
54
+
55
+ logging.info(f"CSRF Token: {csrf_token}")
56
+ return session_id, csrf_token
57
+
58
+ def title_search(query: str) -> int:
59
+ """
60
+ Function to perform an anime search using a provided title.
61
+
62
+ Parameters:
63
+ - query (str): The query to search for.
64
+
65
+ Returns:
66
+ - int: A number containing the length of media search manager.
67
+ """
68
+ search_url = f"{site_constant.FULL_URL}/search?keyword={query}"
69
+ console.print(f"[cyan]Search url: [yellow]{search_url}")
70
+
71
+ # Make the GET request
72
+ try:
73
+ response = httpx.get(search_url, headers={'User-Agent': get_userAgent()})
74
+
75
+ except Exception as e:
76
+ console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
77
+ return 0
78
+
79
+ # Create soup istance
80
+ soup = BeautifulSoup(response.text, 'html.parser')
81
+
82
+ # Collect data from soup
83
+ for element in soup.find_all('a', class_='poster'):
84
+ try:
85
+ title = element.find('img').get('alt')
86
+ url = f"{site_constant.FULL_URL}{element.get('href')}"
87
+ status_div = element.find('div', class_='status')
88
+ is_dubbed = False
89
+ anime_type = 'TV'
90
+
91
+ if status_div:
92
+ if status_div.find('div', class_='dub'):
93
+ is_dubbed = True
94
+
95
+ if status_div.find('div', class_='movie'):
96
+ anime_type = 'Movie'
97
+ elif status_div.find('div', class_='ona'):
98
+ anime_type = 'ONA'
99
+
100
+ media_search_manager.add_media({
101
+ 'name': title,
102
+ 'type': anime_type,
103
+ 'DUB': is_dubbed,
104
+ 'url': url
105
+ })
106
+
107
+ except Exception as e:
108
+ print(f"Error parsing a film entry: {e}")
109
+
110
+ # Return the length of media search manager
111
+ return media_search_manager.get_length()
@@ -0,0 +1,79 @@
1
+ # 21.03.25
2
+
3
+
4
+ # External libraries
5
+ import httpx
6
+ from bs4 import BeautifulSoup
7
+
8
+
9
+ # Internal utilities
10
+ from StreamingCommunity.Util.headers import get_userAgent
11
+ from StreamingCommunity.Util.config_json import config_manager
12
+ from StreamingCommunity.Util.os import os_manager
13
+
14
+
15
+ # Player
16
+ from ..site import get_session_and_csrf
17
+ from StreamingCommunity.Api.Player.sweetpixel import AnimeWorldPlayer
18
+
19
+
20
+ # Variable
21
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
22
+
23
+
24
+ class ScrapSerie:
25
+ def __init__(self, url, full_url):
26
+ """Initialize the ScrapSerie object with the provided URL and setup the HTTP client."""
27
+ self.url = url
28
+ self.link = httpx.URL(url).path
29
+ self.session_id, self.csrf_token = get_session_and_csrf()
30
+ self.client = httpx.Client(
31
+ cookies={"sessionId": self.session_id},
32
+ headers={"User-Agent": get_userAgent(), "csrf-token": self.csrf_token},
33
+ base_url=full_url
34
+ )
35
+
36
+ try:
37
+ self.response = self.client.get(self.link, timeout=max_timeout, follow_redirects=True)
38
+ self.response.raise_for_status()
39
+
40
+ except:
41
+ raise Exception(f"Failed to retrieve anime page.")
42
+
43
+
44
+ def get_name(self):
45
+ """Extract and return the name of the anime series."""
46
+ soup = BeautifulSoup(self.response.content, "html.parser")
47
+ return os_manager.get_sanitize_file(soup.find("h1", {"id": "anime-title"}).get_text(strip=True))
48
+
49
+ def get_episodes(self, nums=None):
50
+ """Fetch and return the list of episodes, optionally filtering by specific episode numbers."""
51
+ soup = BeautifulSoup(self.response.content, "html.parser")
52
+
53
+ raw_eps = {}
54
+ for data in soup.select('li.episode > a'):
55
+ epNum = data.get('data-episode-num')
56
+ epID = data.get('data-episode-id')
57
+
58
+ if nums and epNum not in nums:
59
+ continue
60
+
61
+ if epID not in raw_eps:
62
+ raw_eps[epID] = {
63
+ 'number': epNum,
64
+ 'link': f"/api/download/{epID}"
65
+ }
66
+
67
+ episodes = [episode_data for episode_data in raw_eps.values()]
68
+ return episodes
69
+
70
+ def get_episode(self, index):
71
+ """Fetch a specific episode based on the index, and return an AnimeWorldPlayer instance."""
72
+ episodes = self.get_episodes()
73
+
74
+ if 0 <= index < len(episodes):
75
+ episode_data = episodes[index]
76
+ return AnimeWorldPlayer(episode_data, self.session_id, self.csrf_token)
77
+
78
+ else:
79
+ raise IndexError("Episode index out of range")
@@ -37,7 +37,7 @@ def download_film(select_title: MediaItem) -> str:
37
37
  - str: output path
38
38
  """
39
39
  start_message()
40
- console.print(f"[yellow]Download: [red]{select_title.name} \n")
40
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
41
41
 
42
42
  # Setup api manger
43
43
  video_source = VideoSource(select_title.url)
@@ -27,12 +27,12 @@ table_show_manager = TVShowManager()
27
27
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
28
28
 
29
29
 
30
- def title_search(word_to_search: str) -> int:
30
+ def title_search(query: str) -> int:
31
31
  """
32
32
  Search for titles based on a search query.
33
33
 
34
34
  Parameters:
35
- - title_search (str): The title to search for.
35
+ - query (str): The query to search for.
36
36
 
37
37
  Returns:
38
38
  - int: The number of titles found.
@@ -40,7 +40,7 @@ def title_search(word_to_search: str) -> int:
40
40
  media_search_manager.clear()
41
41
  table_show_manager.clear()
42
42
 
43
- search_url = f"{site_constant.FULL_URL}/?s={word_to_search}"
43
+ search_url = f"{site_constant.FULL_URL}/?s={query}"
44
44
  console.print(f"[cyan]Search url: [yellow]{search_url}")
45
45
 
46
46
  try:
@@ -51,8 +51,8 @@ def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo,
51
51
 
52
52
  # Get info about episode
53
53
  obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
54
- console.print(f"[yellow]Download: [red]{obj_episode.get('name')}\n")
55
-
54
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [bold magenta]{obj_episode.get('name')}[/bold magenta] ([cyan]E{index_episode_selected}[/cyan]) \n")
55
+
56
56
  # Define filename and path for the downloaded video
57
57
  title_name = os_manager.get_sanitize_file(
58
58
  f"{map_episode_title(scape_info_serie.tv_name, None, index_episode_selected, obj_episode.get('name'))}.mp4"
@@ -28,12 +28,12 @@ table_show_manager = TVShowManager()
28
28
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
29
29
 
30
30
 
31
- def title_search(word_to_search: str) -> int:
31
+ def title_search(query: str) -> int:
32
32
  """
33
33
  Search for titles based on a search query.
34
34
 
35
35
  Parameters:
36
- - title_search (str): The title to search for.
36
+ - query (str): The query to search for.
37
37
 
38
38
  Returns:
39
39
  - int: The number of titles found.
@@ -41,7 +41,7 @@ def title_search(word_to_search: str) -> int:
41
41
  media_search_manager.clear()
42
42
  table_show_manager.clear()
43
43
 
44
- search_url = f"{site_constant.FULL_URL}/search/?&q={word_to_search}&quick=1&type=videobox_video&nodes=11"
44
+ search_url = f"{site_constant.FULL_URL}/search/?&q={query}&quick=1&type=videobox_video&nodes=11"
45
45
  console.print(f"[cyan]Search url: [yellow]{search_url}")
46
46
 
47
47
  try:
@@ -55,7 +55,7 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
55
55
 
56
56
  # Get info about episode
57
57
  obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
58
- console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.get('name')}\n")
58
+ console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [bold magenta]{obj_episode.get('name')}[/bold magenta] ([cyan]S{index_season_selected}E{index_episode_selected}[/cyan]) \n")
59
59
 
60
60
  # Define filename and path for the downloaded video
61
61
  mp4_name = f"{map_episode_title(scape_info_serie.tv_name, index_season_selected, index_episode_selected, obj_episode.get('name'))}.mp4"
@@ -27,12 +27,12 @@ max_timeout = config_manager.get_int("REQUESTS", "timeout")
27
27
 
28
28
 
29
29
 
30
- def title_search(word_to_search: str) -> int:
30
+ def title_search(query: str) -> int:
31
31
  """
32
32
  Search for titles based on a search query.
33
33
 
34
34
  Parameters:
35
- - title_search (str): The title to search for.
35
+ - query (str): The query to search for.
36
36
 
37
37
  Returns:
38
38
  - int: The number of titles found.
@@ -40,7 +40,7 @@ def title_search(word_to_search: str) -> int:
40
40
  media_search_manager.clear()
41
41
  table_show_manager.clear()
42
42
 
43
- search_url = f"{site_constant.FULL_URL}/?story={word_to_search}&do=search&subaction=search"
43
+ search_url = f"{site_constant.FULL_URL}/?story={query}&do=search&subaction=search"
44
44
  console.print(f"[cyan]Search url: [yellow]{search_url}")
45
45
 
46
46
  try: