Skip to content

Commit 023dbf7

Browse files
committed
v3
1 parent 69726fc commit 023dbf7

File tree

9 files changed

+29
-27
lines changed

9 files changed

+29
-27
lines changed

StreamingCommunity/Api/Service/crunchyroll/util/get_license.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def wait(self):
4545
class CrunchyrollClient:
4646
def __init__(self) -> None:
4747
config = config_manager.get_dict("SITE_LOGIN", "crunchyroll")
48-
self.device_id = config.get('device_id')
49-
self.etp_rt = config.get('etp_rt')
48+
self.device_id = str(config.get('device_id')).strip()
49+
self.etp_rt = str(config.get('etp_rt')).strip()
5050
self.locale = "it-IT"
5151

5252
self.access_token: Optional[str] = None

StreamingCommunity/Api/Service/realtime/util/get_license.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# 26.11.2025
22

3+
# External library
4+
from rich.console import Console
35

46
# Internal utilities
57
from StreamingCommunity.Util.headers import get_userAgent, get_headers
68
from StreamingCommunity.Util.http_client import create_client
79

810

11+
# Variable
12+
console = Console()
13+
914

1015
def get_playback_url(video_id: str, bearer_token: str, get_dash: bool, channel: str = "") -> str:
1116
"""
@@ -26,8 +31,11 @@ def get_playback_url(video_id: str, bearer_token: str, get_dash: bool, channel:
2631
},
2732
'videoId': video_id,
2833
}
29-
3034
response = create_client().post(bearer_token[channel]['endpoint'], headers=headers, json=json_data)
35+
response.raise_for_status()
36+
37+
if response.status_code == 403:
38+
console.print("[red]Set vpn to IT to download this content.")
3139

3240
if not get_dash:
3341
return response.json()['data']['attributes']['streaming'][0]['url']

StreamingCommunity/Api/Service/tubitv/series.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,10 @@ def download_series(select_season: MediaItem, season_selection: str = None, epis
142142
- episode_selection (str, optional): Pre-defined episode selection that bypasses manual input
143143
"""
144144
start_message()
145-
146-
# Get bearer token
147-
try:
148-
bearer_token = get_bearer_token()
149-
except Exception as e:
150-
console.print(f"[red]Error getting bearer token: {e}")
151-
return
145+
bearer_token = get_bearer_token()
152146

153147
# Init class
154-
scrape_serie = GetSerieInfo(select_season.url, bearer_token)
148+
scrape_serie = GetSerieInfo(select_season.url, bearer_token, select_season.name)
155149

156150
# Collect information about season
157151
scrape_serie.getNumberSeason()

StreamingCommunity/Api/Service/tubitv/util/ScrapeSerie.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def extract_content_id(url: str) -> str:
1919

2020

