StreamingCommunity 1.9.8__py3-none-any.whl → 1.9.90__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 (93) hide show
  1. StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py +143 -0
  2. StreamingCommunity/Api/Player/Helper/Vixcloud/util.py +145 -0
  3. StreamingCommunity/Api/Player/ddl.py +89 -0
  4. StreamingCommunity/Api/Player/maxstream.py +151 -0
  5. StreamingCommunity/Api/Player/supervideo.py +194 -0
  6. StreamingCommunity/Api/Player/vixcloud.py +273 -0
  7. StreamingCommunity/Api/Site/1337xx/__init__.py +51 -0
  8. StreamingCommunity/Api/Site/1337xx/costant.py +15 -0
  9. StreamingCommunity/Api/Site/1337xx/site.py +86 -0
  10. StreamingCommunity/Api/Site/1337xx/title.py +66 -0
  11. StreamingCommunity/Api/Site/altadefinizione/__init__.py +51 -0
  12. StreamingCommunity/Api/Site/altadefinizione/costant.py +15 -0
  13. StreamingCommunity/Api/Site/altadefinizione/film.py +74 -0
  14. StreamingCommunity/Api/Site/altadefinizione/site.py +89 -0
  15. StreamingCommunity/Api/Site/animeunity/__init__.py +51 -0
  16. StreamingCommunity/Api/Site/animeunity/costant.py +15 -0
  17. StreamingCommunity/Api/Site/animeunity/film_serie.py +135 -0
  18. StreamingCommunity/Api/Site/animeunity/site.py +167 -0
  19. StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +97 -0
  20. StreamingCommunity/Api/Site/cb01new/__init__.py +52 -0
  21. StreamingCommunity/Api/Site/cb01new/costant.py +15 -0
  22. StreamingCommunity/Api/Site/cb01new/film.py +73 -0
  23. StreamingCommunity/Api/Site/cb01new/site.py +76 -0
  24. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +58 -0
  25. StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +16 -0
  26. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +146 -0
  27. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +95 -0
  28. StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +85 -0
  29. StreamingCommunity/Api/Site/guardaserie/__init__.py +53 -0
  30. StreamingCommunity/Api/Site/guardaserie/costant.py +15 -0
  31. StreamingCommunity/Api/Site/guardaserie/series.py +199 -0
  32. StreamingCommunity/Api/Site/guardaserie/site.py +86 -0
  33. StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +110 -0
  34. StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +52 -0
  35. StreamingCommunity/Api/Site/ilcorsaronero/costant.py +15 -0
  36. StreamingCommunity/Api/Site/ilcorsaronero/site.py +63 -0
  37. StreamingCommunity/Api/Site/ilcorsaronero/title.py +46 -0
  38. StreamingCommunity/Api/Site/ilcorsaronero/util/ilCorsarScraper.py +141 -0
  39. StreamingCommunity/Api/Site/mostraguarda/__init__.py +49 -0
  40. StreamingCommunity/Api/Site/mostraguarda/costant.py +15 -0
  41. StreamingCommunity/Api/Site/mostraguarda/film.py +99 -0
  42. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +56 -0
  43. StreamingCommunity/Api/Site/streamingcommunity/costant.py +15 -0
  44. StreamingCommunity/Api/Site/streamingcommunity/film.py +75 -0
  45. StreamingCommunity/Api/Site/streamingcommunity/series.py +206 -0
  46. StreamingCommunity/Api/Site/streamingcommunity/site.py +137 -0
  47. StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +123 -0
  48. StreamingCommunity/Api/Template/Class/SearchType.py +101 -0
  49. StreamingCommunity/Api/Template/Util/__init__.py +5 -0
  50. StreamingCommunity/Api/Template/Util/get_domain.py +173 -0
  51. StreamingCommunity/Api/Template/Util/manage_ep.py +179 -0
  52. StreamingCommunity/Api/Template/Util/recall_search.py +37 -0
  53. StreamingCommunity/Api/Template/__init__.py +3 -0
  54. StreamingCommunity/Api/Template/site.py +87 -0
  55. StreamingCommunity/Lib/Downloader/HLS/downloader.py +946 -0
  56. StreamingCommunity/Lib/Downloader/HLS/proxyes.py +110 -0
  57. StreamingCommunity/Lib/Downloader/HLS/segments.py +561 -0
  58. StreamingCommunity/Lib/Downloader/MP4/downloader.py +155 -0
  59. StreamingCommunity/Lib/Downloader/TOR/downloader.py +296 -0
  60. StreamingCommunity/Lib/Downloader/__init__.py +5 -0
  61. StreamingCommunity/Lib/FFmpeg/__init__.py +4 -0
  62. StreamingCommunity/Lib/FFmpeg/capture.py +170 -0
  63. StreamingCommunity/Lib/FFmpeg/command.py +296 -0
  64. StreamingCommunity/Lib/FFmpeg/util.py +249 -0
  65. StreamingCommunity/Lib/M3U8/__init__.py +6 -0
  66. StreamingCommunity/Lib/M3U8/decryptor.py +164 -0
  67. StreamingCommunity/Lib/M3U8/estimator.py +176 -0
  68. StreamingCommunity/Lib/M3U8/parser.py +666 -0
  69. StreamingCommunity/Lib/M3U8/url_fixer.py +52 -0
  70. StreamingCommunity/Lib/TMBD/__init__.py +2 -0
  71. StreamingCommunity/Lib/TMBD/obj_tmbd.py +39 -0
  72. StreamingCommunity/Lib/TMBD/tmdb.py +346 -0
  73. StreamingCommunity/Upload/update.py +68 -0
  74. StreamingCommunity/Upload/version.py +5 -0
  75. StreamingCommunity/Util/_jsonConfig.py +204 -0
  76. StreamingCommunity/Util/call_stack.py +42 -0
  77. StreamingCommunity/Util/color.py +20 -0
  78. StreamingCommunity/Util/console.py +12 -0
  79. StreamingCommunity/Util/ffmpeg_installer.py +311 -0
  80. StreamingCommunity/Util/headers.py +147 -0
  81. StreamingCommunity/Util/logger.py +53 -0
  82. StreamingCommunity/Util/message.py +64 -0
  83. StreamingCommunity/Util/os.py +554 -0
  84. StreamingCommunity/Util/table.py +229 -0
  85. StreamingCommunity/__init__.py +0 -0
  86. StreamingCommunity/run.py +2 -2
  87. {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/METADATA +7 -10
  88. StreamingCommunity-1.9.90.dist-info/RECORD +92 -0
  89. {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/WHEEL +1 -1
  90. {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/entry_points.txt +0 -1
  91. StreamingCommunity-1.9.8.dist-info/RECORD +0 -7
  92. {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/LICENSE +0 -0
  93. {StreamingCommunity-1.9.8.dist-info → StreamingCommunity-1.9.90.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,199 @@
1
+ # 13.06.24
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+
7
+
8
+ # Internal utilities
9
+ from StreamingCommunity.Util.console import console, msg
10
+ from StreamingCommunity.Util.message import start_message
11
+ from StreamingCommunity.Util.call_stack import get_call_stack
12
+ from StreamingCommunity.Util.table import TVShowManager
13
+ from StreamingCommunity.Lib.Downloader import HLS_Downloader
14
+
15
+
16
+ # Logic class
17
+ from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_selection, validate_episode_selection, execute_search
18
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
19
+
20
+
21
+ # Player
22
+ from .util.ScrapeSerie import GetSerieInfo
23
+ from StreamingCommunity.Api.Player.supervideo import VideoSource
24
+
25
+
26
+ # Variable
27
+ from .costant import ROOT_PATH, SERIES_FOLDER
28
+ table_show_manager = TVShowManager()
29
+
30
+
31
+
32
+ def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> str:
33
+ """
34
+ Download a single episode video.
35
+
36
+ Parameters:
37
+ - tv_name (str): Name of the TV series.
38
+ - index_season_selected (int): Index of the selected season.
39
+ - index_episode_selected (int): Index of the selected episode.
40
+
41
+ Return:
42
+ - str: output path
43
+ """
44
+
45
+ start_message()
46
+
47
+ # Get info about episode
48
+ obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
49
+ console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.get('name')}")
50
+ print()
51
+
52
+ # Define filename and path for the downloaded video
53
+ mp4_name = f"{map_episode_title(scape_info_serie.tv_name, index_season_selected, index_episode_selected, obj_episode.get('name'))}.mp4"
54
+ mp4_path = os.path.join(ROOT_PATH, SERIES_FOLDER, scape_info_serie.tv_name, f"S{index_season_selected}")
55
+
56
+ # Setup video source
57
+ video_source = VideoSource(obj_episode.get('url'))
58
+
59
+ # Get m3u8 master playlist
60
+ master_playlist = video_source.get_playlist()
61
+
62
+ # Download the film using the m3u8 playlist, and output filename
63
+ r_proc = HLS_Downloader(
64
+ m3u8_playlist=master_playlist,
65
+ output_filename=os.path.join(mp4_path, mp4_name)
66
+ ).start()
67
+
68
+ """if r_proc == 404:
69
+ time.sleep(2)
70
+
71
+ # Re call search function
72
+ if msg.ask("[green]Do you want to continue [white]([red]y[white])[green] or return at home[white]([red]n[white]) ", choices=['y', 'n'], default='y', show_choices=True) == "n":
73
+ frames = get_call_stack()
74
+ execute_search(frames[-4])"""
75
+
76
+ if r_proc != None:
77
+ console.print("[green]Result: ")
78
+ console.print(r_proc)
79
+
80
+ return os.path.join(mp4_path, mp4_name)
81
+
82
+
83
+ def download_episode(scape_info_serie: GetSerieInfo, index_season_selected: int, download_all: bool = False) -> None:
84
+ """
85
+ Download all episodes of a season.
86
+
87
+ Parameters:
88
+ - tv_name (str): Name of the TV series.
89
+ - index_season_selected (int): Index of the selected season.
90
+ - download_all (bool): Download all seasons episodes
91
+ """
92
+
93
+ # Start message and collect information about episodes
94
+ start_message()
95
+ list_dict_episode = scape_info_serie.get_episode_number(index_season_selected)
96
+ episodes_count = len(list_dict_episode)
97
+
98
+ if download_all:
99
+
100
+ # Download all episodes without asking
101
+ for i_episode in range(1, episodes_count + 1):
102
+ download_video(index_season_selected, i_episode, scape_info_serie)
103
+ console.print(f"\n[red]End downloaded [yellow]season: [red]{index_season_selected}.")
104
+
105
+ else:
106
+
107
+ # Display episodes list and manage user selection
108
+ last_command = display_episodes_list(scape_info_serie.list_episodes)
109
+ list_episode_select = manage_selection(last_command, episodes_count)
110
+
111
+ try:
112
+ list_episode_select = validate_episode_selection(list_episode_select, episodes_count)
113
+ except ValueError as e:
114
+ console.print(f"[red]{str(e)}")
115
+ return
116
+
117
+ # Download selected episodes
118
+ for i_episode in list_episode_select:
119
+ download_video(index_season_selected, i_episode, scape_info_serie)
120
+
121
+
122
+ def download_series(dict_serie: MediaItem) -> None:
123
+ """
124
+ Download all episodes of a TV series.
125
+
126
+ Parameters:
127
+ - dict_serie (MediaItem): obj with url name type and score
128
+ """
129
+
130
+ # Start message and set up video source
131
+ start_message()
132
+
133
+ # Init class
134
+ scape_info_serie = GetSerieInfo(dict_serie)
135
+
136
+ # Collect information about seasons
137
+ seasons_count = scape_info_serie.get_seasons_number()
138
+
139
+ # Prompt user for season selection and download episodes
140
+ console.print(f"\n[green]Seasons found: [red]{seasons_count}")
141
+ index_season_selected = msg.ask(
142
+ "\n[cyan]Insert season number [yellow](e.g., 1), [red]* [cyan]to download all seasons, "
143
+ "[yellow](e.g., 1-2) [cyan]for a range of seasons, or [yellow](e.g., 3-*) [cyan]to download from a specific season to the end"
144
+ )
145
+
146
+ # Manage and validate the selection
147
+ list_season_select = manage_selection(index_season_selected, seasons_count)
148
+
149
+ try:
150
+ list_season_select = validate_selection(list_season_select, seasons_count)
151
+ except ValueError as e:
152
+ console.print(f"[red]{str(e)}")
153
+ return
154
+
155
+ # Loop through the selected seasons and download episodes
156
+ for i_season in list_season_select:
157
+ if len(list_season_select) > 1 or index_season_selected == "*":
158
+
159
+ # Download all episodes if multiple seasons are selected or if '*' is used
160
+ download_episode(scape_info_serie, i_season, download_all=True)
161
+ else:
162
+
163
+ # Otherwise, let the user select specific episodes for the single season
164
+ download_episode(scape_info_serie, i_season, download_all=False)
165
+
166
+
167
+ def display_episodes_list(obj_episode_manager) -> str:
168
+ """
169
+ Display episodes list and handle user input.
170
+
171
+ Returns:
172
+ last_command (str): Last command entered by the user.
173
+ """
174
+
175
+ # Set up table for displaying episodes
176
+ table_show_manager.set_slice_end(10)
177
+
178
+ # Add columns to the table
179
+ column_info = {
180
+ "Index": {'color': 'red'},
181
+ "Name": {'color': 'magenta'},
182
+ }
183
+ table_show_manager.add_column(column_info)
184
+
185
+ # Populate the table with episodes information
186
+ for media in obj_episode_manager:
187
+ table_show_manager.add_tv_show({
188
+ 'Index': str(media.get('number')),
189
+ 'Name': media.get('name'),
190
+ })
191
+
192
+ # Run the table and handle user input
193
+ last_command = table_show_manager.run()
194
+
195
+ if last_command == "q":
196
+ console.print("\n[red]Quit [white]...")
197
+ sys.exit(0)
198
+
199
+ return last_command
@@ -0,0 +1,86 @@
1
+ # 09.06.24
2
+
3
+ # External libraries
4
+ import httpx
5
+ from bs4 import BeautifulSoup
6
+
7
+
8
+ # Internal utilities
9
+ from StreamingCommunity.Util.console import console
10
+ from StreamingCommunity.Util._jsonConfig import config_manager
11
+ from StreamingCommunity.Util.headers import get_headers
12
+ from StreamingCommunity.Util.table import TVShowManager
13
+
14
+
15
+ # Logic class
16
+ from StreamingCommunity.Api.Template import get_select_title
17
+ from StreamingCommunity.Api.Template.Util import search_domain
18
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
19
+
20
+
21
+ # Variable
22
+ from .costant import SITE_NAME
23
+ media_search_manager = MediaManager()
24
+ table_show_manager = TVShowManager()
25
+
26
+
27
+ def title_search(word_to_search: str) -> int:
28
+ """
29
+ Search for titles based on a search query.
30
+
31
+ Parameters:
32
+ - title_search (str): The title to search for.
33
+
34
+ Returns:
35
+ - int: The number of titles found.
36
+ """
37
+ media_search_manager.clear()
38
+ table_show_manager.clear()
39
+
40
+ # Find new domain if prev dont work
41
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
42
+ domain_to_use, _ = search_domain(SITE_NAME, f"https://{SITE_NAME}")
43
+
44
+ # Send request to search for titles
45
+ try:
46
+ response = httpx.get(
47
+ url=f"https://guardaserie.{domain_to_use}/?story={word_to_search}&do=search&subaction=search",
48
+ headers={'user-agent': get_headers()},
49
+ timeout=max_timeout
50
+ )
51
+ response.raise_for_status()
52
+
53
+ except Exception as e:
54
+ console.print(f"Site: {SITE_NAME}, request search error: {e}")
55
+
56
+ # Create soup and find table
57
+ soup = BeautifulSoup(response.text, "html.parser")
58
+ table_content = soup.find('div', class_="mlnew-list")
59
+
60
+ for serie_div in table_content.find_all('div', class_='mlnew'):
61
+
62
+ try:
63
+ title = serie_div.find('div', class_='mlnh-2').find("h2").get_text(strip=True)
64
+ link = serie_div.find('div', class_='mlnh-2').find('a')['href']
65
+ imdb_rating = serie_div.find('span', class_='mlnh-imdb').get_text(strip=True)
66
+
67
+ serie_info = {
68
+ 'name': title,
69
+ 'url': link,
70
+ 'score': imdb_rating
71
+ }
72
+
73
+ media_search_manager.add_media(serie_info)
74
+
75
+ except:
76
+ pass
77
+
78
+ # Return the number of titles found
79
+ return media_search_manager.get_length()
80
+
81
+
82
+ def run_get_select_title():
83
+ """
84
+ Display a selection of titles and prompt the user to choose one.
85
+ """
86
+ return get_select_title(table_show_manager, media_search_manager)
@@ -0,0 +1,110 @@
1
+ # 13.06.24
2
+
3
+ import logging
4
+ from typing import List, Dict
5
+
6
+
7
+ # External libraries
8
+ import httpx
9
+ from bs4 import BeautifulSoup
10
+
11
+
12
+ # Internal utilities
13
+ from StreamingCommunity.Util.headers import get_headers
14
+
15
+
16
+ # Logic class
17
+ from StreamingCommunity.Api.Template .Class.SearchType import MediaItem
18
+
19
+
20
+ class GetSerieInfo:
21
+ def __init__(self, dict_serie: MediaItem) -> None:
22
+ """
23
+ Initializes the GetSerieInfo object with default values.
24
+
25
+ Parameters:
26
+ dict_serie (MediaItem): Dictionary containing series information (optional).
27
+ """
28
+ self.headers = {'user-agent': get_headers()}
29
+ self.url = dict_serie.url
30
+ self.tv_name = None
31
+ self.list_episodes = None
32
+
33
+ def get_seasons_number(self) -> int:
34
+ """
35
+ Retrieves the number of seasons of a TV series.
36
+
37
+ Returns:
38
+ int: Number of seasons of the TV series.
39
+ """
40
+ try:
41
+
42
+ # Make an HTTP request to the series URL
43
+ response = httpx.get(self.url, headers=self.headers, timeout=15)
44
+ response.raise_for_status()
45
+
46
+ # Parse HTML content of the page
47
+ soup = BeautifulSoup(response.text, "html.parser")
48
+
49
+ # Find the container of seasons
50
+ table_content = soup.find('div', class_="tt_season")
51
+
52
+ # Count the number of seasons
53
+ seasons_number = len(table_content.find_all("li"))
54
+
55
+ # Extract the name of the series
56
+ self.tv_name = soup.find("h1", class_="front_title").get_text(strip=True)
57
+
58
+ return seasons_number
59
+
60
+ except Exception as e:
61
+ logging.error(f"Error parsing HTML page: {e}")
62
+
63
+ return -999
64
+
65
+ def get_episode_number(self, n_season: int) -> List[Dict[str, str]]:
66
+ """
67
+ Retrieves the number of episodes for a specific season.
68
+
69
+ Parameters:
70
+ n_season (int): The season number.
71
+
72
+ Returns:
73
+ List[Dict[str, str]]: List of dictionaries containing episode information.
74
+ """
75
+ try:
76
+
77
+ # Make an HTTP request to the series URL
78
+ response = httpx.get(self.url, headers=self.headers, timeout=15)
79
+ response.raise_for_status()
80
+
81
+ # Parse HTML content of the page
82
+ soup = BeautifulSoup(response.text, "html.parser")
83
+
84
+ # Find the container of episodes for the specified season
85
+ table_content = soup.find('div', class_="tab-pane", id=f"season-{n_season}")
86
+
87
+ # Extract episode information
88
+ episode_content = table_content.find_all("li")
89
+ list_dict_episode = []
90
+
91
+ for episode_div in episode_content:
92
+ index = episode_div.find("a").get("data-num")
93
+ link = episode_div.find("a").get("data-link")
94
+ name = episode_div.find("a").get("data-title")
95
+
96
+ obj_episode = {
97
+ 'number': index,
98
+ 'name': name,
99
+ 'url': link
100
+ }
101
+
102
+ list_dict_episode.append(obj_episode)
103
+
104
+ self.list_episodes = list_dict_episode
105
+ return list_dict_episode
106
+
107
+ except Exception as e:
108
+ logging.error(f"Error parsing HTML page: {e}")
109
+
110
+ return []
@@ -0,0 +1,52 @@
1
+ # 02.07.24
2
+
3
+ import asyncio
4
+ from urllib.parse import quote_plus
5
+
6
+
7
+ # Internal utilities
8
+ from StreamingCommunity.Util.console import console, msg
9
+
10
+
11
+ # Logic class
12
+ from .site import title_search, run_get_select_title, media_search_manager
13
+ from .title import download_title
14
+
15
+
16
+ # Variable
17
+ indice = 9
18
+ _useFor = "film_serie"
19
+ _deprecate = False
20
+ _priority = 2
21
+ _engineDownload = "tor"
22
+ from .costant import SITE_NAME
23
+
24
+
25
+ def search(string_to_search: str = None, get_onylDatabase: bool = False):
26
+ """
27
+ Main function of the application for film and series.
28
+ """
29
+
30
+ if string_to_search is None:
31
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
32
+
33
+ # Search on database
34
+ len_database = asyncio.run(title_search(quote_plus(string_to_search)))
35
+
36
+ # Return list of elements
37
+ if get_onylDatabase:
38
+ return media_search_manager
39
+
40
+ if len_database > 0:
41
+
42
+ # Select title from list
43
+ select_title = run_get_select_title()
44
+
45
+ # Download title
46
+ download_title(select_title)
47
+
48
+ else:
49
+ console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
50
+
51
+ # Retry
52
+ search()
@@ -0,0 +1,15 @@
1
+ # 09.06.24
2
+
3
+ import os
4
+
5
+
6
+ # Internal utilities
7
+ from StreamingCommunity.Util._jsonConfig import config_manager
8
+
9
+
10
+ SITE_NAME = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
11
+ ROOT_PATH = config_manager.get('DEFAULT', 'root_path')
12
+ DOMAIN_NOW = config_manager.get_dict('SITE', SITE_NAME)['domain']
13
+
14
+ SERIES_FOLDER = config_manager.get('DEFAULT', 'serie_folder_name')
15
+ MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name')
@@ -0,0 +1,63 @@
1
+ # 02.07.24
2
+
3
+
4
+ # Internal utilities
5
+ from StreamingCommunity.Util.table import TVShowManager
6
+
7
+
8
+ # Logic class
9
+ from StreamingCommunity.Api.Template import get_select_title
10
+ from StreamingCommunity.Api.Template.Util import search_domain
11
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
12
+ from .util.ilCorsarScraper import IlCorsaroNeroScraper
13
+
14
+
15
+ # Variable
16
+ from .costant import SITE_NAME
17
+ media_search_manager = MediaManager()
18
+ table_show_manager = TVShowManager()
19
+
20
+
21
+ async def title_search(word_to_search: str) -> int:
22
+ """
23
+ Search for titles based on a search query.
24
+
25
+ Parameters:
26
+ - title_search (str): The title to search for.
27
+
28
+ Returns:
29
+ - int: The number of titles found.
30
+ """
31
+ media_search_manager.clear()
32
+ table_show_manager.clear()
33
+
34
+ # Find new domain if prev dont work
35
+ domain_to_use, _ = search_domain(SITE_NAME, f"https://{SITE_NAME}")
36
+
37
+ # Create scraper and collect result
38
+ print("\n")
39
+ scraper = IlCorsaroNeroScraper(f"https://{SITE_NAME}.{domain_to_use}/", 1)
40
+ results = await scraper.search(word_to_search)
41
+
42
+ # Add all result to media manager
43
+ for i, torrent in enumerate(results):
44
+ media_search_manager.add_media({
45
+ 'name': torrent['name'],
46
+ 'type': torrent['type'],
47
+ 'seed': torrent['seed'],
48
+ 'leech': torrent['leech'],
49
+ 'size': torrent['size'],
50
+ 'date': torrent['date'],
51
+ 'url': torrent['url']
52
+ })
53
+
54
+
55
+ # Return the number of titles found
56
+ return media_search_manager.get_length()
57
+
58
+
59
+ def run_get_select_title():
60
+ """
61
+ Display a selection of titles and prompt the user to choose one.
62
+ """
63
+ return get_select_title(table_show_manager, media_search_manager)
@@ -0,0 +1,46 @@
1
+ # 02.07.24
2
+
3
+ import os
4
+
5
+
6
+ # Internal utilities
7
+ from StreamingCommunity.Util.console import console
8
+ from StreamingCommunity.Util.os import os_manager
9
+ from StreamingCommunity.Util.message import start_message
10
+ from StreamingCommunity.Lib.Downloader import TOR_downloader
11
+
12
+
13
+ # Logic class
14
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
15
+
16
+
17
+ # Config
18
+ from .costant import ROOT_PATH, MOVIE_FOLDER
19
+
20
+
21
+ def download_title(select_title: MediaItem):
22
+ """
23
+ Downloads a media item and saves it as an MP4 file.
24
+
25
+ Parameters:
26
+ - select_title (MediaItem): The media item to be downloaded. This should be an instance of the MediaItem class, containing attributes like `name` and `url`.
27
+ """
28
+
29
+ start_message()
30
+ console.print(f"[yellow]Download: [red]{select_title.name} \n")
31
+ print()
32
+
33
+ # Define output path
34
+ title_name = os_manager.get_sanitize_file(select_title.name)
35
+ mp4_path = os_manager.get_sanitize_path(
36
+ os.path.join(ROOT_PATH, MOVIE_FOLDER, title_name.replace(".mp4", ""))
37
+ )
38
+
39
+ # Create output folder
40
+ os_manager.create_path(mp4_path)
41
+
42
+ # Tor manager
43
+ manager = TOR_downloader()
44
+ manager.add_magnet_link(select_title.url)
45
+ manager.start_download()
46
+ manager.move_downloaded_files(mp4_path)