StreamingCommunity 3.0.4__py3-none-any.whl → 3.0.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 (26) hide show
  1. StreamingCommunity/Api/Site/1337xx/__init__.py +3 -2
  2. StreamingCommunity/Api/Site/altadefinizione/__init__.py +2 -1
  3. StreamingCommunity/Api/Site/animeunity/__init__.py +2 -1
  4. StreamingCommunity/Api/Site/animeworld/__init__.py +3 -2
  5. StreamingCommunity/Api/Site/guardaserie/__init__.py +3 -2
  6. StreamingCommunity/Api/Site/raiplay/__init__.py +3 -2
  7. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +17 -2
  8. StreamingCommunity/Api/Site/streamingcommunity/film.py +1 -1
  9. StreamingCommunity/Api/Site/streamingcommunity/series.py +2 -2
  10. StreamingCommunity/Api/Site/streamingcommunity/site.py +27 -6
  11. StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +4 -5
  12. StreamingCommunity/Api/Site/streamingwatch/__init__.py +3 -2
  13. StreamingCommunity/Upload/version.py +1 -1
  14. StreamingCommunity/Util/config_json.py +7 -4
  15. StreamingCommunity/global_search.py +2 -1
  16. StreamingCommunity/run.py +43 -70
  17. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/METADATA +216 -237
  18. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/RECORD +22 -26
  19. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +0 -74
  20. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +0 -118
  21. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +0 -87
  22. StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +0 -112
  23. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/WHEEL +0 -0
  24. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/entry_points.txt +0 -0
  25. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/licenses/LICENSE +0 -0
  26. {streamingcommunity-3.0.4.dist-info → streamingcommunity-3.0.6.dist-info}/top_level.txt +0 -0
@@ -21,9 +21,10 @@ from .title import download_title
21
21
 
22
22
  # Variable
23
23
  indice = 3
24
- _useFor = "film_serie"
24
+ _useFor = "Torrent"
25
25
  _priority = 0
26
- _engineDownload = "tor"
26
+ _engineDownload = "Torrent"
27
+ _deprecate = False
27
28
 
28
29
  console = Console()
29
30
  msg = Prompt()
@@ -24,9 +24,10 @@ from .series import download_series
24
24
 
25
25
  # Variable
26
26
  indice = 2
27
- _useFor = "film_serie"
27
+ _useFor = "Film_&_Serie"
28
28
  _priority = 0
29
29
  _engineDownload = "hls"
30
+ _deprecate = True
30
31
 
31
32
  msg = Prompt()
32
33
  console = Console()
@@ -24,9 +24,10 @@ from .serie import download_series
24
24
 
25
25
  # Variable
26
26
  indice = 1
27
- _useFor = "anime"
27
+ _useFor = "Anime"
28
28
  _priority = 0
29
29
  _engineDownload = "mp4"
30
+ _deprecate = False
30
31
 
31
32
  msg = Prompt()
32
33
  console = Console()
@@ -18,10 +18,11 @@ from .film import download_film
18
18
 
19
19
 
20
20
  # Variable
21
- indice = 8
22
- _useFor = "anime"
21
+ indice = 6
22
+ _useFor = "Anime"
23
23
  _priority = 0
24
24
  _engineDownload = "mp4"
25
+ _deprecate = False
25
26
 
26
27
  msg = Prompt()
27
28
  console = Console()
@@ -20,10 +20,11 @@ from .series import download_series
20
20
 
21
21
 
22
22
  # Variable
23
- indice = 5
24
- _useFor = "serie"
23
+ indice = 4
24
+ _useFor = "Serie"
25
25
  _priority = 0
26
26
  _engineDownload = "hls"
27
+ _deprecate = False
27
28
 
28
29
  msg = Prompt()
29
30
  console = Console()
@@ -19,10 +19,11 @@ from .film import download_film
19
19
 
20
20
 
21
21
  # Variable
22
- indice = 8
23
- _useFor = "film_serie"
22
+ indice = 5
23
+ _useFor = "Film_&_Serie"
24
24
  _priority = 1 # NOTE: Site search need the use of tmbd obj
25
25
  _engineDownload = "hls"
26
+ _deprecate = False
26
27
 
27
28
  msg = Prompt()
28
29
  console = Console()
@@ -25,9 +25,10 @@ from .series import download_series
25
25
 
26
26
  # Variable
27
27
  indice = 0
28
- _useFor = "film_serie"
28
+ _useFor = "Film_&_Serie"
29
29
  _priority = 0
