Skip to content

Commit 3cad86d

Browse files
committed
feat: add tvShow boolean to response
1 parent 56f471c commit 3cad86d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/HtmlPieces.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ public function get(object $page, string $element, string $url='')
245245
return $cast;
246246
break;
247247

248+
case "tvShow":
249+
preg_match('/TV Series/i', $page, $matches, PREG_OFFSET_CAPTURE);
250+
return !!$this->count($matches);
251+
break;
252+
248253
case "seasons":
249254
$seasons = [];
250255
$findAllSeasons = $dom->find($page, "#bySeason > option");

src/Imdb.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ public function film(string $filmId, array $options = []): array
104104
$response->add("rating_votes", $htmlPieces->get($page, "rating_votes"));
105105
$response->add("poster", $htmlPieces->get($page, "poster"));
106106
$response->add("trailer", $htmlPieces->get($page, "trailer"));
107+
$response->add("tvShow", $htmlPieces->get($page, "tvShow"));
107108
$response->add("cast", $htmlPieces->get($page, "cast"));
109+
$response->add("seasons", []);
110+
$response->add("technical_specs", []);
108111

109112
// If techSpecs is enabled in user $options
110113
// -> Make a second request to load the full techSpecs page
111114
if ($options["techSpecs"]) {
112115
$page_techSpecs = $dom->fetch("https://www.imdb.com/title/$filmId/technical", $options);
113116
$response->add("technical_specs", $htmlPieces->get($page_techSpecs, "technical_specs"));
114117
}
115-
else {
116-
$response->add("technical_specs", []);
117-
}
118118

119119
// If seasons is enabled
120120
if ($options['seasons']) {

src/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ public function default(string $endpoint): array
8080
"id" => "",
8181
"link" => ""
8282
],
83-
"seasons" => [],
83+
"tvShow" => false,
8484
"cast" => [],
85+
"seasons" => [],
8586
"technical_specs" => []
8687
];
8788
break;

0 commit comments

Comments
 (0)