2121
class GetSerieInfo:
22-
def __init__(self, url, bearer_token=None):
22+
def __init__(self, url, bearer_token=None, series_name=None):
2323
"""
2424
Initialize the GetSerieInfo class for scraping Tubi TV series information.
2525
@@ -30,7 +30,7 @@ def __init__(self, url, bearer_token=None):
3030
self.url = url
3131
self.content_id = extract_content_id(url)
3232
self.bearer_token = bearer_token
33-
self.series_name = None
33+
self.series_name = series_name
3434
self.seasons_manager = SeasonManager()
3535
self.all_episodes_by_season = {}
3636

@@ -66,12 +66,6 @@ def collect_info_title(self) -> None:
6666
# Store episodes by season
6767
self.all_episodes_by_season = episodes_by_season
6868

69-
# Get series name from first episode
70-
first_season = list(episodes_by_season.values())[0]
71-
if first_season and len(first_season) > 0:
72-
first_episode = first_season[0]
73-
self.series_name = first_episode.get('series_title', 'Unknown Series')
74-
7569
# Create seasons in SeasonManager
7670
for season_num in sorted(episodes_by_season.keys(), key=int):
7771
season_data = {

StreamingCommunity/Api/Service/tubitv/util/get_license.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def get_bearer_token():
3434
'platform': 'web',
3535
'device_id': generate_device_id(),
3636
'credentials': {
37-
'email': config.get('email'),
38-
'password': config.get('password')
37+
'email': str(config.get('email')).strip(),
38+
'password': str(config.get('password')).strip()
3939
},
4040
}
4141

StreamingCommunity/Lib/DASH/decrypt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def decrypt_with_mp4decrypt(type, encrypted_path, kid, key, output_path=None):
6262

6363
key_format = f"{kid.lower()}:{key.lower()}"
6464
cmd = [get_mp4decrypt_path(), "--key", key_format, encrypted_path, output_path]
65-
logging.info(f"Running command: {' '.join(cmd)}")
65+
logging.info(f"Running mp4decrypt command: {' '.join(cmd)}")
6666

6767
progress_bar = None
6868
monitor_thread = None

StreamingCommunity/Lib/FFmpeg/merge.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def join_video(video_path: str, out_path: str, codec: M3U8_Codec = None):
7575

7676
# Output file and overwrite
7777
ffmpeg_cmd.extend([out_path, '-y'])
78+
logging.info(f"FFMPEG Command: {' '.join(ffmpeg_cmd)} \n")
7879

7980
# Run join
8081
if DEBUG_MODE:
@@ -122,7 +123,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
122123
if use_shortest:
123124
for track in duration_diffs:
124125
color = "red" if track['has_error'] else "green"
125-
console.print(f"[{color}]Audio {track['language']}: Video duration: {track['video_duration']:.2f}s, Audio duration: {track['audio_duration']:.2f}s, Difference: {track['difference']:.2f}s[/{color}]")
126+
console.print(f"[{color}]Audio {track['language']}: Video duration: {track['video_duration']:.2f}s, Audio duration: {track['audio_duration']:.2f}s, Difference: {track['difference']:.2f}s[/{color}] \n")
126127

127128
# Start command with locate ffmpeg
128129
ffmpeg_cmd = [get_ffmpeg_path()]
@@ -153,6 +154,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
153154

154155
# Output file and overwrite
155156
ffmpeg_cmd.extend([out_path, '-y'])
157+
logging.info(f"FFMPEG Command: {' '.join(ffmpeg_cmd)} \n")
156158

157159
# Run join
158160
if DEBUG_MODE:
@@ -197,7 +199,7 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
197199

198200
# Overwrite
199201
ffmpeg_cmd += [out_path, "-y"]
200-
logging.info(f"FFmpeg command: {ffmpeg_cmd}")
202+
logging.info(f"FFMPEG Command: {' '.join(ffmpeg_cmd)} \n")
201203

202204
# Run join
203205
if DEBUG_MODE:

StreamingCommunity/Lib/HLS/segments.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,16 @@ def get_segments_count(self) -> int:
157157
def get_type_stream(self, segments) -> str:
158158
self.is_stream_ts = (".ts" in self.segments[len(self.segments) // 2]) if self.segments else False
159159
self.is_stream_mp4 = (".mp4" in self.segments[len(self.segments) // 2]) if self.segments else False
160+
self.is_stream_aac = (".aac" in self.segments[len(self.segments) // 2]) if self.segments else False
160161

161162
if self.is_stream_ts:
162163
return "ts"
163164
elif self.is_stream_mp4:
164165
return "mp4"
166+
elif self.is_stream_aac:
167+
return "aac"
168+
else:
169+
return None
165170

166171
def get_info(self) -> None:
167172
"""
@@ -386,10 +391,9 @@ async def download_segments_async(self, description: str, type: str):
386391
temp_dir = os.path.join(self.tmp_folder, "segments_temp")
387392
os.makedirs(temp_dir, exist_ok=True)
388393

389-
if self.stream_type == "ts":
394+
if self.stream_type in ["ts", "aac"]:
390395

391396
# Initialize progress bar
392-
print("")
393397
total_segments = len(self.segments) + (1 if self.has_init_segment else 0)
394398
progress_bar = tqdm(
395399
total=total_segments,

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"etp_rt": ""
5454
},
5555
"tubi": {
56-
"email:": "",
56+
"email": "",
5757
"password": ""
5858
}
5959
}

0 commit comments

Comments
 (0)