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,52 @@
1
+ # 09.06.24
2
+
3
+ from urllib.parse import quote_plus
4
+
5
+
6
+ # Internal utilities
7
+ from StreamingCommunity.Util.console import console, msg
8
+
9
+
10
+ # Logic class
11
+ from .site import title_search, run_get_select_title, media_search_manager
12
+ from .film import download_film
13
+
14
+
15
+ # Variable
16
+ indice = 9
17
+ _useFor = "film"
18
+ _deprecate = False
19
+ _priority = 2
20
+ _engineDownload = "mp4"
21
+ from .costant import SITE_NAME
22
+
23
+
24
+ def search(string_to_search: str = None, get_onylDatabase: bool = False):
25
+ """
26
+ Main function of the application for film and series.
27
+ """
28
+
29
+ if string_to_search is None:
30
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
31
+
32
+ # Search on database
33
+ len_database = title_search(quote_plus(string_to_search))
34
+
35
+ # Return list of elements
36
+ if get_onylDatabase:
37
+ return media_search_manager
38
+
39
+ if len_database > 0:
40
+
41
+ # Select title from list
42
+ select_title = run_get_select_title()
43
+
44
+ # !!! ADD TYPE DONT WORK FOR SERIE
45
+ download_film(select_title)
46
+
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
+ # 03.07.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,73 @@
1
+ # 03.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.Util.call_stack import get_call_stack
11
+ from StreamingCommunity.Lib.Downloader import HLS_Downloader
12
+
13
+
14
+ # Logic class
15
+ from StreamingCommunity.Api.Template.Util import execute_search
16
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
17
+
18
+
19
+ # Player
20
+ from StreamingCommunity.Api.Player.maxstream import VideoSource
21
+
22
+
23
+ # Config
24
+ from .costant import ROOT_PATH, MOVIE_FOLDER
25
+
26
+
27
+ def download_film(select_title: MediaItem) -> str:
28
+ """
29
+ Downloads a film using the provided obj.
30
+
31
+ Parameters:
32
+ - select_title (MediaItem): The media item to be downloaded. This should be an instance of the MediaItem class, containing attributes like `name` and `url`.
33
+
34
+ Return:
35
+ - str: output path
36
+ """
37
+
38
+ # Start message and display film information
39
+ start_message()
40
+ console.print(f"[yellow]Download: [red]{select_title.name} \n")
41
+
42
+ # Setup api manger
43
+ print(select_title.url)
44
+ video_source = VideoSource(select_title.url)
45
+
46
+ # Define output path
47
+ title_name = os_manager.get_sanitize_file(select_title.name) +".mp4"
48
+ mp4_path = os_manager.get_sanitize_path(
49
+ os.path.join(ROOT_PATH, MOVIE_FOLDER, title_name.replace(".mp4", ""))
50
+ )
51
+
52
+ # Get m3u8 master playlist
53
+ master_playlist = video_source.get_playlist()
54
+
55
+ # Download the film using the m3u8 playlist, and output filename
56
+ r_proc = HLS_Downloader(
57
+ m3u8_playlist=master_playlist,
58
+ output_filename=os.path.join(mp4_path, title_name)
59
+ ).start()
60
+
61
+ """if r_proc == 404:
62
+ time.sleep(2)
63
+
64
+ # Re call search function
65
+ 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":
66
+ frames = get_call_stack()
67
+ execute_search(frames[-4])"""
68
+
69
+ if r_proc != None:
70
+ console.print("[green]Result: ")
71
+ console.print(r_proc)
72
+
73
+ return os.path.join(mp4_path, title_name)
@@ -0,0 +1,76 @@
1
+ # 03.07.24
2
+
3
+ # External libraries
4
+ import httpx
5
+ from bs4 import BeautifulSoup
6
+
7
+
8
+ # Internal utilities
9
+ from StreamingCommunity.Util._jsonConfig import config_manager
10
+ from StreamingCommunity.Util.headers import get_headers
11
+ from StreamingCommunity.Util.table import TVShowManager
12
+
13
+
14
+ # Logic class
15
+ from StreamingCommunity.Api.Template import get_select_title
16
+ from StreamingCommunity.Api.Template.Util import search_domain
17
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
18
+
19
+
20
+ # Variable
21
+ from .costant import SITE_NAME
22
+ media_search_manager = MediaManager()
23
+ table_show_manager = TVShowManager()
24
+
25
+
26
+ def title_search(word_to_search: str) -> int:
27
+ """
28
+ Search for titles based on a search query.
29
+
30
+ Parameters:
31
+ - title_search (str): The title to search for.
32
+
33
+ Returns:
34
+ - int: The number of titles found.
35
+ """
36
+ media_search_manager.clear()
37
+ table_show_manager.clear()
38
+
39
+ # Find new domain if prev dont work
40
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
41
+ domain_to_use, _ = search_domain(SITE_NAME, f"https://{SITE_NAME}")
42
+
43
+ response = httpx.get(
44
+ url=f"https://{SITE_NAME}.{domain_to_use}/?s={word_to_search}",
45
+ headers={'user-agent': get_headers()},
46
+ timeout=max_timeout
47
+ )
48
+ response.raise_for_status()
49
+
50
+ # Create soup and find table
51
+ soup = BeautifulSoup(response.text, "html.parser")
52
+
53
+ # For all element in table
54
+ for div in soup.find_all("div", class_ = "card-content"):
55
+
56
+ url = div.find("h3").find("a").get("href")
57
+ title = div.find("h3").find("a").get_text(strip=True)
58
+ desc = div.find("p").find("strong").text
59
+
60
+ title_info = {
61
+ 'name': title,
62
+ 'desc': desc,
63
+ 'url': url
64
+ }
65
+
66
+ media_search_manager.add_media(title_info)
67
+
68
+ # Return the number of titles found
69
+ return media_search_manager.get_length()
70
+
71
+
72
+ def run_get_select_title():
73
+ """
74
+ Display a selection of titles and prompt the user to choose one.
75
+ """
76
+ return get_select_title(table_show_manager, media_search_manager)
@@ -0,0 +1,58 @@
1
+ # 09.06.24
2
+
3
+ import logging
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 .series import download_thread
14
+
15
+
16
+ # Variable
17
+ indice = 3
18
+ _useFor = "serie"
19
+ _deprecate = False
20
+ _priority = 2
21
+ _engineDownload = "mp4"
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
+
32
+ # Make request to site to get content that corrsisponde to that string
33
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
34
+
35
+ # Search on database
36
+ len_database = title_search(quote_plus(string_to_search))
37
+
38
+ # Return list of elements
39
+ if get_onylDatabase:
40
+ return media_search_manager
41
+
42
+ if len_database > 0:
43
+
44
+ # Select title from list
45
+ select_title = run_get_select_title()
46
+
47
+ # Download only film
48
+ if "Serie TV" in str(select_title.type):
49
+ download_thread(select_title)
50
+
51
+ else:
52
+ logging.error(f"Not supported: {select_title.type}")
53
+
54
+ else:
55
+ console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
56
+
57
+ # Retry
58
+ search()
@@ -0,0 +1,16 @@
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
+ COOKIE = config_manager.get_dict('SITE', SITE_NAME)['extra']
14
+
15
+ SERIES_FOLDER = config_manager.get('DEFAULT', 'serie_folder_name')
16
+ MOVIE_FOLDER = config_manager.get('DEFAULT', 'movie_folder_name')
@@ -0,0 +1,146 @@
1
+ # 13.06.24
2
+
3
+ import os
4
+ import sys
5
+ from urllib.parse import urlparse
6
+
7
+
8
+ # Internal utilities
9
+ from StreamingCommunity.Util.console import console
10
+ from StreamingCommunity.Util.message import start_message
11
+ from StreamingCommunity.Util.os import os_manager
12
+ from StreamingCommunity.Util.table import TVShowManager
13
+ from StreamingCommunity.Lib.Downloader import MP4_downloader
14
+
15
+
16
+ # Logic class
17
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
18
+ from StreamingCommunity.Api.Template.Util import manage_selection, map_episode_title, validate_episode_selection
19
+
20
+
21
+ # Player
22
+ from .util.ScrapeSerie import GetSerieInfo
23
+ from StreamingCommunity.Api.Player.ddl 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_episode_selected: int, scape_info_serie: GetSerieInfo, video_source: VideoSource) -> str:
33
+ """
34
+ Download a single episode video.
35
+
36
+ Parameters:
37
+ - tv_name (str): Name of the TV series.
38
+ - index_episode_selected (int): Index of the selected episode.
39
+
40
+ Return:
41
+ - str: output path
42
+ """
43
+
44
+ start_message()
45
+
46
+ # Get info about episode
47
+ obj_episode = scape_info_serie.list_episodes[index_episode_selected - 1]
48
+ console.print(f"[yellow]Download: [red]{obj_episode.get('name')}")
49
+ print()
50
+
51
+ # Define filename and path for the downloaded video
52
+ title_name = os_manager.get_sanitize_file(
53
+ f"{map_episode_title(scape_info_serie.tv_name, None, index_episode_selected, obj_episode.get('name'))}.mp4"
54
+ )
55
+ mp4_path = os.path.join(ROOT_PATH, SERIES_FOLDER, scape_info_serie.tv_name)
56
+
57
+ # Create output folder
58
+ os_manager.create_path(mp4_path)
59
+
60
+ # Setup video source
61
+ video_source.setup(obj_episode.get('url'))
62
+
63
+ # Get m3u8 master playlist
64
+ master_playlist = video_source.get_playlist()
65
+
66
+ # Parse start page url
67
+ parsed_url = urlparse(obj_episode.get('url'))
68
+
69
+ # Start download
70
+ r_proc = MP4_downloader(
71
+ url=master_playlist,
72
+ path=os.path.join(mp4_path, title_name),
73
+ referer=f"{parsed_url.scheme}://{parsed_url.netloc}/",
74
+ )
75
+
76
+ if r_proc != None:
77
+ console.print("[green]Result: ")
78
+ console.print(r_proc)
79
+
80
+ return os.path.join(mp4_path, title_name)
81
+
82
+
83
+ def download_thread(dict_serie: MediaItem):
84
+ """
85
+ Download all episode of a thread
86
+ """
87
+
88
+ # Start message and set up video source
89
+ start_message()
90
+
91
+ # Init class
92
+ scape_info_serie = GetSerieInfo(dict_serie)
93
+ video_source = VideoSource()
94
+
95
+ # Collect information about thread
96
+ list_dict_episode = scape_info_serie.get_episode_number()
97
+ episodes_count = len(list_dict_episode)
98
+
99
+ # Display episodes list and manage user selection
100
+ last_command = display_episodes_list(scape_info_serie.list_episodes)
101
+ list_episode_select = manage_selection(last_command, episodes_count)
102
+
103
+ try:
104
+ list_episode_select = validate_episode_selection(list_episode_select, episodes_count)
105
+ except ValueError as e:
106
+ console.print(f"[red]{str(e)}")
107
+ return
108
+
109
+ # Download selected episodes
110
+ for i_episode in list_episode_select:
111
+ download_video(i_episode, scape_info_serie, video_source)
112
+
113
+
114
+ def display_episodes_list(obj_episode_manager) -> str:
115
+ """
116
+ Display episodes list and handle user input.
117
+
118
+ Returns:
119
+ last_command (str): Last command entered by the user.
120
+ """
121
+
122
+ # Set up table for displaying episodes
123
+ table_show_manager.set_slice_end(10)
124
+
125
+ # Add columns to the table
126
+ column_info = {
127
+ "Index": {'color': 'red'},
128
+ "Name": {'color': 'magenta'},
129
+ }
130
+ table_show_manager.add_column(column_info)
131
+
132
+ # Populate the table with episodes information
133
+ for i, media in enumerate(obj_episode_manager):
134
+ table_show_manager.add_tv_show({
135
+ 'Index': str(i+1),
136
+ 'Name': media.get('name'),
137
+ })
138
+
139
+ # Run the table and handle user input
140
+ last_command = table_show_manager.run()
141
+
142
+ if last_command == "q":
143
+ console.print("\n[red]Quit [white]...")
144
+ sys.exit(0)
145
+
146
+ return last_command
@@ -0,0 +1,95 @@
1
+ # 09.06.24
2
+
3
+ import logging
4
+
5
+
6
+ # External libraries
7
+ import httpx
8
+ from bs4 import BeautifulSoup
9
+
10
+
11
+ # Internal utilities
12
+ from StreamingCommunity.Util.console import console
13
+ from StreamingCommunity.Util._jsonConfig import config_manager
14
+ from StreamingCommunity.Util.headers import get_headers
15
+ from StreamingCommunity.Util.table import TVShowManager
16
+
17
+
18
+ # Logic class
19
+ from StreamingCommunity.Api.Template import get_select_title
20
+ from StreamingCommunity.Api.Template.Util import search_domain
21
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaManager
22
+
23
+
24
+ # Variable
25
+ from .costant import SITE_NAME
26
+ media_search_manager = MediaManager()
27
+ table_show_manager = TVShowManager()
28
+
29
+
30
+ def title_search(word_to_search: str) -> int:
31
+ """
32
+ Search for titles based on a search query.
33
+
34
+ Parameters:
35
+ - title_search (str): The title to search for.
36
+
37
+ Returns:
38
+ - int: The number of titles found.
39
+ """
40
+ media_search_manager.clear()
41
+ table_show_manager.clear()
42
+
43
+ # Find new domain if prev dont work
44
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
45
+ domain_to_use, _ = search_domain(SITE_NAME, f"https://{SITE_NAME}")
46
+
47
+ # Send request to search for titles
48
+ try:
49
+ response = httpx.get(
50
+ url=f"https://{SITE_NAME}.{domain_to_use}/search/?&q={word_to_search}&quick=1&type=videobox_video&nodes=11",
51
+ headers={'user-agent': get_headers()},
52
+ timeout=max_timeout
53
+ )
54
+ response.raise_for_status()
55
+
56
+ except Exception as e:
57
+ console.print(f"Site: {SITE_NAME}, request search error: {e}")
58
+
59
+ # Create soup and find table
60
+ soup = BeautifulSoup(response.text, "html.parser")
61
+ table_content = soup.find('ol', class_="ipsStream")
62
+
63
+ if table_content:
64
+ for title_div in table_content.find_all('li', class_='ipsStreamItem'):
65
+ try:
66
+
67
+ title_type = title_div.find("p", class_="ipsType_reset").find_all("a")[-1].get_text(strip=True)
68
+ name = title_div.find("span", class_="ipsContained").find("a").get_text(strip=True)
69
+ link = title_div.find("span", class_="ipsContained").find("a").get("href")
70
+
71
+ title_info = {
72
+ 'name': name,
73
+ 'url': link,
74
+ 'type': title_type
75
+ }
76
+
77
+ media_search_manager.add_media(title_info)
78
+
79
+ except Exception as e:
80
+ logging.error(f"Error processing title div: {e}")
81
+
82
+ return media_search_manager.get_length()
83
+
84
+ else:
85
+ logging.error("No table content found.")
86
+ return -999
87
+
88
+ return -9999
89
+
90
+
91
+ def run_get_select_title():
92
+ """
93
+ Display a selection of titles and prompt the user to choose one.
94
+ """
95
+ return get_select_title(table_show_manager, media_search_manager)
@@ -0,0 +1,85 @@
1
+ # 13.06.24
2
+
3
+ import sys
4
+ import logging
5
+ from typing import List, Dict
6
+
7
+
8
+ # External libraries
9
+ import httpx
10
+ from bs4 import BeautifulSoup
11
+
12
+
13
+ # Internal utilities
14
+ from StreamingCommunity.Util._jsonConfig import config_manager
15
+ from StreamingCommunity.Util.headers import get_headers
16
+
17
+
18
+ # Logic class
19
+ from StreamingCommunity.Api.Template.Class.SearchType import MediaItem
20
+
21
+
22
+ # Variable
23
+ from ..costant import COOKIE
24
+ max_timeout = config_manager.get_int("REQUESTS", "timeout")
25
+
26
+
27
+ class GetSerieInfo:
28
+ def __init__(self, dict_serie: MediaItem) -> None:
29
+ """
30
+ Initializes the GetSerieInfo object with default values.
31
+
32
+ Parameters:
33
+ - dict_serie (MediaItem): Dictionary containing series information (optional).
34
+ """
35
+ self.headers = {'user-agent': get_headers()}
36
+ self.cookies = COOKIE
37
+ self.url = dict_serie.url
38
+ self.tv_name = None
39
+ self.list_episodes = None
40
+
41
+ def get_episode_number(self) -> List[Dict[str, str]]:
42
+ """
43
+ Retrieves the number of episodes for a specific season.
44
+
45
+ Parameters:
46
+ n_season (int): The season number.
47
+
48
+ Returns:
49
+ List[Dict[str, str]]: List of dictionaries containing episode information.
50
+ """
51
+
52
+ try:
53
+ response = httpx.get(f"{self.url}?area=online", cookies=self.cookies, headers=self.headers, timeout=max_timeout)
54
+ response.raise_for_status()
55
+
56
+ except Exception as e:
57
+ logging.error(f"Insert value for [ips4_device_key, ips4_member_id, ips4_login_key] in config.json file SITE \\ ddlstreamitaly \\ cookie. Use browser debug and cookie request with a valid account, filter by DOC. Error: {e}")
58
+ sys.exit(0)
59
+
60
+ # Parse HTML content of the page
61
+ soup = BeautifulSoup(response.text, "html.parser")
62
+
63
+ # Get tv name
64
+ self.tv_name = soup.find("span", class_= "ipsType_break").get_text(strip=True)
65
+
66
+ # Find the container of episodes for the specified season
67
+ table_content = soup.find('div', class_='ipsMargin_bottom:half')
68
+ list_dict_episode = []
69
+
70
+ for episode_div in table_content.find_all('a', href=True):
71
+
72
+ # Get text of episode
73
+ part_name = episode_div.get_text(strip=True)
74
+
75
+ if part_name:
76
+ obj_episode = {
77
+ 'name': part_name,
78
+ 'url': episode_div['href']
79
+ }
80
+
81
+ list_dict_episode.append(obj_episode)
82
+
83
+ self.list_episodes = list_dict_episode
84
+ return list_dict_episode
85
+
@@ -0,0 +1,53 @@
1
+ # 09.06.24
2
+
3
+ from urllib.parse import quote_plus
4
+
5
+
6
+ # Internal utilities
7
+ from StreamingCommunity.Util.console import console, msg
8
+
9
+
10
+ # Logic class
11
+ from .site import title_search, run_get_select_title, media_search_manager
12
+ from .series import download_series
13
+
14
+
15
+ # Variable
16
+ indice = 4
17
+ _useFor = "serie"
18
+ _deprecate = False
19
+ _priority = 2
20
+ _engineDownload = "hls"
21
+ from .costant import SITE_NAME
22
+
23
+
24
+ def search(string_to_search: str = None, get_onylDatabase: bool = False):
25
+ """
26
+ Main function of the application for film and series.
27
+ """
28
+
29
+ if string_to_search is None:
30
+
31
+ # Make request to site to get content that corrsisponde to that string
32
+ string_to_search = msg.ask(f"\n[purple]Insert word to search in [red]{SITE_NAME}").strip()
33
+
34
+ # Search on database
35
+ len_database = title_search(quote_plus(string_to_search))
36
+
37
+ # Return list of elements
38
+ if get_onylDatabase:
39
+ return media_search_manager
40
+
41
+ if len_database > 0:
42
+
43
+ # Select title from list
44
+ select_title = run_get_select_title()
45
+
46
+ # Download only film
47
+ download_series(select_title)
48
+
49
+ else:
50
+ console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
51
+
52
+ # Retry
53
+ 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')