Skip to content

Commit 3da6df7

Browse files
committed
Use GraphQL to fetch paginated keywords
1 parent c622579 commit 3da6df7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Imdb/Title.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,14 +2950,20 @@ public function officialSites()
29502950
/** Get the complete keywords for the movie
29512951
* @return array keywords
29522952
* @see IMDB page /keywords
2953-
* @version Limited to 50 keywords
29542953
*/
29552954
public function keywords_all()
29562955
{
29572956
if (empty($this->all_keywords)) {
2958-
$page = $this->getPage("Keywords");
2959-
if (preg_match_all('|<a.*?href="/search/keyword[^>]+?>(.*?)</a>|', $page, $matches)) {
2960-
$this->all_keywords = $matches[1];
2957+
$query = <<<EOF
2958+
keyword {
2959+
text {
2960+
text
2961+
}
2962+
}
2963+
EOF;
2964+
$edges = $this->graphQlGetAll("TitleKeywordsPagination", "keywords", $query);
2965+
foreach ($edges as $edge) {
2966+
$this->all_keywords[] = $edge->node->keyword->text->text;
29612967
}
29622968
}
29632969
return $this->all_keywords;

0 commit comments

Comments
 (0)