aalfiann / myanimelist-api-php
一个简单的MyAnimeList API类,用于将MyAnimeList集成到您的PHP网站中。
1.0.1
2018-09-17 07:51 UTC
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2024-09-20 22:12:56 UTC
README
一个简单的MyAnimeList API类,用于将MyAnimeList集成到您的PHP网站中。
您可以使用MyAnimeList的官方API或直接抓取数据,我们使其变得非常简单,您可以使用json格式输出数据。
最后一次测试是在2018年9月.
特性
- 使用标题或ID搜索动漫或漫画
- 数据响应为JSON,我们不使用XML
- 如果需要,使用代理发送请求
系统需求
- PHP 5.3或更高版本
安装
通过Composer安装此包。
composer require "aalfiann/myanimelist-api-php:^1.0"
如何使用非官方API(不需要登录)
<?php require_once ('vendor/autoload.php'); use \aalfiann\MyAnimeList; /** * Build object and set parameter * * @property pretty = Output data json will be beautifier. Type data is boolean, default value is false. * @property proxy = Create connection using proxy. Default value is null. * @property proxyauth = Your credentials to use the proxy. Default value is null. */ $getMAL = new MyAnimeList; $getMAL->pretty = true; /** * Example to search Anime */ echo $getMAL->findAnime('overlord',true); //Set false to get data detail directly. /** * Example to search Manga */ echo $getMAL->findManga('naruto',true); //Set false to get data detail directly. /** * Example to get Anime by ID * Data will return 1, very accurate */ echo $getMAL->grabAnime('2886'); /** * Example to get Manga by ID * Data will return 1, very accurate */ echo $getMAL->grabManga('21'); ?>
如何使用MyAnimeList的官方API(需要登录)
注意:MyAnimeList的官方API已关闭!
请小心处理您的登录信息,如果您输入错误凭证超过10次,您的ID和IP将被锁定8小时。以下是如何使用官方MyAnimeList调用数据的示例。
<?php require_once ('vendor/autoload.php'); use \aalfiann\MyAnimeList; /** * Build object and set parameter * * @property login = Your login in MyAnimeList. (Required) * @property pretty = Output data json will be beautifier. Type data is boolean, default value is false. * @property proxy = Create connection using proxy. Default value is null. * @property proxyauth = Your credentials to use the proxy. Default value is null. */ $getMAL = new MyAnimeList; $getMAL->login = 'yourusername:yourpassword'; $getMAL->pretty = true; /** * Example to search Anime */ echo $getMAL->searchAnime('full metal',true); //Set false to get data detail directly. /** * Example to search Manga */ echo $getMAL->searchManga('full metal',true); //Set false to get data detail directly. /** * Example to get Anime * Data will return 1, accuracy will depend on the title */ echo $getMAL->searchAnime('full metal'); /** * Example to get Manga * Data will return 1, accuracy will depend on the title */ echo $getMAL->searchManga('full metal'); /** * Example to verify credentials in MyAnimeList */ echo $getMAL->verify(); ?>
限制
- 此脚本仅用于获取动漫和漫画的数据。
因此,我们需要有人有时间改进此脚本。
如何贡献
拉取请求
- 从myanimelist-api-php仓库进行分支
- 为每个功能或改进创建一个新的分支
- 从每个功能分支向develop分支发送拉取请求