@@ -27,8 +27,7 @@ All needed functions, data structures, raised exceptions are available through s
2727module - ` simplejustwatchapi ` .
2828
2929Examples of parsed responses are in the GitHub repository in
30- [ ` examples/ ` ] (https://github.com/Electronic-Mango/simple-justwatch-python-api/tree/\
31- main/examples).
30+ [ ` examples/ ` ] ( https://github.com/Electronic-Mango/simple-justwatch-python-api/tree/main/examples ) .
3231
3332
3433## Functions
@@ -70,15 +69,15 @@ for entry in results:
7069 print (entry.title, entry.offers)
7170```
7271
72+ !!! note "Whitespaces in title"
73+ Value of the given title isn't stripped, so passing a string with multiple spaces
74+ will look them up. For more than 1 space it will probably return an empty list.
75+
7376All arguments are optional.
7477
7578First argument is just a string to look up. If empty, or not provided, you'll get a
7679selection of popular titles, similar to [ ` popular ` ] ( #popular ) function.
7780
78- !!! note "Whitespaces in title"
79- value of ` title ` isn't stripped, so passing a string with multiple spaces will look
80- them up. For more than 1 space it will (probably) always return an empty list.
81-
8281For very large searches (high ` count ` value) I recommend using default ` best_only=True `
8382to avoid issues with [ operation complexity] ( caveats.md#operation-complexity ) .
8483Alternatively you can ` offset ` for
@@ -143,6 +142,7 @@ This function can be used for all types of media - shows, movies, episodes, seas
143142(the last two having their dedicated functions described below), for all types the
144143result is a single [ ` MediaEntry ` ] [ simplejustwatchapi.tuples.MediaEntry ] . Some fields
145144are specific for one of the media types and will be ` None ` for others - for example:
145+
146146 - ` total_episode_count ` is only present for seasons
147147 - ` season_number ` is present for seasons and episodes
148148 - ` episode_number ` is present only for episodes
@@ -351,17 +351,17 @@ except JustWatchApiError as e:
351351 print (" ," .join(error_messages))
352352```
353353
354- And so on.
354+ These are just examples of internal API errors, which cause [ ` JustWatchApiError ` ]
355+ [ simplejustwatchapi.exceptions.JustWatchApiError] exception.
355356
356357
357- ## Multi-function examples
358-
359- Small collection of examples of how you can combine multiple functions together.
358+ ## More complicated examples
360359
361360### Get popular titles for only specific providers
362361
363362You can combine [ ` providers ` ] ( #get-all-available-providers-for-a-country ) and
364363[ ` popular ` ] ( #popular-titles ) functions:
364+
365365``` python
366366from simplejustwatchapi import popular, providers
367367
@@ -385,6 +385,7 @@ filtered_popular = popular("US", providers=netflix_apple_only)
385385You can combine [ ` search ` ] ( #search-for-a-title ) ,
386386[ ` seasons ` ] ( #details-for-all-seasons-of-a-tv-show ) and
387387[ ` episodes ` ] ( #details-for-all-episodes-of-a-tv-show ) functions:
388+
388389``` python
389390from simplejustwatchapi import episodes, search, seasons
390391
@@ -420,6 +421,7 @@ You can combine [`search`](#search-for-a-title),
420421[ ` seasons ` ] ( #details-for-all-seasons-of-a-tv-show ) and
421422[ ` offers_for_countries ` ] ( #get-offers-for-multiple-countries-for-a-single-title )
422423functions:
424+
423425``` python
424426from simplejustwatchapi import offers_for_countries, search, seasons
425427
@@ -454,3 +456,29 @@ season_offers_per_country = {
454456 for country in countries
455457}
456458```
459+
460+
461+ ### Pagination through ` offset `
462+
463+ When trying to get as much data as possible with [ ` search ` ] ( #search-for-a-title ) or
464+ [ ` popular ` ] ( #popular-titles ) functions and avoid issues with
465+ [ operation complexity] ( caveats.md#operation-complexity ) you can use ` offset ` parameter
466+ to set up a [ basic pagination] ( caveats.md#getting-more-results-and-pagination ) :
467+
468+ ``` python
469+ from simplejustwatchapi import popular
470+
471+ i = 0
472+ page = 99
473+ all_results = []
474+ while results := popular(count = page, offset = i):
475+ i += page
476+ all_results.extend(results)
477+ # len(all_results) == 1980
478+ ```
479+
480+ !!! note "Maximum number of responses"
481+ There is a limit of number of entries you can get from the JustWatch API using this
482+ method of ** 1999** . Check
483+ [ Maximum number of entries] ( caveats.md#maximum-number-of-entries ) page for more
484+ details.
0 commit comments