tongyifan / doubanphp
Library for parsing metadata information about movies and TV shows from Douban Movie
0.1.1
2020-02-22 07:20 UTC
Requires
- php: >=5.6
- ext-curl: *
- ext-json: *
- cakephp/cache: ^3.8
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2025-03-26 23:58:35 UTC
README
Library for parsing metadata information about movies and TV shows from Douban Movie. This library use data api from Rhilip/pt-gen-cfworker, cache included.
-
Setup your own pt-gen on Cloudflare worker See Rhilip/pt-gen-cfworker. Then change
api_endpoint
inconf/config.ini
to your own cfworker. -
Requirements
- PHP >= 5.6
- PHP cURL extension
- PHP JSON extension
- Install
composer install tongyifan/doubanphp
- Usage
<?php require 'vendor/autoload.php'; use Douban\Douban; $douban_id = '30458442'; $douban = new Douban($douban_id); $douban_rating = $douban->douban_rating;
- Advanced usage
- You can change cache settings by changing
conf/config.ini
. - Or change it in your application.
<?php require 'vendor/autoload.php'; use Douban\Douban; use Douban\Config; $config = new Config(); // see https://book.cakephp.org/3/en/core-libraries/caching.html for more information. $config->cache_config = [ 'className' => 'Redis', 'duration' => '+14 days', 'prefix' => 'doubanphp_', 'host' => '127.0.0.1', 'port' => 6379 ]; $imdb_id = 'tt11043632'; $douban = new Douban($imdb_id, null, $config); $douban_rating = $douban->douban_rating; // or use numeric IMDb id, but you should add "source". $imdb_id = '11043632'; $douban = new Douban($imdb_id, 'imdb', $config); $douban_rating = $douban->douban_rating;