Skip to content

Commit 14792bf

Browse files
Add "short_description" field
Add "short_description" to API response, matching "showDescription" field in GraphQL API.
1 parent 4bb34e5 commit 14792bf

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class MediaEntry(NamedTuple):
5252
release_year: int
5353
release_date: str
5454
runtime_minutes: int
55+
short_description: str
5556
genres: list[str]
5657
imdb_id: str | None
5758
poster: str | None
@@ -82,6 +83,7 @@ Example response:
8283
release_year=1999,
8384
release_date="1999-03-30",
8485
runtime_minutes=136,
86+
short_description="Set in the 22nd century, The Matrix tells the story of a computer hacker...",
8587
genres=["act", "scf"],
8688
imdb_id="tt0133093",
8789
poster="https://images.justwatch.com/poster/79353084/s718/the-matrix.jpg",
@@ -225,6 +227,7 @@ Example response:
225227
release_year=2021,
226228
release_date="2021-12-16",
227229
runtime_minutes=148,
230+
short_description="Plagued by strange memories, Neo's life takes an unexpected turn...",
228231
genres=["scf", "act"],
229232
imdb_id="tt10838180",
230233
poster="https://images.justwatch.com/poster/257943908/s718/the-matrix-resurrections.jpg",
@@ -412,6 +415,7 @@ Example response:
412415
release_year=2003,
413416
release_date="2003-05-15",
414417
runtime_minutes=129,
418+
short_description="Six months after the events depicted in The Matrix, Neo has proved to be a good omen...",
415419
genres=["scf", "act"],
416420
imdb_id="tt0234215",
417421
poster="https://images.justwatch.com/poster/251725999/s718/the-matrix-2-reloaded.jpg",
@@ -555,6 +559,7 @@ Example response:
555559
release_year=2003,
556560
release_date="2003-11-05",
557561
runtime_minutes=128,
562+
short_description="The human city of Zion defends itself against the massive invasion of the machines...",
558563
genres=["act", "trl", "scf"],
559564
imdb_id="tt0242653",
560565
poster="https://images.justwatch.com/poster/179166803/s718/the-matrix-revolutions.jpg",

src/simplejustwatchapi/query.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
originalReleaseYear
4848
originalReleaseDate
4949
runtime
50+
shortDescription
5051
genres {
5152
shortName
5253
__typename
@@ -116,6 +117,7 @@ class MediaEntry(NamedTuple):
116117
release_year: int
117118
release_date: str
118119
runtime_minutes: int
120+
short_description: str
119121
genres: list[str]
120122
imdb_id: str | None
121123
poster: str | None
@@ -183,6 +185,7 @@ def _parse_entry(json: any) -> MediaEntry:
183185
year = content.get("originalReleaseYear")
184186
date = content.get("originalReleaseDate")
185187
runtime_minutes = content.get("runtime")
188+
short_description = content.get("shortDescription")
186189
genres = [node.get("shortName") for node in content.get("genres", []) if node]
187190
external_ids = content.get("externalIds")
188191
imdb_id = external_ids.get("imdbId") if external_ids else None
@@ -199,6 +202,7 @@ def _parse_entry(json: any) -> MediaEntry:
199202
year,
200203
date,
201204
runtime_minutes,
205+
short_description,
202206
genres,
203207
imdb_id,
204208
poster,

test/simplejustwatchapi/test_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"originalReleaseYear": 2000,
1414
"originalReleaseDate": "21-06-2000",
1515
"runtime": 123,
16+
"shortDescription": "Movie 1 description",
1617
"genres": [{"shortName": "gen1"}, {"shortName": "gen2"}],
1718
"externalIds": {"imdbId": "imdbId1"},
1819
"posterUrl": "/poster/url/1.jpg",
@@ -59,6 +60,7 @@
5960
2000,
6061
"21-06-2000",
6162
123,
63+
"Movie 1 description",
6264
["gen1", "gen2"],
6365
"imdbId1",
6466
IMAGES_URL + "/poster/url/1.jpg",
@@ -99,6 +101,7 @@
99101
"originalReleaseYear": 2010,
100102
"originalReleaseDate": "11-01-2010",
101103
"runtime": 456,
104+
"shortDescription": "TV show 2 description",
102105
"genres": [{"shortName": "gen2"}, {"shortName": "gen3"}],
103106
"externalIds": {"imdbId": "imdbId2"},
104107
"posterUrl": "/poster/url/2.jpg",
@@ -131,6 +134,7 @@
131134
2010,
132135
"11-01-2010",
133136
456,
137+
"TV show 2 description",
134138
["gen2", "gen3"],
135139
"imdbId2",
136140
IMAGES_URL + "/poster/url/2.jpg",
@@ -171,6 +175,7 @@
171175
2020,
172176
"12-02-2020",
173177
123,
178+
None,
174179
[],
175180
None,
176181
IMAGES_URL + "/poster/url/3.jpg",

test/simplejustwatchapi/test_request.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
originalReleaseYear
4141
originalReleaseDate
4242
runtime
43+
shortDescription
4344
genres {
4445
shortName
4546
__typename

0 commit comments

Comments
 (0)