Skip to content

Commit 782b03d

Browse files
authored
Bump v3.0.2
* Add api "StreamingWatch" * Add hdplayer --------- Co-authored-by: Lovi <[email protected]>
1 parent bd922af commit 782b03d

File tree

23 files changed

+1040
-177
lines changed

23 files changed

+1040
-177
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ cmd.txt
5252
bot_config.json
5353
scripts.json
5454
active_requests.json
55-
domains.json
55+
domains.json
56+
working_proxies.json

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,13 +797,27 @@ Contributions are welcome! Steps:
797797
4. Push to branch (`git push origin feature/AmazingFeature`)
798798
5. Open Pull Request
799799

800-
801800
# Disclaimer
802801

803802
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.
804803

804+
## Useful Project
805+
806+
### 🎯 [Unit3Dup](https://github.com/31December99/Unit3Dup)
807+
Bot in Python per la generazione e l'upload automatico di torrent su tracker basati su Unit3D.
808+
809+
810+
### 🇮🇹 [MammaMia](https://github.com/UrloMythus/MammaMia)
811+
Addon per Stremio che consente lo streaming HTTPS di film, serie, anime e TV in diretta in lingua italiana.
812+
813+
### 🧩 [streamingcommunity-unofficialapi](https://github.com/Blu-Tiger/streamingcommunity-unofficialapi)
814+
API non ufficiale per accedere ai contenuti del sito italiano StreamingCommunity.
815+
816+
### 🎥 [stream-buddy](https://github.com/Bbalduzz/stream-buddy)
817+
Tool per guardare o scaricare film dalla piattaforma StreamingCommunity.
818+
805819
## Contributors
806820

807821
<a href="https://github.com/Arrowar/StreamingCommunity/graphs/contributors" alt="View Contributors">
808822
<img src="https://contrib.rocks/image?repo=Arrowar/StreamingCommunity&max=1000&columns=10" alt="Contributors" />
809-
</a>
823+
</a>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# 29.04.25
2+
3+
import re
4+
5+
6+
# External library
7+
import httpx
8+
from bs4 import BeautifulSoup
9+
10+
11+
# Internal utilities
12+
from StreamingCommunity.Util.headers import get_headers
13+
from StreamingCommunity.Util.config_json import config_manager
14+
15+
16+
# Variable
17+
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
18+
19+
20+
class VideoSource:
21+
def __init__(self, proxy=None):
22+
self.client = httpx.Client(headers=get_headers(), timeout=MAX_TIMEOUT, proxy=proxy)
23+
24+
def extractLinkHdPlayer(self, response):
25+
"""Extract iframe source from the page."""
26+
soup = BeautifulSoup(response.content, 'html.parser')
27+
iframes = soup.find_all("iframe")
28+
if iframes:
29+
return iframes[0].get('data-lazy-src')
30+
return None
31+
32+
def get_m3u8_url(self, page_url):
33+
"""
34+
Extract m3u8 URL from hdPlayer page.
35+
"""
36+
try:
37+
# Get the page content
38+
response = self.client.get(page_url)
39+
40+
# Extract HDPlayer iframe URL
41+
iframe_url = self.extractLinkHdPlayer(response)
42+
if not iframe_url:
43+
return None
44+
45+
# Get HDPlayer page content
46+
response_hdplayer = self.client.get(iframe_url)
47+
if response_hdplayer.status_code != 200:
48+
return None
49+
50+
soup = BeautifulSoup(response_hdplayer.text, 'html.parser')
51+
52+
# Find m3u8 URL in scripts
53+
for script in soup.find_all("script"):
54+
match = re.search(r'sources:\s*\[\{\s*file:\s*"([^"]+)"', script.text)
55+
if match:
56+
return match.group(1)
57+
58+
return None
59+
60+
except Exception as e:
61+
print(f"Error in HDPlayer: {str(e)}")
62+
return None
63+
64+
finally:
65+
self.client.close()

StreamingCommunity/Api/Player/maxstream.py