30
30
  _engineDownload = "hls"
31
+ _deprecate = False
31
32
 
32
33
  msg = Prompt()
33
34
  console = Console()
@@ -96,7 +97,21 @@ def search(string_to_search: str = None, get_onlyDatabase: bool = False, direct_
96
97
  return
97
98
 
98
99
  if string_to_search is None:
99
- string_to_search = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
100
+ if site_constant.TELEGRAM_BOT:
101
+ bot = get_bot_instance()
102
+ string_to_search = bot.ask(
103
+ "key_search",
104
+ f"Enter the search term\nor type 'back' to return to the menu: ",
105
+ None
106
+ )
107
+
108
+ if string_to_search == 'back':
109
+
110
+ # Restart the script
111
+ subprocess.Popen([sys.executable] + sys.argv)
112
+ sys.exit()
113
+ else:
114
+ string_to_search = msg.ask(f"\n[purple]Insert a word to search in [green]{site_constant.SITE_NAME}").strip()
100
115
 
101
116
  # Search on database
102
117
  len_database = title_search(string_to_search)
@@ -55,7 +55,7 @@ def download_film(select_title: MediaItem) -> str:
55
55
  console.print(f"[bold yellow]Download:[/bold yellow] [red]{site_constant.SITE_NAME}[/red] → [cyan]{select_title.name}[/cyan] \n")
56
56
 
57
57
  # Init class
58
- video_source = VideoSource(site_constant.FULL_URL, False, select_title.id)
58
+ video_source = VideoSource(f"{site_constant.FULL_URL}/it", False, select_title.id)
59
59
 
60
60
  # Retrieve scws and if available master playlist
61
61
  video_source.get_iframe(select_title.id)
@@ -154,8 +154,8 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
154
154
  start_message()
155
155
 
156
156
  # Init class
157
- video_source = VideoSource(site_constant.FULL_URL, True, select_season.id)
158
- scrape_serie = GetSerieInfo(site_constant.FULL_URL, select_season.id, select_season.slug)
157
+ video_source = VideoSource(f"{site_constant.FULL_URL}/it", True, select_season.id)
158
+ scrape_serie = GetSerieInfo(f"{site_constant.FULL_URL}/it", select_season.id, select_season.slug)
159
159
 
160
160
  # Collect information about season
161
161
  scrape_serie.getNumberSeason()
@@ -1,8 +1,11 @@
1
1
  # 10.12.23
2
2
 
3
+ import json
4
+
3
5
 
4
6
  # External libraries
5
7
  import httpx
8
+ from bs4 import BeautifulSoup
6
9
  from rich.console import Console
7
10
 
8
11
 
@@ -41,16 +44,34 @@ def title_search(query: str) -> int:
41
44
  media_search_manager.clear()
42
45
  table_show_manager.clear()
43
46
 
44
- search_url = f"{site_constant.FULL_URL}/api/search?q={query}"
47
+ try:
48
+ response = httpx.get(
49
+ f"{site_constant.FULL_URL}/it",
50
+ headers={'user-agent': get_userAgent()},
51
+ timeout=max_timeout
52
+ )
53
+ response.raise_for_status()
54
+
55
+ soup = BeautifulSoup(response.text, 'html.parser')
56
+ version = json.loads(soup.find('div', {'id': "app"}).get("data-page"))['version']
57
+
58
+ except Exception as e:
59
+ console.print(f"[red]Site: {site_constant.SITE_NAME} version, request error: {e}")
60
+ return 0
61
+
62
+ search_url = f"{site_constant.FULL_URL}/it/search?q={query}"
45
63
  console.print(f"[cyan]Search url: [yellow]{search_url}")
46
64
 
47
65
  try:
48
66
  response = httpx.get(
49
67
  search_url,
50
- headers={'user-agent': get_userAgent()},
51
- timeout=max_timeout,
52
- follow_redirects=True,
53
- verify=False
68
+ headers = {
69
+ 'referer': site_constant.FULL_URL,
70
+ 'user-agent': get_userAgent(),
71
+ 'x-inertia': 'true',
72
+ 'x-inertia-version': version
73
+ },
74
+ timeout=max_timeout
54
75
  )
55
76
  response.raise_for_status()
56
77
 
@@ -66,7 +87,7 @@ def title_search(query: str) -> int:
66
87
 
67
88
  # Collect json data
68
89
  try:
69
- data = response.json().get('data', [])
90
+ data = response.json().get('props').get('titles')
70
91
  except Exception as e:
71
92
  console.log(f"Error parsing JSON response: {e}")
72
93
  return 0
@@ -96,17 +96,16 @@ class GetSerieInfo:
96
96
  if not season:
97
97
  logging.error(f"Season {number_season} not found")
98
98
  return
99
-
99
+
100
100
  response = httpx.get(
101
- url=f'{self.url}/titles/{self.media_id}-{self.series_name}/stagione-{number_season}',
101
+ url=f'{self.url}/titles/{self.media_id}-{self.series_name}/season-{number_season}',
102
102
  headers={
103
- 'User-Agent': get_userAgent(),
104
- 'x-inertia': 'true',
103
+ 'User-Agent': self.headers['user-agent'],
104
+ 'x-inertia': 'true',
105
105
  'x-inertia-version': self.version,
106
106
  },
107
107
  timeout=max_timeout
108
108
  )
109
- response.raise_for_status()
110
109
 
111
110
  # Extract episodes from JSON response
112
111
  json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
@@ -19,10 +19,11 @@ from .series import download_series
19
19
 
20
20
 
21
21
  # Variable
22
- indice = 8
23
- _useFor = "film_serie"
22
+ indice = 7
23
+ _useFor = "Film_&_Serie"
24
24
  _priority = 10 # !!! MOLTO LENTO
25
25
  _engineDownload = "hls"
26
+ _deprecate = False
26
27
 
27
28
  msg = Prompt()
28
29
  console = Console()
@@ -1,5 +1,5 @@
1
1
  __title__ = 'StreamingCommunity'
2
- __version__ = '3.0.4'
2
+ __version__ = '3.0.6'
3
3
  __author__ = 'Arrowar'
4
4
  __description__ = 'A command-line program to download film'
5
5
  __copyright__ = 'Copyright 2024'
@@ -36,8 +36,13 @@ class ConfigManager:
36
36
  base_path = os.path.dirname(sys.executable)
37
37
 
38
38
  else:
39
- # Use the current directory where the script is executed
40
- base_path = os.getcwd()
39
+
40
+ # Get the actual path of the module file
41
+ current_file_path = os.path.abspath(__file__)
42
+ # Navigate upwards to find the project root
43
+ # Assuming this file is in a package structure like StreamingCommunity/Util/config_json.py
44
+ # We need to go up 2 levels to reach the project root
45
+ base_path = os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))
41
46
 
