aalfiann/imdb-engine

一个类似于你自己的IMDB引擎的IMDB抓取器。

1.1.0 2018-11-09 07:01 UTC

This package is auto-updated.

Last update: 2024-09-09 20:08:07 UTC


README

Version Total Downloads License

一个类似于你自己的IMDB引擎的IMDB抓取器。

此脚本是一个概念验证。它在工作中,但你不应使用它。IMDb不允许此数据获取方法。我不使用或推广此脚本。使用脚本的责任由你自己承担。

使用的技巧称为“网络爬虫”。这意味着,如果IMDb更改了其任何HTML,脚本将失败。我不会定期更新此脚本,因此不要期望它始终能正常工作。

安装

通过 Composer 安装此包。

composer require "aalfiann/imdb-engine:^1.0"

通过ID获取电影

require_once ('vendor/autoload.php');
use \aalfiann\IMDB;

$imdb = new IMDB();
$imdb->query    = 'tt3829266';      // ID IMDB Movie {required}
$imdb->trailer  = false;            // This will make faster because there is no second request to get video trailer. Default value is true.
echo var_dump($imdb->find()->getMovie());

将输出转换为JSON格式

header('Content-Type: application/json');
echo $imdb->find()->getMovieJson(JSON_PRETTY_PRINT);

搜索电影

require_once ('vendor/autoload.php');
use \aalfiann\IMDB;

$imdb = new IMDB();
$imdb->query    = 'The Predator';   // Movie title {not required}. If blank then will show the new popular movies. The title must be don't include year or only conjunctions.
$imdb->genres   = '';               // You can filter by input multiple genres with commas separated
$imdb->userid   = '';               // You can filter by input user id. Ex. Jackie Chan user id is >> nm0000329
$imdb->start    = 1;                // Start number for navigation in many results.
$imdb->itemsperpage = 50;           // You can change this with 50, 100 and 250. Default is 50.
echo var_dump($imdb->search()->getList());

将输出转换为JSON格式

header('Content-Type: application/json');
echo $imdb->search()->getListJson(JSON_PRETTY_PRINT);

通过搜索艺术家获取用户ID

require_once ('vendor/autoload.php');
use \aalfiann\IMDB;

$imdb = new IMDB();
$imdb->query = 'Audrey Hepburn';    // Artist name {required}
$imdb->start = 1;                   // Start number for navigation in many results.
$imdb->itemsperpage = 50;           // You can change this with 50, 100 and 250. Default is 50.
echo var_dump($imdb->searchArtist()->getArtistList());

将输出转换为JSON格式

header('Content-Type: application/json');
echo $imdb->searchArtist()->getArtistListJson(JSON_PRETTY_PRINT);

使用代理

如果你的IP地址被IMDb封锁,你可以使用代理发送请求。
只需添加以下行

$imdb->proxy = '12.62.65.30:8124';  // IP:Port server proxy
$imdb->proxyauth = 'user:pass';     // Proxy authentication if any