You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+90Lines changed: 90 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,8 @@ If a platform offers streaming for a given entry in 4K, HD and SD, then `best_on
81
81
82
82
Returned value is a list of [`MediaEntry`](#return-data-structures) objects.
83
83
84
+
For very large searches (high `count` value) I recommend using default `best_only=True` to avoid issues with [request complexity](#request-complexity).
85
+
84
86
Example command and its output is in [`examples/search_output.py`](examples/search_output.py).
85
87
86
88
@@ -111,9 +113,72 @@ General usage of these arguments matches the [`search`](#search) command.
111
113
112
114
Returned value is a single [`MediaEntry`](#return-data-structures) object.
113
115
116
+
This function can be used for all types of media - shows, movies, episodes, seasons (the last two having their dedicated functions described below),
117
+
for all types the result is a single [`MediaEntry`](#return-data-structures) object.
118
+
Some fields are specific for one of the media types and will be `None` for others - e.g.:
119
+
-`total_episode_count` is only present for seasons
120
+
-`season_number` is present for seasons and episodes
121
+
-`episode_number` is present only for episodes
122
+
-`age_certification` is present only for movies and shows
123
+
124
+
For episodes specifically most of the fields will be empty (which is why [`episodes`](#episodes) command returns different structure).
125
+
114
126
Example command and its output is in [`examples/details_output.py`](examples/details_output.py).
115
127
116
128
129
+
### Seasons
130
+
131
+
Seasons function allows for looking up all seasons of a show via its node ID.
132
+
Node/show ID can be taken from output of the [`search`](#search) command.
133
+
It's also the same ID as input for [`details`](#details) command.
134
+
135
+
Each season contains similar data to the [`details`](#details) command, with additional season number and number of episodes.
136
+
137
+
Usage also matches [`details`](#details) command:
138
+
```python
139
+
from simplejustwatchapi.justwatch import seasons
140
+
141
+
results = seasons("nodeID", "US", "en", False)
142
+
```
143
+
144
+
Only the first argument is required - the node ID of element to look up details for.
145
+
146
+
|| Argument | Type | Required | Default value | Description |
| 1 |`season_id`|`str`|**YES**| - | Node/season ID to look up |
173
+
| 2 |`country`|`str`| NO |`"US"`| Country to search for offers |
174
+
| 3 |`language`|`str`| NO |`"en"`| Language of responses |
175
+
| 5 |`best_only`|`bool`| NO |`True`| Determines whether only best offers should be returned |
176
+
177
+
Returned value is a list of [`Episode`](#return-data-structures) objects, each describing a single episode.
178
+
Each contains only a small subset of fields from the [`MediaEntry`](#return-data-structures) object,
179
+
JustWatch API doesn't return "full" data.
180
+
181
+
117
182
### Offers for countries
118
183
119
184
This function allows looking up offers for entry by given node ID.
@@ -147,6 +212,17 @@ Example command and its output is in [`examples/offers_for_countries_output.py`]
147
212
148
213
Detailed descriptions of all used data structures are available in the [documentation](https://electronic-mango.github.io/simple-justwatch-python-api/simplejustwatchapi.html#module-simplejustwatchapi.query).
149
214
215
+
The main structure `MediaEntry` contains fields for all media types - movies, shows, seasons, episodes.
216
+
Some fields are specific for one of the media types and will be `None` for others - e.g.:
217
+
-`total_episode_count` is only present for seasons
218
+
-`season_number` is present for seasons and episodes
219
+
-`episode_number` is present only for episodes
220
+
-`age_certification` is present only for movies and shows
221
+
222
+
For episodes specifically most of the fields will be empty (which is why [`episodes`](#episodes) command returns different structure).
223
+
224
+
As [`search`](#search) function can return only movies and shows the episode-specific and season-specific fields will always be `None`,
225
+
but are included in `MediaEntry` so they will be present in output from [`details`](#details) function.
150
226
151
227
152
228
## Locale, language, country
@@ -165,6 +241,20 @@ If you provide unsupported language JustWatch API should default to english.
165
241
166
242
167
243
244
+
## Request complexity
245
+
246
+
JustWatch API will respond with error on too high request/response complexity - essentially when returned graph would be too large.
247
+
It's the reason for why seasons/episodes data isn't available directly in [`search`](#search), or [`details`](#details) function
248
+
(mostly the former).
249
+
250
+
This issue can still occur for [`search`](#search) with too high `count` value.
251
+
In my tests the limit is around 100 (in the worst case with `best_only=False`).
252
+
It's a lot, but keep it in mind.
253
+
254
+
Using `best_only=True` should alleviate the issue somewhat, so for very large requests I recommend using its default `True` value.
255
+
256
+
257
+
168
258
## Disclaimer
169
259
170
260
This API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch.
0 commit comments