StreamingCommunity 1.9.1__py3-none-any.whl → 1.9.2__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 (96) hide show
  1. StreamingCommunity/run.py +2 -3
  2. {StreamingCommunity-1.9.1.dist-info → StreamingCommunity-1.9.2.dist-info}/METADATA +32 -4
  3. StreamingCommunity-1.9.2.dist-info/RECORD +7 -0
  4. {StreamingCommunity-1.9.1.dist-info → StreamingCommunity-1.9.2.dist-info}/WHEEL +1 -1
  5. {StreamingCommunity-1.9.1.dist-info → StreamingCommunity-1.9.2.dist-info}/entry_points.txt +1 -0
  6. StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py +0 -143
  7. StreamingCommunity/Api/Player/Helper/Vixcloud/util.py +0 -166
  8. StreamingCommunity/Api/Player/ddl.py +0 -89
  9. StreamingCommunity/Api/Player/maxstream.py +0 -151
  10. StreamingCommunity/Api/Player/supervideo.py +0 -194
  11. StreamingCommunity/Api/Player/vixcloud.py +0 -224
  12. StreamingCommunity/Api/Site/1337xx/__init__.py +0 -50
  13. StreamingCommunity/Api/Site/1337xx/costant.py +0 -15
  14. StreamingCommunity/Api/Site/1337xx/site.py +0 -84
  15. StreamingCommunity/Api/Site/1337xx/title.py +0 -66
  16. StreamingCommunity/Api/Site/altadefinizione/__init__.py +0 -50
  17. StreamingCommunity/Api/Site/altadefinizione/costant.py +0 -15
  18. StreamingCommunity/Api/Site/altadefinizione/film.py +0 -69
  19. StreamingCommunity/Api/Site/altadefinizione/site.py +0 -86
  20. StreamingCommunity/Api/Site/animeunity/__init__.py +0 -50
  21. StreamingCommunity/Api/Site/animeunity/costant.py +0 -15
  22. StreamingCommunity/Api/Site/animeunity/film_serie.py +0 -130
  23. StreamingCommunity/Api/Site/animeunity/site.py +0 -165
  24. StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +0 -97
  25. StreamingCommunity/Api/Site/bitsearch/__init__.py +0 -51
  26. StreamingCommunity/Api/Site/bitsearch/costant.py +0 -15
  27. StreamingCommunity/Api/Site/bitsearch/site.py +0 -84
  28. StreamingCommunity/Api/Site/bitsearch/title.py +0 -47
  29. StreamingCommunity/Api/Site/cb01new/__init__.py +0 -51
  30. StreamingCommunity/Api/Site/cb01new/costant.py +0 -15
  31. StreamingCommunity/Api/Site/cb01new/film.py +0 -69
  32. StreamingCommunity/Api/Site/cb01new/site.py +0 -74
  33. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +0 -57
  34. StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +0 -16
  35. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +0 -141
  36. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +0 -93
  37. StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +0 -85
  38. StreamingCommunity/Api/Site/guardaserie/__init__.py +0 -52
  39. StreamingCommunity/Api/Site/guardaserie/costant.py +0 -15
  40. StreamingCommunity/Api/Site/guardaserie/series.py +0 -195
  41. StreamingCommunity/Api/Site/guardaserie/site.py +0 -84
  42. StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +0 -110
  43. StreamingCommunity/Api/Site/mostraguarda/__init__.py +0 -48
  44. StreamingCommunity/Api/Site/mostraguarda/costant.py +0 -15
  45. StreamingCommunity/Api/Site/mostraguarda/film.py +0 -94
  46. StreamingCommunity/Api/Site/piratebays/__init__.py +0 -50
  47. StreamingCommunity/Api/Site/piratebays/costant.py +0 -15
  48. StreamingCommunity/Api/Site/piratebays/site.py +0 -89
  49. StreamingCommunity/Api/Site/piratebays/title.py +0 -45
  50. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +0 -55
  51. StreamingCommunity/Api/Site/streamingcommunity/costant.py +0 -15
  52. StreamingCommunity/Api/Site/streamingcommunity/film.py +0 -70
  53. StreamingCommunity/Api/Site/streamingcommunity/series.py +0 -205
  54. StreamingCommunity/Api/Site/streamingcommunity/site.py +0 -126
  55. StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +0 -113
  56. StreamingCommunity/Api/Template/Class/SearchType.py +0 -101
  57. StreamingCommunity/Api/Template/Util/__init__.py +0 -5
  58. StreamingCommunity/Api/Template/Util/get_domain.py +0 -137
  59. StreamingCommunity/Api/Template/Util/manage_ep.py +0 -153
  60. StreamingCommunity/Api/Template/Util/recall_search.py +0 -37
  61. StreamingCommunity/Api/Template/__init__.py +0 -3
  62. StreamingCommunity/Api/Template/site.py +0 -87
  63. StreamingCommunity/Lib/Downloader/HLS/downloader.py +0 -968
  64. StreamingCommunity/Lib/Downloader/HLS/proxyes.py +0 -110
  65. StreamingCommunity/Lib/Downloader/HLS/segments.py +0 -538
  66. StreamingCommunity/Lib/Downloader/MP4/downloader.py +0 -156
  67. StreamingCommunity/Lib/Downloader/TOR/downloader.py +0 -222
  68. StreamingCommunity/Lib/Downloader/__init__.py +0 -5
  69. StreamingCommunity/Lib/Driver/driver_1.py +0 -76
  70. StreamingCommunity/Lib/FFmpeg/__init__.py +0 -4
  71. StreamingCommunity/Lib/FFmpeg/capture.py +0 -170
  72. StreamingCommunity/Lib/FFmpeg/command.py +0 -292
  73. StreamingCommunity/Lib/FFmpeg/util.py +0 -242
  74. StreamingCommunity/Lib/M3U8/__init__.py +0 -6
  75. StreamingCommunity/Lib/M3U8/decryptor.py +0 -164
  76. StreamingCommunity/Lib/M3U8/estimator.py +0 -176
  77. StreamingCommunity/Lib/M3U8/parser.py +0 -666
  78. StreamingCommunity/Lib/M3U8/url_fixer.py +0 -52
  79. StreamingCommunity/Lib/TMBD/__init__.py +0 -2
  80. StreamingCommunity/Lib/TMBD/obj_tmbd.py +0 -39
  81. StreamingCommunity/Lib/TMBD/tmdb.py +0 -346
  82. StreamingCommunity/Upload/update.py +0 -68
  83. StreamingCommunity/Upload/version.py +0 -5
  84. StreamingCommunity/Util/_jsonConfig.py +0 -204
  85. StreamingCommunity/Util/call_stack.py +0 -42
  86. StreamingCommunity/Util/color.py +0 -20
  87. StreamingCommunity/Util/console.py +0 -12
  88. StreamingCommunity/Util/ffmpeg_installer.py +0 -275
  89. StreamingCommunity/Util/headers.py +0 -147
  90. StreamingCommunity/Util/logger.py +0 -53
  91. StreamingCommunity/Util/message.py +0 -46
  92. StreamingCommunity/Util/os.py +0 -514
  93. StreamingCommunity/Util/table.py +0 -163
  94. StreamingCommunity-1.9.1.dist-info/RECORD +0 -95
  95. {StreamingCommunity-1.9.1.dist-info → StreamingCommunity-1.9.2.dist-info}/LICENSE +0 -0
  96. {StreamingCommunity-1.9.1.dist-info → StreamingCommunity-1.9.2.dist-info}/top_level.txt +0 -0
