detain/phlix-plugin-myanimelist
Composer 安装命令:
composer require detain/phlix-plugin-myanimelist
包简介
MyAnimeList metadata provider — anime titles, descriptions, episodes, ratings via the MAL API v2.
README 文档
README
MyAnimeList metadata provider plugin for Phlix — anime titles, descriptions, episodes, ratings via the MyAnimeList API v2.
Overview
This plugin fetches structured anime metadata from MyAnimeList
using the official MAL API v2 (https://api.myanimelist.net/v2):
- Search (
GET /anime?q=...) — resolve a filename to a MAL anime ID - Details (
GET /anime/{id}?fields=...) — fetch titles, synopsis, episodes, rating, studio
Every request carries an X-MAL-CLIENT-ID header with your MAL client ID.
Features
- Title search — query MAL for the best-matching anime ID
- Full metadata — primary/English/Japanese titles, synonyms, genres, year, type, rating
- Episode info — episode count and average episode runtime
- Synopsis — long-form description text
- No SDK — plain HTTP/JSON over the PHP stream wrapper; no extra dependencies
Install
The plugin is unsigned by design. Install via the Phlix admin UI:
-
Log in to your Phlix server as an admin user (
users.is_admin = 1). -
Browse to
/admin/plugins. -
Paste this URL into the Install from URL form:
https://raw.githubusercontent.com/detain/phlix-plugin-myanimelist/main/plugin.json -
The server downloads and validates the manifest, runs
composer install --no-dev, and stores a row in thepluginstable. -
Configure your MyAnimeList client ID in the plugin settings form.
-
Enable the plugin.
Getting a MAL Client ID
- Sign in at myanimelist.net.
- Go to API → Create ID.
- Create an app and copy the Client ID (the Client Secret is not needed for read-only metadata).
Configuration
| Setting | Type | Required | Description |
|---|---|---|---|
client_id |
string (secret) | Yes | Your MAL API client ID, sent as the X-MAL-CLIENT-ID header |
How It Works
When the MetadataManager calls lookup($filePath):
- Parse filename — extract anime title from file path (strips S##E##, group tags, resolution suffixes)
- Search —
GET /anime?q=<title>&limit=10and take the first result's ID - Fetch details —
GET /anime/{id}?fields=...for full anime data - Map response — translate the MAL JSON layout to MetadataManager's expected return shape
MAL API Notes
- Protocol: REST/JSON over HTTPS to
https://api.myanimelist.net/v2 - Auth: every request sends
X-MAL-CLIENT-ID: <client_id> - Search:
GET /anime?q=<query>&limit=10→{ "data": [ { "node": { "id", "title", ... } } ] } - Details:
GET /anime/{id}?fields=id,title,main_picture,alternative_titles,start_date,synopsis,mean,num_scoring_users,genres,num_episodes,media_type,status,studios,average_episode_duration,rating
See the MAL API v2 reference for full details.
Data Returned
[
'title' => 'Cowboy Bebop', // Primary title
'original_name' => 'カウボーイビバップ', // Japanese title (falls back to title)
'overview' => 'In the year 2071...', // Synopsis
'year' => 1998, // First-aired year
'genres' => ['Action', 'Sci-Fi'], // Genre names
'rating' => 8.75, // MAL mean score (0-10)
'vote_count' => 900000, // Number of scoring users
'poster_url' => 'https://cdn.myanimelist.net/images/anime/4/19644l.jpg',
'fanart_url' => null, // MAL has no fanart/backdrop
'episodes' => 26, // Episode count
'type' => 'tv', // tv / movie / ova / special / ona / music
'mal_id' => 1, // MyAnimeList anime ID
'titles' => ['Cowboy Bebop', 'カウボーイビバップ', 'Cowboy Bebop (1998)'],
'status' => 'Finished', // Finished / Currently Airing / Upcoming
'runtime_ticks' => 14400000000, // Avg episode length in ticks (1s = 10,000,000)
'studio' => 'Sunrise', // First studio name
]
A no-match returns [].
Fork as a Starter
This plugin is based on phlix-plugin-example. To create your own metadata provider:
- Fork or copy this repository.
- Edit
plugin.json— pick a newname(must start withphlix-plugin-), bumpversionto0.1.0, changeentryto your FQCN. - Edit
composer.json— rename the package, update PSR-4 autoload prefix. - Replace
src/MyanimelistMetadataProvider.phpwith your own implementation. - Run tests:
composer install && vendor/bin/phpunit.
Testing
composer install
vendor/bin/phpunit
vendor/bin/phpunit --testdox # verbose output
The unit tests exercise the parse/map helpers via Reflection with fixture JSON — no live network calls are made.
License
MIT — see LICENSE.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-10