hmerritt/imdb-api

可以获取电影数据和搜索结果的IMDB API

安装次数: 7,710

依赖: 0

建议: 0

安全: 0

星星: 59

关注者: 2

分支: 22

开放问题: 1

类型:项目

v1.2.15 2024-07-08 09:10 UTC

README

Latest Stable Version CircleCI Coverage Status

PHP IMDB-API,可以获取电影数据和搜索结果。

安装

使用 composer 安装最新版本。

$ composer require hmerritt/imdb-api

用法

// Assuming you installed from Composer:
require "vendor/autoload.php";
use hmerritt\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
- Genres
- Year
- Length
- Plot
- Rating
- Rating Votes (# of votes)
- Poster
- Trailer
    - id
    - link
- Cast
    - actor name
    - actor id
    - character
    - avatar
    - avatar_hq (high quality avatar)
- Technical Specs

搜索

搜索IMDB,返回包含电影、人物和公司的数组

- Films
    - id
    - title
    - image
- People
    - id
    - name
    - image
- Companies
    - id
    - name
    - image

依赖

所有依赖项都由 composer 自动管理。