42
47
  # Initialize file paths
43
48
  self.file_path = os.path.join(base_path, file_name)
@@ -166,7 +171,6 @@ class ConfigManager:
166
171
  raise Exception(f"Error downloading reference configuration. Code: {response.status_code}")
167
172
 
168
173
  reference_config = response.json()
169
- console.print(f"[bold cyan]Reference configuration downloaded:[/bold cyan] [green]{len(reference_config)} keys available[/green]")
170
174
 
171
175
  # Compare and update missing keys
172
176
  merged_config = self._deep_merge_configs(self.config, reference_config)
@@ -285,7 +289,6 @@ class ConfigManager:
285
289
  self.configSite = data[0]['data']
286
290
 
287
291
  site_count = len(self.configSite) if isinstance(self.configSite, dict) else 0
288
- console.print(f"[bold green]Site data retrieved:[/bold green] {site_count} streaming services available")
289
292
 
290
293
  else:
291
294
  console.print("[bold yellow]API returned an empty data set[/bold yellow]")
@@ -61,7 +61,8 @@ def load_search_functions():
61
61
  priority = getattr(mod, '_priority', 0)
62
62
 
63
63
  if priority == 0:
64
- modules.append((module_name, indice, use_for))
64
+ if not getattr(mod, '_deprecate'):
65
+ modules.append((module_name, indice, use_for))
65
66
 
66
67
  except Exception as e:
67
68
  console.print(f"[red]Failed to import module {module_name}: {str(e)}")
StreamingCommunity/run.py CHANGED
@@ -30,7 +30,7 @@ from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, Teleg
30
30
 
31
31
  # Config
32
32
  SHOW_TRENDING = config_manager.get_bool('DEFAULT', 'show_trending')
33
- CLOSE_CONSOLE = config_manager.get_bool('DEFAULT', 'not_close')
33
+ NOT_CLOSE_CONSOLE = config_manager.get_bool('DEFAULT', 'not_close')
34
34
  TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
35
35
 
36
36
 
