StreamingCommunity 2.5.6__py3-none-any.whl → 2.5.8__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 (65) hide show
  1. StreamingCommunity/Api/Player/ddl.py +2 -3
  2. StreamingCommunity/Api/Site/1337xx/__init__.py +5 -6
  3. StreamingCommunity/Api/Site/1337xx/site.py +7 -14
  4. StreamingCommunity/Api/Site/1337xx/title.py +3 -5
  5. StreamingCommunity/Api/Site/altadefinizionegratis/__init__.py +7 -6
  6. StreamingCommunity/Api/Site/altadefinizionegratis/film.py +14 -19
  7. StreamingCommunity/Api/Site/altadefinizionegratis/site.py +6 -14
  8. StreamingCommunity/Api/Site/animeunity/__init__.py +7 -7
  9. StreamingCommunity/Api/Site/animeunity/film_serie.py +29 -31
  10. StreamingCommunity/Api/Site/animeunity/site.py +14 -22
  11. StreamingCommunity/Api/Site/cb01new/__init__.py +5 -4
  12. StreamingCommunity/Api/Site/cb01new/film.py +2 -5
  13. StreamingCommunity/Api/Site/cb01new/site.py +5 -13
  14. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +5 -4
  15. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +12 -49
  16. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +6 -16
  17. StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +2 -3
  18. StreamingCommunity/Api/Site/guardaserie/__init__.py +5 -4
  19. StreamingCommunity/Api/Site/guardaserie/series.py +12 -46
  20. StreamingCommunity/Api/Site/guardaserie/site.py +5 -13
  21. StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +10 -14
  22. StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +5 -4
  23. StreamingCommunity/Api/Site/ilcorsaronero/site.py +5 -13
  24. StreamingCommunity/Api/Site/ilcorsaronero/title.py +3 -5
  25. StreamingCommunity/Api/Site/mostraguarda/__init__.py +2 -2
  26. StreamingCommunity/Api/Site/mostraguarda/film.py +4 -8
  27. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +8 -7
  28. StreamingCommunity/Api/Site/streamingcommunity/film.py +14 -18
  29. StreamingCommunity/Api/Site/streamingcommunity/series.py +25 -76
  30. StreamingCommunity/Api/Site/streamingcommunity/site.py +11 -23
  31. StreamingCommunity/Api/Template/Util/__init__.py +8 -1
  32. StreamingCommunity/Api/Template/Util/manage_ep.py +46 -2
  33. StreamingCommunity/Api/Template/config_loader.py +71 -0
  34. StreamingCommunity/Lib/Downloader/HLS/downloader.py +60 -60
  35. StreamingCommunity/Lib/Downloader/HLS/segments.py +40 -15
  36. StreamingCommunity/Lib/Downloader/MP4/downloader.py +47 -40
  37. StreamingCommunity/Lib/FFmpeg/command.py +59 -3
  38. StreamingCommunity/Lib/M3U8/estimator.py +10 -12
  39. StreamingCommunity/Lib/M3U8/parser.py +12 -51
  40. StreamingCommunity/Lib/TMBD/tmdb.py +66 -99
  41. StreamingCommunity/TelegramHelp/telegram_bot.py +222 -68
  42. StreamingCommunity/Util/_jsonConfig.py +14 -13
  43. StreamingCommunity/Util/ffmpeg_installer.py +70 -64
  44. StreamingCommunity/Util/headers.py +11 -122
  45. StreamingCommunity/Util/os.py +65 -56
  46. StreamingCommunity/Util/table.py +62 -108
  47. StreamingCommunity/run.py +16 -11
  48. {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/METADATA +57 -23
  49. StreamingCommunity-2.5.8.dist-info/RECORD +86 -0
  50. StreamingCommunity/Api/Site/1337xx/costant.py +0 -15
  51. StreamingCommunity/Api/Site/altadefinizionegratis/costant.py +0 -21
  52. StreamingCommunity/Api/Site/animeunity/costant.py +0 -21
  53. StreamingCommunity/Api/Site/cb01new/costant.py +0 -19
  54. StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +0 -20
  55. StreamingCommunity/Api/Site/guardaserie/costant.py +0 -19
  56. StreamingCommunity/Api/Site/ilcorsaronero/costant.py +0 -19
  57. StreamingCommunity/Api/Site/mostraguarda/costant.py +0 -19
  58. StreamingCommunity/Api/Site/streamingcommunity/costant.py +0 -21
  59. StreamingCommunity/TelegramHelp/request_manager.py +0 -82
  60. StreamingCommunity/TelegramHelp/session.py +0 -56
  61. StreamingCommunity-2.5.6.dist-info/RECORD +0 -96
  62. {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/LICENSE +0 -0
  63. {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/WHEEL +0 -0
  64. {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/entry_points.txt +0 -0
  65. {StreamingCommunity-2.5.6.dist-info → StreamingCommunity-2.5.8.dist-info}/top_level.txt +0 -0
@@ -5,10 +5,12 @@ from urllib.parse import quote_plus
5
5
 
6
6
  # Internal utilities
7
7
  from StreamingCommunity.Util.console import console, msg
8
+ from StreamingCommunity.Api.Template import get_select_title
8
9
 
9
10
 
10
11
  # Logic class
11
- from .site import title_search, run_get_select_title, media_search_manager
12
+ from StreamingCommunity.Api.Template.config_loader import site_constant
13
+ from .site import title_search, media_search_manager, table_show_manager
12
14
  from .film import download_film
13
15
 
14
16
 
@@ -18,7 +20,6 @@ _useFor = "film"
18
20
  _deprecate = False
19
21
  _priority = 2
20
22
  _engineDownload = "mp4"
21
- from .costant import SITE_NAME
22
23
 
23
24
 
24
25
  def search(string_to_search: str = None, get_onylDatabase: bool = False):
@@ -27,7 +28,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
27
28
  """
28
29
 
29
30
  if string_to_search is None:
30
- string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
31
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
31
32
 
32
33
  # Search on database
33
34
  len_database = title_search(quote_plus(string_to_search))
@@ -39,7 +40,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
39
40
  if len_database > 0:
40
41
 
41
42
  # Select title from list
42
- select_title = run_get_select_title()
43
+ select_title = get_select_title(table_show_manager, media_search_manager)
43
44
 
44
45
  # !!! ADD TYPE DONT WORK FOR SERIE
45
46
  download_film(select_title)
@@ -11,6 +11,7 @@ from StreamingCommunity.Lib.Downloader import HLS_Downloader
11
11
 
12
12
 
13
13
  # Logic class
14
+ from StreamingCommunity.Api.Template.config_loader import site_constant
14
15
  from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
15
16
 
16
17
 
@@ -18,9 +19,6 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
18
19
  from StreamingCommunity.Api.Player.maxstream import VideoSource
19
20
 
20
21
 
21
- # Config
22
- from .costant import MOVIE_FOLDER
23
-
24
22
 
25
23
  def download_film(select_title: MediaItem) -> str:
26
24
  """
@@ -34,14 +32,13 @@ def download_film(select_title: MediaItem) -> str:
34
32
  """
35
33
  start_message()
36
34
  console.print(f"[yellow]Download: [red]{select_title.name} \n")
37
- console.print(f"[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
38
35
 
39
36
  # Setup api manger
40
37
  video_source = VideoSource(select_title.url)
41
38
 
42
39
  # Define output path
43
40
  title_name = os_manager.get_sanitize_file(select_title.name) +".mp4"
44
- mp4_path = os.path.join(MOVIE_FOLDER, title_name.replace(".mp4", ""))
41
+ mp4_path = os.path.join(site_constant.MOVIE_FOLDER, title_name.replace(".mp4", ""))
45
42
 
46
43
  # Get m3u8 master playlist
47
44
  master_playlist = video_source.get_playlist()
@@ -12,13 +12,12 @@ from StreamingCommunity.Util.table import TVShowManager
12
12
 
13
13
 
14
14
  # Logic class
15
- from StreamingCommunity.Api.Template import get_select_title
15
+ from StreamingCommunity.Api.Template.config_loader import site_constant
16
16
  from StreamingCommunity.Api.Template.Util import search_domain
17
17
  from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
18
18
 
19
19
 
20
20
  # Variable
21
- from .costant import SITE_NAME, DOMAIN_NOW
22
21
  media_search_manager = MediaManager()
23
22
  table_show_manager = TVShowManager()
24
23
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
@@ -39,13 +38,13 @@ def title_search(word_to_search: str) -> int:
39
38
  table_show_manager.clear()
40
39
 
41
40
  # Find new domain if prev dont work
42
- domain_to_use = DOMAIN_NOW
41
+ domain_to_use = site_constant.DOMAIN_NOW
43
42
 
44
43
  if not disable_searchDomain:
45
- domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
44
+ domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
46
45
 
47
46
  response = httpx.get(
48
- url=f"https://{SITE_NAME}.{domain_to_use}/?s={word_to_search}",
47
+ url=f"https://{site_constant.SITE_NAME}.{domain_to_use}/?s={word_to_search}",
49
48
  headers={'user-agent': get_headers()},
50
49
  timeout=max_timeout
51
50
  )
@@ -73,11 +72,4 @@ def title_search(word_to_search: str) -> int:
73
72
  print(f"Error parsing a film entry: {e}")
74
73
 
75
74
  # Return the number of titles found
76
- return media_search_manager.get_length()
77
-
78
-
79
- def run_get_select_title():
80
- """
81
- Display a selection of titles and prompt the user to choose one.
82
- """
83
- return get_select_title(table_show_manager, media_search_manager)
75
+ return media_search_manager.get_length()
@@ -6,10 +6,12 @@ from urllib.parse import quote_plus
6
6
 
7
7
  # Internal utilities
8
8
  from StreamingCommunity.Util.console import console, msg
9
+ from StreamingCommunity.Api.Template import get_select_title
9
10
 
10
11
 
11
12
  # Logic class
12
- from .site import title_search, run_get_select_title, media_search_manager
13
+ from StreamingCommunity.Api.Template.config_loader import site_constant
14
+ from .site import title_search, media_search_manager, table_show_manager
13
15
  from .series import download_thread
14
16
 
15
17
 
@@ -19,7 +21,6 @@ _useFor = "serie"
19
21
  _deprecate = False
20
22
  _priority = 2
21
23
  _engineDownload = "mp4"
22
- from .costant import SITE_NAME
23
24
 
24
25
 
25
26
  def search(string_to_search: str = None, get_onylDatabase: bool = False):
@@ -28,7 +29,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
28
29
  """
29
30
 
30
31
  if string_to_search is None:
31
- string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
32
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
32
33
 
33
34
  # Search on database
34
35
  len_database = title_search(quote_plus(string_to_search))
@@ -40,7 +41,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
40
41
  if len_database > 0:
41
42
 
42
43
  # Select title from list
43
- select_title = run_get_select_title()
44
+ select_title = get_select_title(table_show_manager, media_search_manager)
44
45
 
45
46
  # Download only film
46
47
  if "Serie TV" in str(select_title.type):
@@ -1,7 +1,6 @@
1
1
  # 13.06.24
2
2
 
3
3
  import os
4
- import sys
5
4
  from urllib.parse import urlparse
6
5
  from typing import Tuple
7
6
 
@@ -10,13 +9,18 @@ from typing import Tuple
10
9
  from StreamingCommunity.Util.console import console
11
10
  from StreamingCommunity.Util.message import start_message
12
11
  from StreamingCommunity.Util.os import os_manager
13
- from StreamingCommunity.Util.table import TVShowManager
14
12
  from StreamingCommunity.Lib.Downloader import MP4_downloader
15
13
 
16
14
 
17
15
  # Logic class
18
16
  from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
19
- from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection
17
+ from StreamingCommunity.Api.Template.Util import (
18
+ manage_selection,
19
+ map_episode_title,
20
+ validate_episode_selection,
21
+ display_episodes_list
22
+ )
23
+ from StreamingCommunity.Api.Template.config_loader import site_constant
20
24
 
21
25
 
22
26
  # Player
@@ -24,10 +28,6 @@ from .util.ScrapeSerie import GetSerieInfo
24
28
  from StreamingCommunity.Api.Player.ddl import VideoSource
25
29
 
26
30
 
27
- # Variable
28
- from .costant import SERIES_FOLDER
29
-
30
-
31
31
 
32
32
  def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> Tuple[str,bool]:
33
33
  """
@@ -46,13 +46,12 @@ def download_video(index_episode_selected: int, scape_info_serie: GetSerieInfo,
46
46
  # Get info about episode
47
47
  obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
48
48
  console.print(f"[yellow]Download: [red]{obj_episode.get('name')}\n")
49
- console.print(f"[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
50
49
 
51
50
  # Define filename and path for the downloaded video
52
51
  title_name = os_manager.get_sanitize_file(
53
52
  f"{map_episode_title(scape_info_serie.tv_name, None, index_episode_selected, obj_episode.get('name'))}.mp4"
54
53
  )
55
- mp4_path = os.path.join(SERIES_FOLDER, scape_info_serie.tv_name)
54
+ mp4_path = os.path.join(site_constant.SERIES_FOLDER, scape_info_serie.tv_name)
56
55
 
57
56
  # Create output folder
58
57
  os_manager.create_path(mp4_path)
@@ -84,13 +83,11 @@ def download_thread(dict_serie: MediaItem):
84
83
  """
85
84
  Download all episode of a thread
86
85
  """
87
-
88
- # Start message and set up video source
89
86
  start_message()
90
87
 
91
88
  # Init class
92
- scape_info_serie = GetSerieInfo(dict_serie)
93
- video_source = VideoSource()
89
+ scape_info_serie = GetSerieInfo(dict_serie, site_constant.COOKIE)
90
+ video_source = VideoSource(site_constant.COOKIE)
94
91
 
95
92
  # Collect information about thread
96
93
  list_dict_episode = scape_info_serie.get_episode_number()
@@ -102,6 +99,7 @@ def download_thread(dict_serie: MediaItem):
102
99
 
103
100
  try:
104
101
  list_episode_select = validate_episode_selection(list_episode_select, episodes_count)
102
+
105
103
  except ValueError as e:
106
104
  console.print(f"[red]{str(e)}")
107
105
  return
@@ -111,40 +109,5 @@ def download_thread(dict_serie: MediaItem):
111
109
  for i_episode in list_episode_select:
112
110
  if kill_handler:
113
111
  break
114
- kill_handler = download_video(i_episode, scape_info_serie, video_source)[1]
115
-
116
-
117
- def display_episodes_list(obj_episode_manager) -> str:
118
- """
119
- Display episodes list and handle user input.
120
-
121
- Returns:
122
- last_command (str): Last command entered by the user.
123
- """
124
-
125
- # Set up table for displaying episodes
126
- table_show_manager = TVShowManager()
127
- table_show_manager.set_slice_end(10)
128
-
129
- # Add columns to the table
130
- column_info = {
131
- "Index": {'color': 'red'},
132
- "Name": {'color': 'magenta'},
133
- }
134
- table_show_manager.add_column(column_info)
135
-
136
- # Populate the table with episodes information
137
- for i, media in enumerate(obj_episode_manager):
138
- table_show_manager.add_tv_show({
139
- 'Index': str(i+1),
140
- 'Name': media.get('name'),
141
- })
142
-
143
- # Run the table and handle user input
144
- last_command = table_show_manager.run()
145
-
146
- if last_command == "q":
147
- console.print("\n[red]Quit [white]...")
148
- sys.exit(0)
149
112
 
150
- return last_command
113
+ kill_handler = download_video(i_episode, scape_info_serie, video_source)[1]
@@ -16,13 +16,12 @@ from StreamingCommunity.Util.table import TVShowManager
16
16
 
17
17
 
18
18
  # Logic class
19
- from StreamingCommunity.Api.Template import get_select_title
19
+ from StreamingCommunity.Api.Template.config_loader import site_constant
20
20
  from StreamingCommunity.Api.Template.Util import search_domain
21
21
  from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
22
22
 
23
23
 
24
24
  # Variable
25
- from .costant import SITE_NAME, DOMAIN_NOW
26
25
  media_search_manager = MediaManager()
27
26
  table_show_manager = TVShowManager()
28
27
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
@@ -43,22 +42,22 @@ def title_search(word_to_search: str) -> int:
43
42
  table_show_manager.clear()
44
43
 
45
44
  # Find new domain if prev dont work
46
- domain_to_use = DOMAIN_NOW
45
+ domain_to_use = site_constant.DOMAIN_NOW
47
46
 
48
47
  if not disable_searchDomain:
49
- domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
48
+ domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
50
49
 
51
50
  # Send request to search for titles
52
51
  try:
53
52
  response = httpx.get(
54
- url=f"https://{SITE_NAME}.{domain_to_use}/search/?&q={word_to_search}&quick=1&type=videobox_video&nodes=11",
53
+ url=f"https://{site_constant.SITE_NAME}.{domain_to_use}/search/?&q={word_to_search}&quick=1&type=videobox_video&nodes=11",
55
54
  headers={'user-agent': get_headers()},
56
55
  timeout=max_timeout
57
56
  )
58
57
  response.raise_for_status()
59
58
 
60
59
  except Exception as e:
61
- console.print(f"Site: {SITE_NAME}, request search error: {e}")
60
+ console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
62
61
 
63
62
  # Create soup and find table
64
63
  soup = BeautifulSoup(response.text, "html.parser")
@@ -87,13 +86,4 @@ def title_search(word_to_search: str) -> int:
87
86
 
88
87
  else:
89
88
  logging.error("No table content found.")
90
- return -999
91
-
92
- return -9999
93
-
94
-
95
- def run_get_select_title():
96
- """
97
- Display a selection of titles and prompt the user to choose one.
98
- """
99
- return get_select_title(table_show_manager, media_search_manager)
89
+ return -999
@@ -20,12 +20,11 @@ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
20
20
 
21
21
 
22
22
  # Variable
23
- from ..costant import COOKIE
24
23
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
25
24
 
26
25
 
27
26
  class GetSerieInfo:
28
- def __init__(self, dict_serie: MediaItem) -> None:
27
+ def __init__(self, dict_serie: MediaItem, cookies) -> None:
29
28
  """
30
29
  Initializes the GetSerieInfo object with default values.
31
30
 
@@ -33,7 +32,7 @@ class GetSerieInfo:
33
32
  - dict_serie (MediaItem): Dictionary containing series information (optional).
34
33
  """
35
34
  self.headers = {'user-agent': get_headers()}
36
- self.cookies = COOKIE
35
+ self.cookies = cookies
37
36
  self.url = dict_serie.url
38
37
  self.tv_name = None
39
38
  self.list_episodes = None
@@ -5,10 +5,12 @@ from urllib.parse import quote_plus
5
5
 
6
6
  # Internal utilities
7
7
  from StreamingCommunity.Util.console import console, msg
8
+ from StreamingCommunity.Api.Template import get_select_title
8
9
 
9
10
 
10
11
  # Logic class
11
- from .site import title_search, run_get_select_title, media_search_manager
12
+ from StreamingCommunity.Api.Template.config_loader import site_constant
13
+ from .site import title_search, media_search_manager, table_show_manager
12
14
  from .series import download_series
13
15
 
14
16
 
@@ -18,7 +20,6 @@ _useFor = "serie"
18
20
  _deprecate = False
19
21
  _priority = 2
20
22
  _engineDownload = "hls"
21
- from .costant import SITE_NAME
22
23
 
23
24
 
24
25
  def search(string_to_search: str = None, get_onylDatabase: bool = False):
@@ -27,7 +28,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
27
28
  """
28
29
 
29
30
  if string_to_search is None:
30
- string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
31
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
31
32
 
32
33
  # Search on database
33
34
  len_database = title_search(quote_plus(string_to_search))
@@ -39,7 +40,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
39
40
  if len_database > 0:
40
41
 
41
42
  # Select title from list
42
- select_title = run_get_select_title()
43
+ select_title = get_select_title(table_show_manager, media_search_manager)
43
44
 
44
45
  # Download only film
45
46
  download_series(select_title)
@@ -1,19 +1,25 @@
1
1
  # 13.06.24
2
2
 
3
3
  import os
4
- import sys
5
4
  from typing import Tuple
6
5
 
7
6
 
8
7
  # Internal utilities
9
8
  from StreamingCommunity.Util.console import console, msg
10
9
  from StreamingCommunity.Util.message import start_message
11
- from StreamingCommunity.Util.table import TVShowManager
12
10
  from StreamingCommunity.Lib.Downloader import HLS_Downloader
13
11
 
14
12
 
15
13
  # Logic class
16
- from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, dynamic_format_number, validate_selection, validate_episode_selection
14
+ from StreamingCommunity.Api.Template.Util import (
15
+ manage_selection,
16
+ map_episode_title,
17
+ dynamic_format_number,
18
+ validate_selection,
19
+ validate_episode_selection,
20
+ display_episodes_list
21
+ )
22
+ from StreamingCommunity.Api.Template.config_loader import site_constant
17
23
  from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
18
24
 
19
25
 
@@ -22,10 +28,6 @@ from .util.ScrapeSerie import GetSerieInfo
22
28
  from StreamingCommunity.Api.Player.supervideo import VideoSource
23
29
 
24
30
 
25
- # Variable
26
- from .costant import SERIES_FOLDER
27
-
28
-
29
31
 
30
32
  def download_video(index_season_selected: int, index_episode_selected: int, scape_info_serie: GetSerieInfo) -> Tuple[str,bool]:
31
33
  """
@@ -46,11 +48,10 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
46
48
  # Get info about episode
47
49
  obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
48
50
  console.print(f"[yellow]Download: [red]{index_season_selected}:{index_episode_selected} {obj_episode.get('name')}\n")
49
- console.print(f"[cyan]You can safely stop the download with [bold]Ctrl+c[bold] [cyan] \n")
50
51
 
51
52
  # Define filename and path for the downloaded video
52
53
  mp4_name = f"{map_episode_title(scape_info_serie.tv_name, index_season_selected, index_episode_selected, obj_episode.get('name'))}.mp4"
53
- mp4_path = os.path.join(SERIES_FOLDER, scape_info_serie.tv_name, f"S{index_season_selected}")
54
+ mp4_path = os.path.join(site_constant.SERIES_FOLDER, scape_info_serie.tv_name, f"S{index_season_selected}")
54
55
 
55
56
  # Setup video source
56
57
  video_source = VideoSource(obj_episode.get('url'))
@@ -64,6 +65,7 @@ def download_video(index_season_selected: int, index_episode_selected: int, scap
64
65
  output_path=os.path.join(mp4_path, mp4_name)
65
66
  ).start()
66
67
 
68
+
67
69
  if "error" in r_proc.keys():
68
70
  try:
69
71
  os.remove(r_proc['path'])
@@ -161,40 +163,4 @@ def download_series(dict_serie: MediaItem) -> None:
161
163
  else:
162
164
 
163
165
  # 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 = TVShowManager()
177
- table_show_manager.set_slice_end(10)
178
-
179
- # Add columns to the table
180
- column_info = {
181
- "Index": {'color': 'red'},
182
- "Name": {'color': 'magenta'},
183
- }
184
- table_show_manager.add_column(column_info)
185
-
186
- # Populate the table with episodes information
187
- for media in obj_episode_manager:
188
- table_show_manager.add_tv_show({
189
- 'Index': str(media.get('number')),
190
- 'Name': media.get('name'),
191
- })
192
-
193
- # Run the table and handle user input
194
- last_command = table_show_manager.run()
195
-
196
- if last_command == "q":
197
- console.print("\n[red]Quit [white]...")
198
- sys.exit(0)
199
-
200
- return last_command
166
+ download_episode(scape_info_serie, i_season, download_all=False)
@@ -13,13 +13,12 @@ from StreamingCommunity.Util.table import TVShowManager
13
13
 
14
14
 
15
15
  # Logic class
16
- from StreamingCommunity.Api.Template import get_select_title
16
+ from StreamingCommunity.Api.Template.config_loader import site_constant
17
17
  from StreamingCommunity.Api.Template.Util import search_domain
18
18
  from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
19
19
 
20
20
 
21
21
  # Variable
22
- from .costant import SITE_NAME, DOMAIN_NOW
23
22
  media_search_manager = MediaManager()
24
23
  table_show_manager = TVShowManager()
25
24
  max_timeout = config_manager.get_int("REQUESTS", "timeout")
@@ -40,10 +39,10 @@ def title_search(word_to_search: str) -> int:
40
39
  table_show_manager.clear()
41
40
 
42
41
  # Find new domain if prev dont work
43
- domain_to_use = DOMAIN_NOW
42
+ domain_to_use = site_constant.DOMAIN_NOW
44
43
 
45
44
  if not disable_searchDomain:
46
- domain_to_use, base_url = search_domain(SITE_NAME, f"https://{SITE_NAME}.{DOMAIN_NOW}")
45
+ domain_to_use, base_url = search_domain(site_constant.SITE_NAME, f"https://{site_constant.SITE_NAME}.{site_constant.DOMAIN_NOW}")
47
46
 
48
47
  # Send request to search for titles
49
48
  try:
@@ -55,7 +54,7 @@ def title_search(word_to_search: str) -> int:
55
54
  response.raise_for_status()
56
55
 
57
56
  except Exception as e:
58
- console.print(f"Site: {SITE_NAME}, request search error: {e}")
57
+ console.print(f"Site: {site_constant.SITE_NAME}, request search error: {e}")
59
58
 
60
59
  # Create soup and find table
61
60
  soup = BeautifulSoup(response.text, "html.parser")
@@ -80,11 +79,4 @@ def title_search(word_to_search: str) -> int:
80
79
  print(f"Error parsing a film entry: {e}")
81
80
 
82
81
  # Return the number of titles found
83
- return media_search_manager.get_length()
84
-
85
-
86
- def run_get_select_title():
87
- """
88
- Display a selection of titles and prompt the user to choose one.
89
- """
90
- return get_select_title(table_show_manager, media_search_manager)
82
+ return media_search_manager.get_length()
@@ -11,10 +11,15 @@ from bs4 import BeautifulSoup
11
11
 
12
12
  # Internal utilities
13
13
  from StreamingCommunity.Util.headers import get_headers
14
+ from StreamingCommunity.Util._jsonConfig import config_manager
14
15
 
15
16
 
16
17
  # Logic class
17
- from StreamingCommunity.Api.Template .Class.SearchType import MediaItem
18
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
19
+
20
+
21
+ # Variable
22
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
18
23
 
19
24
 
20
25
  class GetSerieInfo:
@@ -40,19 +45,12 @@ class GetSerieInfo:
40
45
  try:
41
46
 
42
47
  # Make an HTTP request to the series URL
43
- response = httpx.get(self.url, headers=self.headers, timeout=15)
48
+ response = httpx.get(self.url, headers=self.headers, timeout=max_timeout, follow_redirects=True)
44
49
  response.raise_for_status()
45
50
 
46
- # Parse HTML content of the page
47
51
  soup = BeautifulSoup(response.text, "html.parser")
48
-
49
- # Find the container of seasons
50
52
  table_content = soup.find('div', class_="tt_season")
51
-
52
- # Count the number of seasons
53
53
  seasons_number = len(table_content.find_all("li"))
54
-
55
- # Extract the name of the series
56
54
  self.tv_name = soup.find("h1", class_="front_title").get_text(strip=True)
57
55
 
58
56
  return seasons_number
@@ -60,7 +58,7 @@ class GetSerieInfo:
60
58
  except Exception as e:
61
59
  logging.error(f"Error parsing HTML page: {e}")
62
60
 
63
- return -999
61
+ return -1
64
62
 
65
63
  def get_episode_number(self, n_season: int) -> List[Dict[str, str]]:
66
64
  """
@@ -75,7 +73,7 @@ class GetSerieInfo:
75
73
  try:
76
74
 
77
75
  # Make an HTTP request to the series URL
78
- response = httpx.get(self.url, headers=self.headers, timeout=15)
76
+ response = httpx.get(self.url, headers=self.headers, timeout=max_timeout, follow_redirects=True)
79
77
  response.raise_for_status()
80
78
 
81
79
  # Parse HTML content of the page
@@ -83,8 +81,6 @@ class GetSerieInfo:
83
81
 
84
82
  # Find the container of episodes for the specified season
85
83
  table_content = soup.find('div', class_="tab-pane", id=f"season-{n_season}")
86
-
87
- # Extract episode information
88
84
  episode_content = table_content.find_all("li")
89
85
  list_dict_episode = []
90
86
 
@@ -107,4 +103,4 @@ class GetSerieInfo:
107
103
  except Exception as e:
108
104
  logging.error(f"Error parsing HTML page: {e}")
109
105
 
110
- return []
106
+ return []
@@ -6,10 +6,12 @@ from urllib.parse import quote_plus
6
6
 
7
7
  # Internal utilities
8
8
  from StreamingCommunity.Util.console import console, msg
9
+ from StreamingCommunity.Api.Template import get_select_title
9
10
 
10
11
 
11
12
  # Logic class
12
- from .site import title_search, run_get_select_title, media_search_manager
13
+ from StreamingCommunity.Api.Template.config_loader import site_constant
14
+ from .site import title_search, media_search_manager, table_show_manager
13
15
  from .title import download_title
14
16
 
15
17
 
@@ -19,7 +21,6 @@ _useFor = "film_serie"
19
21
  _deprecate = False
20
22
  _priority = 2
21
23
  _engineDownload = "tor"
22
- from .costant import SITE_NAME
23
24
 
24
25
 
25
26
  def search(string_to_search: str = None, get_onylDatabase: bool = False):
@@ -28,7 +29,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
28
29
  """
29
30
 
30
31
  if string_to_search is None:
31
- string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{SITE_NAME}").strip()
32
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [green]{site_constant.SITE_NAME}").strip()
32
33
 
33
34
  # Search on database
34
35
  len_database = asyncio.run(title_search(quote_plus(string_to_search)))
@@ -40,7 +41,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False):
40
41
  if len_database > 0:
41
42
 
42
43
  # Select title from list
43
- select_title = run_get_select_title()
44
+ select_title = get_select_title(table_show_manager, media_search_manager)
44
45
 
45
46
  # Download title
46
47
  download_title(select_title)