Lines changed: 0 additions & 140 deletions
This file was deleted.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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.config_json import config_manager
15+
from StreamingCommunity.Util.headers import get_userAgent
16+
17+
18+
# Variable
19+
MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
20+
21+
22+
class VideoSource:
23+
STAYONLINE_BASE_URL = "https://stayonline.pro"
24+
MIXDROP_BASE_URL = "https://mixdrop.sb"
25+
26+
def __init__(self, url: str):
27+
self.url = url
28+
self.redirect_url: str | None = None
29+
self._init_headers()
30+
31+
def _init_headers(self) -> None:
32+
"""Initialize the base headers used for requests."""
33+
self.headers = {
34+
'origin': self.STAYONLINE_BASE_URL,
35+
'user-agent': get_userAgent(),
36+
}
37+
38+
def _get_mixdrop_headers(self) -> dict:
39+
"""Get headers specifically for MixDrop requests."""
40+
return {
41+
'referer': 'https://mixdrop.club/',
42+
'user-agent': get_userAgent()
43+
}
44+
45+
def get_redirect_url(self) -> str:
46+
"""Extract the stayonline redirect URL from the initial page."""
47+
try:
48+
response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT)
49+
response.raise_for_status()
50+
soup = BeautifulSoup(response.text, "html.parser")
51+
52+
for link in soup.find_all('a'):
53+
href = link.get('href')
54+
if href and 'stayonline' in href:
55+
self.redirect_url = href
56+
logging.info(f"Redirect URL: {self.redirect_url}")
57+
return self.redirect_url
58+
59+
raise ValueError("Stayonline URL not found")
60+
61+
except Exception as e:
62+
logging.error(f"Error getting redirect URL: {e}")
63+
raise
64+
65+
def get_link_id(self) -> str:
66+
"""Extract the link ID from the redirect page."""
67+
if not self.redirect_url:
68+
raise ValueError("Redirect URL not set. Call get_redirect_url first.")
69+
70+
try:
71+
response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT)
72+
response.raise_for_status()
73+
soup = BeautifulSoup(response.text, "html.parser")
74+
75+
for script in soup.find_all('script'):
76+
match = re.search(r'var\s+linkId\s*=\s*"([^"]+)"', script.text)
77+
if match:
78+
return match.group(1)
79+
80+
raise ValueError("LinkId not found")
81+
82+
except Exception as e:
83+
logging.error(f"Error getting link ID: {e}")
84+
raise
85+
86+
def get_final_url(self, link_id: str) -> str:
87+
"""Get the final URL using the link ID."""
88+
try:
89+
self.headers['referer'] = f'{self.STAYONLINE_BASE_URL}/l/{link_id}/'
90+
data = {'id': link_id, 'ref': ''}
91+
92+
response = httpx.post(f'{self.STAYONLINE_BASE_URL}/ajax/linkView.php', headers=self.headers, data=data, timeout=MAX_TIMEOUT)
93+
response.raise_for_status()
94+
return response.json()['data']['value']
95+
96+
except Exception as e:
97+
logging.error(f"Error getting final URL: {e}")
98+
raise
99+
100+
def _extract_video_id(self, final_url: str) -> str:
101+
"""Extract video ID from the final URL."""
102+
parts = final_url.split('/')
103+
if len(parts) < 5:
104+
raise ValueError("Invalid final URL format")
105+
return parts[4]
106+
107+
def _extract_delivery_url(self, script_text: str) -> str:
108+
"""Extract delivery URL from beautified JavaScript."""
109+
beautified = jsbeautifier.beautify(script_text)
110+
for line in beautified.splitlines():
111+
if 'MDCore.wurl' in line:
112+
url = line.split('= ')[1].strip('"').strip(';')
113+
return f"https:{url}"
114+
raise ValueError("Delivery URL not found in script")
115+
116+
def get_playlist(self) -> str:
117+
"""
118+
Execute the entire flow to obtain the final video URL.
119+
Returns:
120+
str: The final video delivery URL
121+
"""
122+
self.get_redirect_url()
123+
link_id = self.get_link_id()
124+
125+
final_url = self.get_final_url(link_id)
126+
video_id = self._extract_video_id(final_url)
127+
128+
response = httpx.get(
129+
f'{self.MIXDROP_BASE_URL}/e/{video_id}',
130+
headers=self._get_mixdrop_headers(),
131+
timeout=MAX_TIMEOUT
132+
)
133+
response.raise_for_status()
134+
soup = BeautifulSoup(response.text, "html.parser")
135+
136+
script_text = next(
137+
(script.text for script in soup.find_all('script')
138+
if "eval" in str(script.text)),
139+
None
140+
)
141+
142+
if not script_text:
143+
raise ValueError("Required script not found")
144+
145+
return self._extract_delivery_url(script_text).replace('"', '')

0 commit comments

Comments
 (0)