@@ -61,7 +61,7 @@ def load_search_functions():
61
61
  loaded_functions = {}
62
62
 
63
63
  # Lista dei siti da escludere se TELEGRAM_BOT è attivo
64
- excluded_sites = {"cb01new", "ddlstreamitaly", "guardaserie", "ilcorsaronero", "mostraguarda"} if TELEGRAM_BOT else set()
64
+ excluded_sites = {"cb01new", "guardaserie", "ilcorsaronero", "mostraguarda"} if TELEGRAM_BOT else set()
65
65
 
66
66
  # Find api home directory
67
67
  if getattr(sys, 'frozen', False): # Modalità PyInstaller
@@ -89,9 +89,11 @@ def load_search_functions():
89
89
  mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
90
90
 
91
91
  # Get 'indice' from the module
92
- indice = getattr(mod, 'indice', 0)
93
- use_for = getattr(mod, '_useFor', 'other')
94
- modules.append((module_name, indice, use_for))
92
+ indice = getattr(mod, 'indice')
93
+ use_for = getattr(mod, '_useFor')
94
+
95
+ if not getattr(mod, '_deprecate'):
96
+ modules.append((module_name, indice, use_for))
95
97
 
96
98
  except Exception as e:
97
99
  console.print(f"[red]Failed to import module {module_name}: {str(e)}")
@@ -191,6 +193,13 @@ def force_exit():
191
193
 
192
194
  def main(script_id = 0):
193
195
 
196
+ color_map = {
197
+ "anime": "red",
198
+ "film_&_serie": "yellow",
199
+ "serie": "blue",
200
+ "torrent": "white"
201
+ }
202
+
194
203
  if TELEGRAM_BOT:
195
204
  bot = get_bot_instance()
196
205
  bot.send_message(f"Avviato script {script_id}", None)
@@ -202,13 +211,16 @@ def main(script_id = 0):
202
211
  initialize()
203
212
 
204
213
  if not internet_manager.check_dns_provider():
214
+ print()
205
215
  console.print("[red]❌ ERROR: DNS configuration is required!")
206
216
  console.print("[red]The program cannot function correctly without proper DNS settings.")
207
217
  console.print("[yellow]Please configure one of these DNS servers:")
208
- console.print("[blue]• Cloudflare (1.1.1.1)")
209
- console.print("[blue]• Quad9 (9.9.9.9)")
218
+ console.print("[blue]• Cloudflare (1.1.1.1) 'https://developers.cloudflare.com/1.1.1.1/setup/windows/'")
219
+ console.print("[blue]• Quad9 (9.9.9.9) 'https://docs.quad9.net/Setup_Guides/Windows/Windows_10/'")
210
220
  console.print("\n[yellow]⚠️ The program will not work until you configure your DNS settings.")
211
- input("[yellow]Press Enter to exit...")
221
+
222
+ time.sleep(1)
223
+ msg.ask("[yellow]Press Enter to exit...")
212
224
 
213
225
  # Load search functions
214
226
  search_functions = load_search_functions()
@@ -251,30 +263,6 @@ def main(script_id = 0):
251
263
  )
252
264
 
253
265
  # Add arguments for search functions
254
- color_map = {
255
- "anime": "red",
256
- "film_serie": "yellow",
257
- "film": "blue",
258
- "serie": "green",
259
- "other": "white"
260
- }
261
-
262
- # Add dynamic arguments based on loaded search modules
263
- used_short_options = set()
264
-
265
- for alias, (_, use_for) in search_functions.items():
266
- short_option = alias[:3].upper()
267
-
268
- original_short_option = short_option
269
- count = 1
270
- while short_option in used_short_options:
271
- short_option = f"{original_short_option}{count}"
272
- count += 1
273
-
274
- used_short_options.add(short_option)
275
- long_option = alias
276
- parser.add_argument(f'-{short_option}', f'--{long_option}', action='store_true', help=f'Search for {alias.split("_")[0]} on streaming platforms.')
277
-
278
266
  parser.add_argument('-s', '--search', default=None, help='Search terms')
279
267
 
280
268
  # Parse command-line arguments
@@ -309,54 +297,45 @@ def main(script_id = 0):
309
297
  global_search(search_terms)
310
298
  return
311
299
 