StreamingCommunity/run.py CHANGED
@@ -16,7 +16,7 @@ from StreamingCommunity.Util.message import start_message
16
16
  from StreamingCommunity.Util.console import console, msg
17
17
  from StreamingCommunity.Util._jsonConfig import config_manager
18
18
  from StreamingCommunity.Upload.update import update as git_update
19
- from StreamingCommunity.Util.os import OsSummary
19
+ from StreamingCommunity.Util.os import os_summary
20
20
  from StreamingCommunity.Lib.TMBD import tmdb
21
21
  from StreamingCommunity.Util.logger import Logger
22
22
 
@@ -108,7 +108,6 @@ def initialize():
108
108
  start_message()
109
109
 
110
110
  # Get system info
111
- os_summary = OsSummary()
112
111
  os_summary.get_system_summary()
113
112
 
114
113
  # Set terminal size for win 7
@@ -133,7 +132,7 @@ def initialize():
133
132
  print()
134
133
  tmdb.display_trending_tv_shows()
135
134
  print()
136
-
135
+
137
136
 
138
137
  def main():
139
138
 
@@ -1,14 +1,16 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: StreamingCommunity
3
- Version: 1.9.1
3
+ Version: 1.9.2
4
+ Summary: UNKNOWN
4
5
  Home-page: https://github.com/Lovi-0/StreamingCommunity
