1.0.5 release

- Update version number

- Refactor cookie check to raise error when no cookies are found (required)
This commit is contained in:
TPD94 2025-10-07 00:35:44 -04:00
parent b553865ff5
commit 61befd1a2a
2 changed files with 64 additions and 6 deletions

View File

@ -25,7 +25,7 @@ class CR(Service):
"""
Service code for Crunchyroll
Author: TPD94
Version: 1.0.4
Version: 1.0.5
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.4\n
Version: 1.0.5\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).
@ -84,6 +84,9 @@ class CR(Service):
# Run the super method to load the cookies without writing redundant code
if not self.initial_login:
super().authenticate(cookies, credential)
# Raise error if no cookies, Crunchyroll has implemented recaptcha, so authorization via credentials is not implemented
if not cookies and not self.initial_login:
raise EnvironmentError("Service requires cookies for authentication.")
if cookies:
self.cookies = cookies
elif hasattr(self, 'cookies'):
@ -96,10 +99,6 @@ class CR(Service):
self.initial_login = True
# Raise error if no cookies, Crunchyroll has implemented recaptcha, so authorization via credentials is not implemented
if not cookies and not self.initial_login:
raise EnvironmentError("Service requires cookies for authentication.")
# If authenticate is being called for the first time and cookies are present, retrieve an authorization token
if cookies and self.auth_token_web is None:

59
HMAX/__init__.py Normal file
View File

@ -0,0 +1,59 @@
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)