312
- # Map command-line arguments to functions
313
- arg_to_function = {alias: func for alias, (func, _) in search_functions.items()}
314
-
315
- # Check which argument is provided and run the corresponding function
316
- for arg, func in arg_to_function.items():
317
- if getattr(args, arg):
318
- run_function(func, search_terms=search_terms)
319
- return
320
-
321
- # Mapping user input to functions
322
- input_to_function = {str(i): func for i, (alias, (func, _)) in enumerate(search_functions.items())}
323
-
324
- # Create dynamic prompt message and choices
325
- choice_labels = {str(i): (alias.split("_")[0].capitalize(), use_for) for i, (alias, (_, use_for)) in enumerate(search_functions.items())}
326
-
327
- # Add global search option to the menu
328
- #global_search_key = str(len(choice_labels))
329
- #choice_labels[global_search_key] = ("Global Search", "all")
330
- #input_to_function[global_search_key] = global_search
300
+ # Create mappings using module indice
301
+ input_to_function = {}
302
+ choice_labels = {}
303
+
304
+ for alias, (func, use_for) in search_functions.items():
305
+ module_name = alias.split("_")[0]
306
+ try:
307
+ mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
308
+ site_index = str(getattr(mod, 'indice'))
309
+ input_to_function[site_index] = func
310
+ choice_labels[site_index] = (module_name.capitalize(), use_for.lower())
311
+ except Exception as e:
312
+ console.print(f"[red]Error mapping module {module_name}: {str(e)}")
331
313
 
332
- # Display the category legend in a single line
314
+ # Display the category legend
333
315
  legend_text = " | ".join([f"[{color}]{category.capitalize()}[/{color}]" for category, color in color_map.items()])
334
316
  console.print(f"\n[bold green]Category Legend:[/bold green] {legend_text}")
335
317
 
336
- # Construct the prompt message with color-coded site names
318
+ # Construct prompt with proper color mapping
337
319
  prompt_message = "[green]Insert category [white](" + ", ".join(
338
- [f"{key}: [{color_map.get(label[1], 'white')}]{label[0]}[/{color_map.get(label[1], 'white')}]" for key, label in choice_labels.items()]
320
+ [f"[{color_map.get(label[1], 'white')}]{key}: {label[0]}[/{color_map.get(label[1], 'white')}]"
321
+ for key, label in choice_labels.items()]
339
322
  ) + "[white])"
340
323
 
341
324
  if TELEGRAM_BOT:
342
-
343
- # Display the category legend in a single line
344
325
  category_legend_str = "Categorie: \n" + " | ".join([
345
326
  f"{category.capitalize()}" for category in color_map.keys()
346
327
  ])
347
328
 
348
- # Costruisci il messaggio senza emoji
349
329
  prompt_message = "Inserisci il sito:\n" + "\n".join(
350
330
  [f"{key}: {label[0]}" for key, label in choice_labels.items()]
351
331
  )
352
332
 
353
333
  console.print(f"\n{prompt_message}")
354
334
 
355
- # Chiedi la scelta all'utente con il bot Telegram
356
335
  category = bot.ask(
357
336
  "select_provider",
358
337
  f"{category_legend_str}\n\n{prompt_message}",
359
- None # Passiamo la lista delle chiavi come scelte
338
+ None
360
339
  )
361
340
 
362
341
  else:
@@ -364,13 +343,6 @@ def main(script_id = 0):
364
343
 
365
344
  # Run the corresponding function based on user input
366
345
  if category in input_to_function:
367
- """if category == global_search_key:
368
- # Run global search
369
- run_function(input_to_function[category], search_terms=search_terms)
370
-
371
- else:"""
372
-
373
- # Run normal site-specific search
374
346
  run_function(input_to_function[category], search_terms=search_terms)
375
347
 
376
348
  else:
@@ -379,10 +351,11 @@ def main(script_id = 0):
379
351
 
380
352
  console.print("[red]Invalid category.")
381
353
 
382
- if CLOSE_CONSOLE:
383
- restart_script() # Riavvia lo script invece di uscire
354
+ if NOT_CLOSE_CONSOLE:
355
+ restart_script()
356
+
384
357
  else:
385
- force_exit() # Usa la funzione per chiudere sempre
358
+ force_exit()
386
359
 
387
360
  if TELEGRAM_BOT:
388
361
  bot.send_message(f"Chiusura in corso", None)
@@ -390,4 +363,4 @@ def main(script_id = 0):
390
363
  # Delete script_id
391
364
  script_id = TelegramSession.get_session()
392
365
  if script_id != "unknown":
393
- TelegramSession.deleteScriptId(script_id)
366
+ TelegramSession.deleteScriptId(script_id)