5
6
  Author: Lovi-0
7
+ License: UNKNOWN
6
8
  Project-URL: Bug Reports, https://github.com/Lovi-0/StreamingCommunity/issues
7
9
  Project-URL: Source, https://github.com/Lovi-0/StreamingCommunity
8
10
  Keywords: streaming community
11
+ Platform: UNKNOWN
9
12
  Requires-Python: >=3.8
10
13
  Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
14
  Requires-Dist: httpx
13
15
  Requires-Dist: bs4
14
16
  Requires-Dist: rich
@@ -223,7 +225,7 @@ The configuration file is divided into several main sections:
223
225
  * `%(episode)` : Is the number of the episode
224
226
  * `%(episode_name)` : Is the name of the episode
225
227
  `<br/><br/>`
226
-
228
+
227
229
  - `not_close`: If true, continues running after downloading
228
230
  - `show_trending`: Display trending content on startup
229
231
 
@@ -340,6 +342,24 @@ forced-ita hin - Hindi pol - Polish tur - Turkish
340
342
 
341
343
  <br>
342
344
 
345
+
346
+ # COMMAND
347
+
348
+
349
+ - Download a specific season by entering its number.
350
+ * **Example:** `1` will download *Season 1* only.
351
+
352
+ - Use the wildcard `*` to download every available season.
353
+ * **Example:** `*` will download all seasons in the series.
354
+
355
+ - Specify a range of seasons using a hyphen `-`.
356
+ * **Example:** `1-2` will download *Seasons 1 and 2*.
357
+
358
+ - Enter a season number followed by `-*` to download from that season to the end.
359
+ * **Example:** `3-*` will download from *Season 3* to the final season.
360
+
361
+ <br>
362
+
343
363
  # Docker
344
364
 
345
365
  You can run the script in a docker container, to build the image just run
@@ -397,7 +417,13 @@ The `run-container` command mounts also the `config.json` file, so any change to
397
417
 
398
418
  # To Do
399
419
 
400
- - Create website API
420
+ - Create website API -> https://github.com/Lovi-0/StreamingCommunity/tree/test_gui_1
421
+
422
+ # SUPPORT
423
+
424
+ If you'd like to support this project, consider making a donation!
425
+
426
+ [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=UXTWMT8P6HE2C)
401
427
 
402
428
  # Contributing
403
429
 
@@ -412,3 +438,5 @@ Contributions are welcome! Steps:
412
438
  # Disclaimer
413
439
 
414
440
  This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
