fix: Fixed paging in JOYNAT service
This commit is contained in:
+12
-3
@@ -33,7 +33,7 @@ class JOYNAT(Service):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@click.command(name="JOYN", short_help="https://joyn.at", help=__doc__)
|
@click.command(name="JOYN", short_help="https://joyn.at", help=__doc__)
|
||||||
@click.argument("title", type=str)
|
@click.argument("title", type=str)
|
||||||
@click.option("--age-bypass", is_flag=True, default=False, help="Download age gated videos with a rating of 16 years old or above.")
|
@click.option("--age-bypass", is_flag=True, default=False, help="Download age-restricted videos rated for ages 16 and up.")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def cli(ctx: click.Context, **kwargs: Any) -> JOYNAT:
|
def cli(ctx: click.Context, **kwargs: Any) -> JOYNAT:
|
||||||
return JOYNAT(ctx, **kwargs)
|
return JOYNAT(ctx, **kwargs)
|
||||||
@@ -275,17 +275,24 @@ class JOYNAT(Service):
|
|||||||
for season in series_data['allSeasons']:
|
for season in series_data['allSeasons']:
|
||||||
self._validate_required_fields(season, ['id', 'number'], 'season')
|
self._validate_required_fields(season, ['id', 'number'], 'season')
|
||||||
|
|
||||||
|
first = 20
|
||||||
|
offset = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
season_response = self._execute_graphql_query(
|
season_response = self._execute_graphql_query(
|
||||||
'Season', {'id': season['id']},
|
'Season', {'id': season['id'], 'first': first, 'offset': offset},
|
||||||
'ee2396bb1b7c9f800e5cefd0b341271b7213fceb4ebe18d5a30dab41d703009f',
|
'ee2396bb1b7c9f800e5cefd0b341271b7213fceb4ebe18d5a30dab41d703009f',
|
||||||
)
|
)
|
||||||
|
|
||||||
season_data = season_response.get('season')
|
season_data = season_response.get('season')
|
||||||
if not season_data:
|
if not season_data:
|
||||||
continue
|
break # no more seasons/episodes
|
||||||
|
|
||||||
self._validate_required_fields(season_data, ['episodes'], 'season_data')
|
self._validate_required_fields(season_data, ['episodes'], 'season_data')
|
||||||
|
|
||||||
|
if len(season_data['episodes']) == 0:
|
||||||
|
break # no more episodes in this season
|
||||||
|
|
||||||
for episode in season_data['episodes']:
|
for episode in season_data['episodes']:
|
||||||
self._validate_required_fields(episode, ['id', 'title', 'number'], 'episode')
|
self._validate_required_fields(episode, ['id', 'title', 'number'], 'episode')
|
||||||
self._validate_video_field(episode, 'episode')
|
self._validate_video_field(episode, 'episode')
|
||||||
@@ -303,6 +310,8 @@ class JOYNAT(Service):
|
|||||||
data=episode,
|
data=episode,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
offset += first
|
||||||
|
|
||||||
return Series(episodes)
|
return Series(episodes)
|
||||||
|
|
||||||
def _get_single_episode(self, path: str) -> Series:
|
def _get_single_episode(self, path: str) -> Series:
|
||||||
|
|||||||
Reference in New Issue
Block a user