feat(imdb): add IMDb adapter with 6 commands#472
Merged
jackwener merged 3 commits intojackwener:mainfrom Mar 26, 2026
Merged
Conversation
Add a public IMDb adapter using browser-based JSON-LD and __NEXT_DATA__ extraction. All commands use Strategy.PUBLIC with browser: true. Commands: - imdb search <query> — search movies, TV shows, and people - imdb title <id> — get movie/show details (Movie, TVSeries, TVEpisode, TVMiniseries, TVMovie, etc.) - imdb top — IMDb Top 250 chart - imdb trending — Most Popular Movies - imdb person <id> — actor/director info with filmography - imdb reviews <id> — user reviews (first page, max 25) Shared utils: ID normalization, ISO 8601 duration formatting, locale forcing, JSON-LD extraction (supports type array filtering), and anti-bot challenge detection.
07c6a58 to
eb8201e
Compare
Merged
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.
Description
Add a public IMDb adapter using browser-based JSON-LD and
__NEXT_DATA__extraction. Covers the most common movie/TV lookup scenarios where CLI data is self-sufficient.Type of Change
Summary
Commands
imdb search <query>__NEXT_DATA__+ DOM fallbackimdb title <id>imdb topimdb trendingimdb person <id>__NEXT_DATA__imdb reviews <id>All 6 commands use
Strategy.PUBLICwithbrowser: true. No API key required.Design Decisions
strategy: public: All data is publicly accessible. No login needed, but browser is required to bypass IMDb's WAF.extractJsonLd(). No YAML.titledetects@type(Movie, TVSeries, TVEpisode, TVMiniseries, TVMovie, TVSpecial, etc.) and adjusts output (creator vs director, seasons/episodes, year range for ongoing series).Shared Utils
utils.tscentralizes cross-cutting concerns:normalizeImdbId()— bare IDs, full URLs, mobile URLs, locale-prefixed URLsextractJsonLd()— type array filtering,@graphnesting, multi-script iterationisChallengePage()— anti-bot verification detectionforceEnglishUrl()— consistent English output regardless of browser localeformatDuration()— ISO 8601 (PT2H28M) to human-readable (2h 28m)Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)README.md/README.zh-CN.mdwhen command discoverability changedCliErrorsubclasses instead of rawErrorTest plan
npx tsc --noEmit— zero errorsnpx vitest run src/clis/imdb/— 9/9 unit tests passimdb top --limit 5— returns Top 250 chartimdb trending --limit 5— returns Most Popular Moviesimdb search "inception" --limit 5— returns search resultsimdb search "你好世界" --limit 3— Unicode search worksimdb title tt1375666— Inception (Movie)imdb title tt0903747— Breaking Bad (TVSeries, creator, no director)imdb title tt0108778— Friends (TVSeries, dual creators)imdb title "https://www.imdb.com/title/tt1375666/"— full URL inputimdb title tt99999999— not found errorimdb title invalid— format validation errorimdb person nm0634240 --limit 3— Christopher Nolan + filmographyimdb person nm0000199 --limit 3— Al Pacino + filmographyimdb reviews tt1375666 --limit 5— deduplicated reviewsimdb top -f json— JSON output formatbrowser-public.test.ts(3 cases: top, search, title)Screenshots / Output
imdb top --limit 5imdb title tt1375666(Movie)imdb title tt0903747(TV Series)imdb search "inception" --limit 5imdb person nm0634240 --limit 3imdb reviews tt1375666 --limit 3