feat(RTLP): add premium bypass option to download premium-only content
By default, content with tier 'PREMIUM' is skipped. Use --premium-bypass flag to download premium movies and episodes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,12 +34,14 @@ class RTLP(Service):
|
||||
@staticmethod
|
||||
@click.command(name="RTLP", short_help="https://plus.rtl.de", help=__doc__)
|
||||
@click.argument("title", type=str)
|
||||
@click.option("--premium-bypass", is_flag=True, default=False, help="Download premium-only content (default: skip premium content).")
|
||||
@click.pass_context
|
||||
def cli(ctx: click.Context, **kwargs: Any) -> RTLP:
|
||||
return RTLP(ctx, **kwargs)
|
||||
|
||||
def __init__(self, ctx: click.Context, title: str):
|
||||
def __init__(self, ctx: click.Context, title: str, premium_bypass: bool = False):
|
||||
self.title = title
|
||||
self.premium_bypass = premium_bypass
|
||||
super().__init__(ctx)
|
||||
|
||||
def get_session(self) -> requests.Session:
|
||||
@@ -208,6 +210,10 @@ class RTLP(Service):
|
||||
|
||||
self.log.debug(f"Movie ID: {content_id}, Title: {movie_data['title']}")
|
||||
|
||||
if self._is_premium(movie_data) and not self.premium_bypass:
|
||||
self.log.info(f"Skipping premium movie: {movie_data['title']} (use --premium-bypass to download)")
|
||||
return Movies([])
|
||||
|
||||
return Movies([
|
||||
Movie(
|
||||
id_=content_id,
|
||||
@@ -247,6 +253,10 @@ class RTLP(Service):
|
||||
if 'format' not in episode_data or 'title' not in episode_data['format']:
|
||||
raise ValueError("Missing 'format.title' in episode_data.")
|
||||
|
||||
if self._is_premium(episode_data) and not self.premium_bypass:
|
||||
self.log.info(f"Skipping premium episode: {episode_data['title']} (use --premium-bypass to download)")
|
||||
return Series([])
|
||||
|
||||
return Series([
|
||||
Episode(
|
||||
id_=content_id,
|
||||
@@ -282,6 +292,10 @@ class RTLP(Service):
|
||||
for episode in season_data['episodes']:
|
||||
self._validate_required_fields(episode, ['id', 'title', 'number', 'episodeSeason'], 'episode')
|
||||
|
||||
if self._is_premium(episode) and not self.premium_bypass:
|
||||
self.log.info(f"Skipping premium episode: {episode['title']} (use --premium-bypass to download)")
|
||||
continue
|
||||
|
||||
episodes.append(Episode(
|
||||
id_=episode['id'],
|
||||
service=self.__class__,
|
||||
@@ -334,6 +348,10 @@ class RTLP(Service):
|
||||
for episode in season_data['episodes']:
|
||||
self._validate_required_fields(episode, ['id', 'title', 'number', 'episodeSeason'], 'episode')
|
||||
|
||||
if self._is_premium(episode) and not self.premium_bypass:
|
||||
self.log.info(f"Skipping premium episode: {episode['title']} (use --premium-bypass to download)")
|
||||
continue
|
||||
|
||||
episodes.append(Episode(
|
||||
id_=episode['id'],
|
||||
service=self.__class__,
|
||||
@@ -447,6 +465,10 @@ class RTLP(Service):
|
||||
|
||||
return response_data['data']
|
||||
|
||||
def _is_premium(self, data: dict) -> bool:
|
||||
"""Check if content is premium-only (skipped unless premium_bypass is enabled)."""
|
||||
return data.get('tier') == 'PREMIUM'
|
||||
|
||||
@staticmethod
|
||||
def _get_episode_season(episode: dict) -> Optional[int]:
|
||||
"""Extract the season number (ordinal or year) from episode data."""
|
||||
|
||||
Reference in New Issue
Block a user