441
+
442
+
@@ -0,0 +1,7 @@
1
+ StreamingCommunity/run.py,sha256=BAzw-SNIbpt6myDn9wfNezb3E3Lv7GZwIup0ze4vJQs,6727
2
+ StreamingCommunity-1.9.2.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
3
+ StreamingCommunity-1.9.2.dist-info/METADATA,sha256=8E2sNWKuPEVe11ExXRG7rj5PaiKMf31778vnykY9rVI,11623
4
+ StreamingCommunity-1.9.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
5
+ StreamingCommunity-1.9.2.dist-info/entry_points.txt,sha256=-iQU6qfeHFwauAg4iZhifWhNZAkiV-x3XuEauo_EjUc,68
6
+ StreamingCommunity-1.9.2.dist-info/top_level.txt,sha256=YsOcxKP-WOhWpIWgBlh0coll9XUx7aqmRPT7kmt3fH0,19
7
+ StreamingCommunity-1.9.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  streamingcommunity = StreamingCommunity.run:main
3
+
@@ -1,143 +0,0 @@
1
- # 26.11.24
2
- # !!! DIO CANErino
3
-
4
- import re
5
-
6
-
7
- class JavaScriptParser:
8
- @staticmethod
9
- def fix_string(ss):
10
- if ss is None:
11
- return None
12
-
13
- ss = str(ss)
14
- ss = ss.encode('utf-8').decode('unicode-escape')
15
- ss = ss.strip("\"'")
16
- ss = ss.strip()
17
-
18
- return ss
19
-
20
- @staticmethod
21
- def fix_url(url):
22
- if url is None:
23
- return None
24
-
25
- url = url.replace('\\/', '/')
26
- return url
27
-
28
- @staticmethod
29
- def parse_value(value):
30
- value = JavaScriptParser.fix_string(value)
31
-
32
- if 'http' in str(value) or 'https' in str(value):
33
- return JavaScriptParser.fix_url(value)
34
-
35
- if value is None or str(value).lower() == 'null':
36
- return None
37
- if str(value).lower() == 'true':
38
- return True
39
- if str(value).lower() == 'false':
40
- return False
41
-
42
- try:
43
- return int(value)
44
- except ValueError:
45
- try:
46
- return float(value)
47
- except ValueError:
48
- pass
49
-
50
- return value
51
-
52
- @staticmethod
53
- def parse_object(obj_str):
54
- obj_str = obj_str.strip('{}').strip()
55
-
56
- result = {}
57
- key_value_pairs = re.findall(r'([\'"]?[\w]+[\'"]?)\s*:\s*([^,{}]+|{[^}]*}|\[[^\]]*\]|\'[^\']*\'|"[^"]*")', obj_str)
58
-
59
- for key, value in key_value_pairs:
60
- key = JavaScriptParser.fix_string(key)
61
- value = value.strip()
62
-
63
- if value.startswith('{'):
64
- result[key] = JavaScriptParser.parse_object(value)
65
- elif value.startswith('['):
66
- result[key] = JavaScriptParser.parse_array(value)
67
- else:
68
- result[key] = JavaScriptParser.parse_value(value)
69
-
70
- return result
71
-
72
- @staticmethod
73
- def parse_array(arr_str):
74
- arr_str = arr_str.strip('[]').strip()
75
- result = []
76
-
77
- elements = []
78
- current_elem = ""
79
- brace_count = 0
80
- in_string = False
81
- quote_type = None
82
-
83
- for char in arr_str:
84
- if char in ['"', "'"]:
85
- if not in_string:
86
- in_string = True
87
- quote_type = char
88
- elif quote_type == char:
89
- in_string = False
90
- quote_type = None
91
-
92
- if not in_string:
93
- if char == '{':
94
- brace_count += 1
95
- elif char == '}':
96
- brace_count -= 1
97
- elif char == ',' and brace_count == 0:
98
- elements.append(current_elem.strip())
99
- current_elem = ""
100
- continue
101
-
102
- current_elem += char
103
-
104
- if current_elem.strip():
105
- elements.append(current_elem.strip())
106
-
107
- for elem in elements:
108
- elem = elem.strip()
109
-
110
- if elem.startswith('{'):
111
- result.append(JavaScriptParser.parse_object(elem))
112
- elif 'active' in elem or 'url' in elem:
113
- key_value_match = re.search(r'([\w]+)\":([^,}]+)', elem)
114
-
115
- if key_value_match:
116
- key = key_value_match.group(1)
117
- value = key_value_match.group(2)
118
- result[-1][key] = JavaScriptParser.parse_value(value.strip('"\\'))
119
- else:
120
- result.append(JavaScriptParser.parse_value(elem))
121
-
122
- return result
123
-
124
- @classmethod
125
- def parse(cls, js_string):
126
- assignments = re.findall(r'window\.(\w+)\s*=\s*([^;]+);?', js_string, re.DOTALL)
127
- result = {}
128
-
129
- for var_name, value in assignments:
130
- value = value.strip()
131
-
132
- if value.startswith('{'):
133
- result[var_name] = cls.parse_object(value)
134
- elif value.startswith('['):
135
- result[var_name] = cls.parse_array(value)
136
- else:
137
- result[var_name] = cls.parse_value(value)
138
-
139
- can_play_fhd_match = re.search(r'window\.canPlayFHD\s*=\s*(\w+);?', js_string)
140
- if can_play_fhd_match:
141
- result['canPlayFHD'] = cls.parse_value(can_play_fhd_match.group(1))
142
-
143
- return result
@@ -1,166 +0,0 @@
1
- # 23.11.24
2
-
3
- import re
4
- import logging
5
- from typing import Dict, Any, List, Union
6
-
7
-
8
- class Episode:
9
- def __init__(self, data: Dict[str, Any]):
10
- self.id: int = data.get('id', '')
11
- self.number: int = data.get('number', '')
12
- self.name: str = data.get('name', '')
13
- self.plot: str = data.get('plot', '')
14
- self.duration: int = data.get('duration', '')
15
-
16
- def __str__(self):
17
- return f"Episode(id={self.id}, number={self.number}, name='{self.name}', plot='{self.plot}', duration={self.duration} sec)"
18
-
19
- class EpisodeManager:
20
- def __init__(self):
21
- self.episodes: List[Episode] = []
22
-
23
- def add_episode(self, episode_data: Dict[str, Any]):
24
- """
25
- Add a new episode to the manager.
26
-
27
- Parameters:
28
- - episode_data (Dict[str, Any]): A dictionary containing data for the new episode.
29
- """
30
- episode = Episode(episode_data)
31
- self.episodes.append(episode)
32
-
33
- def get_length(self) -> int:
34
- """
35
- Get the number of episodes in the manager.
36
-
37
- Returns:
38
- int: Number of episodes.
39
- """
40
- return len(self.episodes)
41
-
42
- def clear(self) -> None:
43
- """
44
- This method clears the episodes list.
45
-
46
- Parameters:
47
- - self: The object instance.
48
- """
49
- self.episodes.clear()
50
-
51
- def __str__(self):
52
- return f"EpisodeManager(num_episodes={len(self.episodes)})"
53
-
54
-
55
- class Season:
56
- def __init__(self, season_data: Dict[str, Union[int, str, None]]):
57
- self.id: int = season_data.get('id')
58
- self.number: int = season_data.get('number')
59
- self.name: str = season_data.get('name')
60
- self.plot: str = season_data.get('plot')
61
- self.episodes_count: int = season_data.get('episodes_count')
62
-
63
- def __str__(self):
64
- return f"Season(id={self.id}, number={self.number}, name='{self.name}', plot='{self.plot}', episodes_count={self.episodes_count})"
65
-
66
- class SeasonManager:
67
- def __init__(self):
68
- self.seasons: List[Season] = []
69
-
70
- def add_season(self, season_data: Dict[str, Union[int, str, None]]):
71
- """
72
- Add a new season to the manager.
73
-
74
- Parameters:
75
- season_data (Dict[str, Union[int, str, None]]): A dictionary containing data for the new season.
76
- """
77
- season = Season(season_data)
78
- self.seasons.append(season)
79
-
80
- def get(self, index: int) -> Season:
81
- """
82
- Get a season item from the list by index.
83
-
84
- Parameters:
85
- index (int): The index of the seasons item to retrieve.
86
-
87
- Returns:
88
- Season: The media item at the specified index.
89
- """
90
- return self.media_list[index]
91
-
92
- def get_length(self) -> int:
93
- """
94
- Get the number of seasons in the manager.
95
-
96
- Returns:
97
- int: Number of seasons.
98
- """
99
- return len(self.seasons)
100
-
101
- def clear(self) -> None:
102
- """
103
- This method clears the seasons list.
104
-
105
- Parameters:
106
- self: The object instance.
107
- """
108
- self.seasons.clear()
109
-
110
- def __str__(self):
111
- return f"SeasonManager(num_seasons={len(self.seasons)})"
112
-
113
-
114
- class Stream:
115
- def __init__(self, name: str, url: str, active: bool):
116
- self.name = name
117
- self.url = url
118
- self.active = active
119
-
120
- def __repr__(self):
121
- return f"Stream(name={self.name!r}, url={self.url!r}, active={self.active!r})"
122
-
123
- class StreamsCollection:
124
- def __init__(self, streams: list):
125
- self.streams = [Stream(**stream) for stream in streams]
126
-
127
- def __repr__(self):
128
- return f"StreamsCollection(streams={self.streams})"
129
-
130
- def add_stream(self, name: str, url: str, active: bool):
131
- self.streams.append(Stream(name, url, active))
132
-
133
- def get_streams(self):
134
- return self.streams
135
-
136
-
137
- class WindowVideo:
138
- def __init__(self, data: Dict[str, Any]):
139
- self.data = data
140
- self.id: int = data.get('id', '')
141
- self.name: str = data.get('name', '')
142
- self.filename: str = data.get('filename', '')
143
- self.size: str = data.get('size', '')
144
- self.quality: str = data.get('quality', '')
145
- self.duration: str = data.get('duration', '')
146
- self.views: int = data.get('views', '')
147
- self.is_viewable: bool = data.get('is_viewable', '')
148
- self.status: str = data.get('status', '')
149
- self.fps: float = data.get('fps', '')
150
- self.legacy: bool = data.get('legacy', '')
151
- self.folder_id: int = data.get('folder_id', '')
152
- self.created_at_diff: str = data.get('created_at_diff', '')
153
-
154
- def __str__(self):
155
- return f"WindowVideo(id={self.id}, name='{self.name}', filename='{self.filename}', size='{self.size}', quality='{self.quality}', duration='{self.duration}', views={self.views}, is_viewable={self.is_viewable}, status='{self.status}', fps={self.fps}, legacy={self.legacy}, folder_id={self.folder_id}, created_at_diff='{self.created_at_diff}')"
156
-
157
- class WindowParameter:
158
- def __init__(self, data: Dict[str, Any]):
159
- self.data = data
160
- params = data.get('params', {})
161
- self.token: str = params.get('token', '')
162
- self.expires: str = str(params.get('expires', ''))
163
- self.url = data.get('url')
164
-
165
- def __str__(self):
166
- return (f"WindowParameter(token='{self.token}', expires='{self.expires}', url='{self.url}', data={self.data})")
@@ -1,89 +0,0 @@
1
- # 14.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._jsonConfig import config_manager
13
- from StreamingCommunity.Util.headers import get_headers
14
-
15
-
16
- # Variable
17
- from StreamingCommunity.Api.Site.ddlstreamitaly.costant import COOKIE
18
- max_timeout = config_manager.get_int("REQUESTS", "timeout")
19
-
20
-
21
- class VideoSource:
22
- def __init__(self) -> None:
23
- """
24
- Initializes the VideoSource object with default values.
25
- """
26
- self.headers = {'user-agent': get_headers()}
27
- self.cookie = COOKIE
28
-
29
- def setup(self, url: str) -> None:
30
- """
31
- Sets up the video source with the provided URL.
32
-
33
- Parameters:
34
- - url (str): The URL of the video source.
35
- """
36
- self.url = url
37
-
38
- def make_request(self, url: str) -> str:
39
- """
40
- Make an HTTP GET request to the provided URL.
41
-
42
- Parameters:
43
- - url (str): The URL to make the request to.
44
-
45
- Returns:
46
- - str: The response content if successful, None otherwise.
47
- """
48
- try:
49
- response = httpx.get(
50
- url=url,
51
- headers=self.headers,
52
- cookies=self.cookie,
53
- timeout=max_timeout
54
- )
55
- response.raise_for_status()
56
-
57
- return response.text
58
-
59
- except Exception as err:
60
- logging.error(f"An error occurred: {err}")
61
-
62
- return None
63
-
64
- def get_playlist(self):
65
- """
66
- Retrieves the playlist URL from the video source.
67
-
68
- Returns:
69
- - tuple: The mp4 link if found, None otherwise.
70
- """
71
- try:
72
- text = self.make_request(self.url)
73
-
74
- if text:
75
- soup = BeautifulSoup(text, "html.parser")
76
- source = soup.find("source")
77
-
78
- if source:
79
- mp4_link = source.get("src")
80
- return mp4_link
81
-
82
- else:
83
- logging.error("No <source> tag found in the HTML.")
84
-
85
- else:
86
- logging.error("Failed to retrieve content from the URL.")
87
-
88
- except Exception as e:
89
- logging.error(f"An error occurred while parsing the playlist: {e}")
@@ -1,151 +0,0 @@
1
- # 05.07.24
2
-
3
- import re
4
- import logging
5
-
6
-
7
- # External libraries
8
- import httpx
9
- import jsbeautifier
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
- # Variable
19
- max_timeout = config_manager.get_int("REQUESTS", "timeout")
20
-
21
-
22
- class VideoSource:
23
- def __init__(self, url: str):
24
- """
25
- Sets up the video source with the provided URL.
26
-
27
- Parameters:
28
- - url (str): The URL of the video.
29
- """
30
- self.url = url
31
- self.redirect_url = None
32
- self.maxstream_url = None
33
- self.m3u8_url = None
34
- self.headers = {'user-agent': get_headers()}
35
-
36
- def get_redirect_url(self):
37
- """
38
- Sends a request to the initial URL and extracts the redirect URL.
39
- """
40
- try:
41
-
42
- # Send a GET request to the initial URL
43
- response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=max_timeout)
44
- response.raise_for_status()
45
-
46
- # Extract the redirect URL from the HTML
47
- soup = BeautifulSoup(response.text, "html.parser")
48
- self.redirect_url = soup.find("div", id="iframen1").get("data-src")
49
- logging.info(f"Redirect URL: {self.redirect_url}")
50
-
51
- return self.redirect_url
52
-
53
- except httpx.RequestError as e:
54
- logging.error(f"Error during the initial request: {e}")
55
- raise
56
-
57
- except AttributeError as e:
58
- logging.error(f"Error parsing HTML: {e}")
59
- raise
60
-
61
- def get_maxstream_url(self):
62
- """
63
- Sends a request to the redirect URL and extracts the Maxstream URL.
64
- """
65
- try:
66
-
67
- # Send a GET request to the redirect URL
68
- response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=max_timeout)
69
- response.raise_for_status()
70
-
71
- # Extract the Maxstream URL from the HTML
72
- soup = BeautifulSoup(response.text, "html.parser")
73
- maxstream_url = soup.find("a")
74
-
75
- if maxstream_url is None:
76
-
77
- # If no anchor tag is found, try the alternative method
78
- logging.warning("Anchor tag not found. Trying the alternative method.")
79
- headers = {
80
- 'origin': 'https://stayonline.pro',
81
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 OPR/111.0.0.0',
82
- 'x-requested-with': 'XMLHttpRequest',
83
- }
84
-
85
- # Make request to stayonline api
86
- data = {'id': self.redirect_url.split("/")[-2], 'ref': ''}
87
- response = httpx.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data)
88
- response.raise_for_status()
89
- uprot_url = response.json()['data']['value']
90
-
91
- # Retry getting maxtstream url
92
- response = httpx.get(uprot_url, headers=self.headers, follow_redirects=True, timeout=max_timeout)
93
- response.raise_for_status()
94
- soup = BeautifulSoup(response.text, "html.parser")
95
- maxstream_url = soup.find("a").get("href")
96
-
97
- else:
98
- maxstream_url = maxstream_url.get("href")
99
-
100
- self.maxstream_url = maxstream_url
101
- logging.info(f"Maxstream URL: {self.maxstream_url}")
102
-
103
- return self.maxstream_url
104
-
105
- except httpx.RequestError as e:
106
- logging.error(f"Error during the request to the redirect URL: {e}")
107
- raise
108
-
109
- except AttributeError as e:
110
- logging.error(f"Error parsing HTML: {e}")
111
- raise
112
-
113
- def get_m3u8_url(self):
114
- """
115
- Sends a request to the Maxstream URL and extracts the .m3u8 file URL.
116
- """
117
- try:
118
-
119
- # Send a GET request to the Maxstream URL
120
- response = httpx.get(self.maxstream_url, headers=self.headers, follow_redirects=True, timeout=max_timeout)
121
- response.raise_for_status()
122
- soup = BeautifulSoup(response.text, "html.parser")
123
-
124
- # Iterate over all script tags in the HTML
125
- for script in soup.find_all("script"):
126
- if "eval(function(p,a,c,k,e,d)" in script.text:
127
-
128
- # Execute the script using
129
- data_js = jsbeautifier.beautify(script.text)
130
-
131
- # Extract the .m3u8 URL from the script's output
132
- match = re.search(r'sources:\s*\[\{\s*src:\s*"([^"]+)"', data_js)
133
-
134
- if match:
135
- self.m3u8_url = match.group(1)
136
- logging.info(f"M3U8 URL: {self.m3u8_url}")
137
- break
138
-
139
- return self.m3u8_url
140
-
141
- except Exception as e:
142
- logging.error(f"Error executing the Node.js script: {e}")
143
- raise
144
-
145
- def get_playlist(self):
146
- """
147
- Executes the entire flow to obtain the final .m3u8 file URL.
148
- """
149
- self.get_redirect_url()
150
- self.get_maxstream_url()
151
- return self.get_m3u8_url()