zvenn / api-imdb-streaming-movies
能够获取电影数据和搜索结果的IMDB API,也可以获取流媒体电影
dev-master
2021-11-22 22:51 UTC
Requires
- php: ^7.3|^8.0
- paquettg/php-html-parser: ^2.1
- tmarois/filebase: ^1.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: 9.0
This package is auto-updated.
Last update: 2024-09-23 05:36:13 UTC
README
PHP imdb-api-streaming-movies,可以获取电影数据和搜索结果。
从hmerritt/imdb-api包中分叉,添加了一些自定义功能
安装
使用 composer 安装最新版本。
$ composer require zvenn/api-imdb-streaming-movies
用法
// Assuming you installed from Composer: require "vendor/autoload.php"; use zvenn\Imdb; $imdb = new Imdb; // Search imdb // -> returns array of films and people found $imdb->search("Apocalypse"); // Get film data // -> returns array of film data (title, year, rating...) $imdb->film("tt0816692");
选项
$imdb = new Imdb; // Options are passed as an array as the second argument // These are the default options $imdb->film("tt0816692", [ 'cache' => true, 'curlHeaders' => ['Accept-Language: en-US,en;q=0.5'], 'techSpecs' => true, ]); $imdb->search("Interstellar", [ 'category' => 'all', 'curlHeaders' => ['Accept-Language: en-US,en;q=0.5'], ]);
最佳匹配
如果你不知道电影的imdb-id,可以输入一个搜索字符串。这将搜索IMDB,并使用第一个结果作为获取数据的电影。
注意,这会比直接输入ID慢,因为它需要先搜索IMDB,然后才能获取电影数据。
// Searches imdb and gets the film data of the first result // -> will return the film data for 'Apocalypse Now' $imdb->film("Apocalypse");
特性
电影数据
- Title
- Year
- Rating
- Poster
- Length
- Plot
- Trailer
- id
- link
- Cast
- actor name
- actor id
- image
- Technical Specs
- Movies
搜索
搜索IMDB,返回一个包含电影、人员和公司的数组
- Films
- id
- title
- image
- People
- id
- name
- image
- Companies
- id
- name
- image
依赖项
所有依赖项都由
composer
自动管理。