Pretty simple with Composer, run:
composer require anime-db/smotret-anime-browser-bundle
Add AnimeDbSmotretAnimeBrowserBundle to your application kernel
// app/appKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new AnimeDb\Bundle\SmotretAnimeBrowserBundle\AnimeDbSmotretAnimeBrowserBundle(),
);
}
anime_db_smotret_anime_browser:
# Host name
# As a default used 'http://smotret-anime.ru'
host: 'http://smotret-anime.ru'
# Host name
# As a default used '/api/'
prefix: '/api/'
# HTTP User-Agent
# No default value
client: 'My Custom Bot 1.0'
First get browser
$browser = $this->get('anime_db.smotret_anime.browser');
Last added translations:
$content = $browser->get('translations');
Last translations for ongoings:
$content = $browser->get('translations?feed=recent');
List of all translations (at the beginning of the oldest, convenient for a full scan):
$content = $browser->get('translations?feed=id');
When scanning in full, do not use the offset
parameter. Use afterId
(offset works very slowly when the account goes
to hundreds of thousands of translations):
$content = $browser->get('translations?feed=id&afterId=10000');
One translation:
$content = $browser->get('translations/905760');
Anime List:
$content = $browser->get('series');
You can select only specific fields:
$content = $browser->get('series?fields=id,title,typeTitle,posterUrlSmall');
Advanced filter as on the site:
$content = $browser->get('series?chips=genre@=8,35;genre_op=and');
You can filter by parameters:
$content = $browser->get('series?myAnimeListId=24133');
Search by name:
$content = $browser->get('series?query=gate');
Information about a specific anime and a list of episodes:
$content = $browser->get('series/9866');
Information about a specific episode and a list of translations:
$content = $browser->get('episodes/102173');
Through limit
and offset
, you can adjust the number of elements "on the page" and the offset from the beginning:
$content = $browser->get('series?limit=1&offset=10');
use AnimeDb\Bundle\SmotretAnimeBrowserBundle\Exception\NotFoundException;
try {
$content = $browser->get('series/1');
} catch (NotFoundException $e) {
// series not found
} catch (\Exception $e) {
// other exceptions
}
You can customize request options. See Guzzle Documentation.
This bundle is under the GPL v3 license. See the complete license in the file: LICENSE