diff --git a/.gitignore b/.gitignore index 46d6192..a0bb7cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc /EXAMPLE +/DSNP diff --git a/CR/__init__.py b/CR/__init__.py index 115c2ed..aece3eb 100644 --- a/CR/__init__.py +++ b/CR/__init__.py @@ -25,7 +25,7 @@ class CR(Service): """ Service code for Crunchyroll Author: TPD94 - Version: 1.0.5 + Version: 1.0.6 Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required. Security: FHD@L3 Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D). @@ -36,7 +36,7 @@ class CR(Service): help=""" Service code for Crunchyroll\n Author: TPD94\n - Version: 1.0.5\n + Version: 1.0.6\n Authorization: Cookies for web endpoints, Credentials for TV endpoints, Cookies/Credentials for both. Cookies required.\n Security: FHD@L3\n Use Series ID/URL (for example - https://www.crunchyroll.com/series/GG5H5XQ7D/kaiju-no-8) or Series ID (for example - GG5H5XQ7D). @@ -75,6 +75,10 @@ class CR(Service): self.initial_login = False + def extract_season_number_from_string(self, season_title: str) -> int | None: + match = re.search(r'\bSeason\s+(\d+)\b', season_title, re.IGNORECASE) + return int(match.group(1)) if match else None + def get_session(self): # Create a session using curl_cffi as it can impersonate browsers and avoid bot detection by Crunchyroll @@ -244,7 +248,7 @@ class CR(Service): id_=episode['id'], service=self.__class__, title=episode['series_title'], - season=int(episode['season_display_number']) if episode['season_display_number'] != '' else episode['season_sequence_number'] if episode['season_display_number'] == '' and episode['season_sequence_number'] == 1 else 1 if episode['season_sequence_number'] == 0 else 0, + season=int(episode['season_display_number']) if episode['season_display_number'] != '' else self.extract_season_number_from_string(episode['season_title']) if self.extract_season_number_from_string(episode['season_title']) is not None else episode['season_sequence_number'] if episode['season_display_number'] == '' and episode['season_sequence_number'] == 1 else 1 if episode['season_sequence_number'] == 0 else 0, number = episode['episode_number'] if isinstance(episode['episode_number'], int) else special_counter, name=episode['title'] if episode['title'] else episode['season_title'], year=episode['episode_air_date'][:4], diff --git a/HMAX/__init__.py b/HMAX/__init__.py deleted file mode 100644 index 070b576..0000000 --- a/HMAX/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -import base64 -import hashlib -import json -import re -from codecs import Codec -from collections.abc import Generator -from datetime import datetime, timedelta -from http.cookiejar import CookieJar -from typing import Optional, Union -import click -from langcodes import Language -from unshackle.core.console import console -from unshackle.core.constants import AnyTrack -from unshackle.core.credential import Credential -from unshackle.core.manifests import DASH -from unshackle.core.search_result import SearchResult -from unshackle.core.service import Service -from unshackle.core.session import session -from unshackle.core.titles import Episode, Movie, Movies, Series, Title_T, Titles_T -from unshackle.core.tracks import Chapter, Subtitle, Tracks, Video, Chapters - -class HMAX(Service): - - """ - Service code for HBO Max - Author: TPD94 - Version: 1.0.0 - Authorization: - Security: - Use Series ID/URL (for example - ). - """ - - @staticmethod - @click.command(name="HMAX", short_help="https://hbomax.com/", - help=""" - Service code for HBO Max\n - Author: TPD94\n - Version: 1.0.0\n - Authorization:\n - Security:\n - Use full URL (for example - ). - """ - ) - @click.argument("title", type=str) - @click.pass_context - - def cli(ctx, **kwargs): - return HMAX(ctx, **kwargs) - - def __init__(self, ctx, title): - super().__init__(ctx) - - def get_session(self): - - # Create a session using curl_cffi as it can impersonate browsers and avoid bot detection by HBO Max - return session("chrome124") - - def authenticate(self, cookies: Optional[CookieJar] = None, credential: Optional[Credential] = None) -> None: - super().authenticate(cookies, credential)