fix(route/imdb): fetch charts from GraphQL API#22682
Open
JaggerH wants to merge 1 commit into
Open
Conversation
IMDb no longer ships chart data in the page HTML — the plain server-side fetch of /chart/:chart now hits an AWS WAF JavaScript challenge (HTTP 202), so `script#__NEXT_DATA__` is absent and `JSON.parse` throws, returning 503. Fetch the same data from IMDb's public GraphQL API (api.graphql.imdb.com) via the `chartTitles` query instead. The four charts map to the ChartTitleType enum (TOP_RATED_MOVIES / MOST_POPULAR_MOVIES / TOP_RATED_TV_SHOWS / MOST_POPULAR_TV_SHOWS). Genre display names now come straight from `titleGenres.genres[].genre.text`, so the old facet lookup is dropped. Item shape (title / description / link / category) is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Involved Issue / 该 PR 相关 Issue
Close #
Example for the Proposed Route(s) / 路由地址示例
New RSS Route Checklist / 新 RSS 路由检查表
PuppeteerNote / 说明
/imdb/chart/:chartcurrently returns HTTP 503. The route fetcheshttps://www.imdb.com/chart/:chart/and parsesscript#__NEXT_DATA__, butIMDb no longer ships chart data in the page HTML — a plain server-side fetch
now hits an AWS WAF JavaScript challenge (HTTP 202) with no
__NEXT_DATA__blob, so
JSON.parsethrows (SyntaxError: Unexpected end of JSON input).This PR fetches the same data from IMDb's public GraphQL API
(
https://api.graphql.imdb.com/) via thechartTitlesquery, which is notbehind the WAF challenge and needs no auth. The four charts map to the
ChartTitleTypeenum:TOP_RATED_MOVIESMOST_POPULAR_MOVIESTOP_RATED_TV_SHOWSMOST_POPULAR_TV_SHOWSGenre display names now come directly from
titleGenres.genres[].genre.text,so the old connection-level facet lookup is dropped. The item shape
(title / description with poster + rating + plot / link / category) is
unchanged. No date is exposed because the charts provide no reliable per-item
timestamp. Verified locally: all four charts return items; e.g. moviemeter #1
"Obsession (2025)" with rating 8/10 and genres Horror/Romance/Thriller.