rl404 / mal-scraper
此包已被废弃且不再维护。未建议替代包。
非官方MyAnimeList API,可以抓取并解析MyAnimeList网站上的所有内容到数组或JSON格式
v1.5.3
2019-04-21 08:35 UTC
Requires
- php: >=5.4
- rl404/php-simple-html-dom-parser: ~1.5.0
- rl404/simple-php-cache: ~1.6.1
README
前往此处获取更好且更更新的版本。
Mal-Scraper 是一个非官方的PHP API,可以抓取并解析MyAnimeList的页面源代码。
它创建的目的是帮助人们获取MyAnimeList数据,而无需依赖MyAnimeList,因为他们已经禁用了/关闭了他们的API。只要网络是畅通的,我们就能获取其页面源代码,它就能正常工作。
Mal-Scraper 使用Sunra的 HTML DOM解析器,并受到Kylart的和Jikan的 API的启发。
对于想要REST API的用户,请访问此处。
功能
- 获取动漫、漫画、角色(来自动漫和漫画)、人物(配音演员、作者、工作人员等)、评论或推荐的通用信息
- 获取动漫或漫画视频、剧集、评论、推荐、角色和工作人员、统计数据和评分或图片的附加信息
- 获取所选工作室/制作公司、杂志或类别的动漫或漫画列表
- 获取所有动漫或漫画类别、动漫工作室/制作公司或漫画杂志的列表
- 获取参与动漫或漫画的角色和工作人员的列表
- 获取动漫、漫画或最佳投票评论的列表(支持分页)
- 获取动漫或漫画推荐的列表(支持分页)
- 获取搜索结果,包括动漫、漫画、角色、人物或用户(支持分页)
- 获取季度动漫
- 获取来自不同类别(全部、正在播出、即将播出等)的顶级动漫列表(支持分页)
- 获取来自不同类别(全部、漫画、小说等)的顶级漫画列表(支持分页)
- 获取最受欢迎的角色和人物的列表(支持分页)
- 获取用户资料、朋友、历史记录和动漫/漫画列表的信息
- 缓存(使用Simple-PHP-Cache库)
- 可转换为HTTP响应(用于API)
- (额外)从用户列表中获取所有动漫/漫画封面
更多即将到来...
安装
composer require rl404/mal-scraper- 就是这样。
依赖项
- PHP 5.4+
- rl404/simple-php-cache 1.6.1+
- rl404/php-simple-html-dom-parser 1.5.3+
用法
require "vendor/autoload.php"; use MalScraper\MalScraper; // Default (no caching, return array) $myMalScraper = new MalScraper(); // Caching feature $myMalScraper = new MalScraper([ 'enable_cache' => true, // enable caching 'cache_time' => 3600, // (optional) caching time in seconds (1 day as default) 'cache_path' => '../Cache/' // (optional) caching path (/src/MalScraper/Cache/ as default) ]); // Return http response $myMalScraper = new MalScraper([ 'to_api' => true, // convert return to http response ]);
如果你设置了
cache_path,别忘了文件夹位置的最后一个反斜杠('/')。
示例
$cowboyBebopInfo = $myMalScraper->getInfo('anime', 1); print_r($cowboyBebopInfo);
结果
Array
(
[id] => 1
[cover] => https://cdn.myanimelist.net/images/anime/4/19644.jpg
[title] => Cowboy Bebop
[title2] => Array
(
[english] => Cowboy Bebop
[synonym] =>
[japanese] => カウボーイビバップ
)
[synopsis] => In the year 2071, humanity has colonized several of the planets and moons of the solar system leaving the now uninhabitable surface of planet Earth behind. The Inter Solar System Police attempts to keep peace in the galaxy, aided in part by outlaw bounty hunters, referred to as \"Cowboys.\" The ragtag team aboard the spaceship Bebop are two such individuals.
Mellow and carefree Spike Spiegel is balanced by his boisterous, pragmatic partner Jet Black as the pair makes a living chasing bounties and collecting rewards. Thrown off course by the addition of new members that they meet in their travels—Ein, a genetically engineered, highly intelligent Welsh Corgi; femme fatale Faye Valentine, an enigmatic trickster with memory loss; and the strange computer whiz kid Edward Wong—the crew embarks on thrilling adventures that unravel each member's dark and mysterious past little by little.
Well-balanced with high density action and light-hearted comedy, Cowboy Bebop is a space Western classic and an homage to the smooth and improvised music it is named after.
[Written by MAL Rewrite]
[score] => 8.81
[voter] => 397445
[rank] => 27
[popularity] => 39
[members] => 777210
[favorite] => 42552
[type] => TV
[episodes] => 26
[status] => Finished Airing
[aired] => Array
(
[start] => 1998-04-03
[end] => 1999-04-24
)
[premiered] => Spring 1998
[broadcast] => Saturdays at 01:00 (JST)
[producers] => Array
(
[0] => Array
(
[id] => 23
[name] => Bandai Visual
)
)
[licensors] => Array
(
[0] => Array
(
[id] => 102
[name] => Funimation
)
[1] => Array
(
[id] => 233
[name] => Bandai Entertainment
)
)
[studios] => Array
(
[0] => Array
(
[id] => 14
[name] => Sunrise
)
)
[source] => Original
[genres] => Array
(
[0] => Array
(
[id] => 1
[name] => Action
)
[1] => Array
(
[id] => 2
[name] => Adventure
)
[2] => Array
(
[id] => 4
[name] => Comedy
)
[3] => Array
(
[id] => 8
[name] => Drama
)
[4] => Array
(
[id] => 24
[name] => Sci-Fi
)
[5] => Array
(
[id] => 29
[name] => Space
)
)
[duration] => 24 min. per ep.
[rating] => R - 17+ (violence & profanity)
[related] => Array
(
[adaptation] => Array
(
[0] => Array
(
[id] => 173
[title] => Cowboy Bebop
[type] => manga
)
[1] => Array
(
[id] => 174
[title] => Shooting Star Bebop: Cowboy Bebop
[type] => manga
)
)
[side story] => Array
(
[0] => Array
(
[id] => 5
[title] => Cowboy Bebop: Tengoku no Tobira
[type] => anime
)
[1] => Array
(
[id] => 17205
[title] => Cowboy Bebop: Ein no Natsuyasumi
[type] => anime
)
)
[summary] => Array
(
[0] => Array
(
[id] => 4037
[title] => Cowboy Bebop: Yose Atsume Blues
[type] => anime
)
)
)
[character] => Array
(
[0] => Array
(
[id] => 1
[name] => Spiegel, Spike
[role] => Main
[image] => https://cdn.myanimelist.net/images/characters/4/50197.jpg
[va_name] => Yamadera, Kouichi
[va_id] => 11
[va_image] => https://cdn.myanimelist.net/images/voiceactors/3/44674.jpg
[va_role] => Japanese
)
[1] => Array
(
[id] => 16
[name] => Wong Hau Pepelu Tivrusky IV, Edward
[role] => Main
[image] => https://cdn.myanimelist.net/images/characters/16/30533.jpg
[va_name] => Tada, Aoi
[va_id] => 658
[va_image] => https://cdn.myanimelist.net/images/voiceactors/2/27665.jpg
[va_role] => Japanese
)
[2] => Array
(
[id] => 2
[name] => Valentine, Faye
[role] => Main
[image] => https://cdn.myanimelist.net/images/characters/15/264961.jpg
[va_name] => Hayashibara, Megumi
[va_id] => 14
[va_image] => https://cdn.myanimelist.net/images/voiceactors/1/54011.jpg
[va_role] => Japanese
)
[3] => Array
(
[id] => 3
[name] => Black, Jet
[role] => Main
[image] => https://cdn.myanimelist.net/images/characters/11/253723.jpg
[va_name] => Ishizuka, Unshou
[va_id] => 357
[va_image] => https://cdn.myanimelist.net/images/voiceactors/2/17135.jpg
[va_role] => Japanese
)
[4] => Array
(
[id] => 4
[name] => Ein
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/5/30624.jpg
[va_name] => Yamadera, Kouichi
[va_id] => 11
[va_image] => https://cdn.myanimelist.net/images/voiceactors/3/44674.jpg
[va_role] => Japanese
)
[5] => Array
(
[id] => 2734
[name] => Vicious
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/4/284773.jpg
[va_name] => Wakamoto, Norio
[va_id] => 84
[va_image] => https://cdn.myanimelist.net/images/voiceactors/3/46186.jpg
[va_role] => Japanese
)
[6] => Array
(
[id] => 2736
[name] => Eckener, Grencia Mars Elijah Guo
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/13/213557.jpg
[va_name] => Horiuchi, Kenyuu
[va_id] => 262
[va_image] => https://cdn.myanimelist.net/images/voiceactors/2/49692.jpg
[va_role] => Japanese
)
[7] => Array
(
[id] => 2735
[name] => Julia
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/9/52297.jpg
[va_name] => Takashima, Gara
[va_id] => 497
[va_image] => https://cdn.myanimelist.net/images/voiceactors/3/46185.jpg
[va_role] => Japanese
)
[8] => Array
(
[id] => 23740
[name] => Von de Oniyate, Andy
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/3/213563.jpg
[va_name] => Ebara, Masashi
[va_id] => 179
[va_image] => https://cdn.myanimelist.net/images/voiceactors/3/49817.jpg
[va_role] => Japanese
)
[9] => Array
(
[id] => 29313
[name] => Mad Pierrot
[role] => Supporting
[image] => https://cdn.myanimelist.net/images/characters/11/212087.jpg
[va_name] => Ginga, Banjou
[va_id] => 330
[va_image] => https://cdn.myanimelist.net/images/voiceactors/1/44678.jpg
[va_role] => Japanese
)
)
[staff] => Array
(
[0] => Array
(
[id] => 40009
[name] => Maseba, Yutaka
[role] => Producer
[image] => https://cdn.myanimelist.net/images/voiceactors/3/40216.jpg
)
[1] => Array
(
[id] => 6519
[name] => Minami, Masahiko
[role] => Producer
[image] => https://cdn.myanimelist.net/images/voiceactors/2/39506.jpg
)
[2] => Array
(
[id] => 2009
[name] => Watanabe, Shinichiro
[role] => Director, Script, Storyboard
[image] => https://cdn.myanimelist.net/images/voiceactors/1/54604.jpg
)
[3] => Array
(
[id] => 20050
[name] => Kobayashi, Katsuyoshi
[role] => Sound Director
[image] =>
)
)
[song] => Array
(
[opening] => Array
(
[0] => \"Tank!\" by The Seatbelts (eps 1-25)
)
[closing] => Array
(
[0] => \"The Real Folk Blues\" by The Seatbelts feat. Mai Yamane (eps 1-12, 14-25)
[1] => \"Space Lion\" by The Seatbelts (ep 13)
[2] => \"Blue\" by The Seatbelts feat. Mai Yamane (ep 26)
)
)
)
有关更多用法和方法,请访问wiki
贡献
- 将其分支出来!
- 创建您的功能分支:
git checkout -b my-new-feature - 提交您的更改:
git commit -am '添加一些功能' - 推送到分支:
git push origin my-new-feature - 提交拉取请求。
免责声明
所有数据(包括动漫、漫画、人物等)和MyAnimeList标志均属于其各自的版权所有者。Mal-Scraper与内容提供商没有任何关联。
许可证
MIT许可证
版权所有 (c) rl404
