https://github.com/anime-db/smotret-anime-browser-bundle
Smotret-Anime.ru API browser
https://github.com/anime-db/smotret-anime-browser-bundle
browser php plugin smotret-anime
Last synced: 4 months ago
JSON representation
Smotret-Anime.ru API browser
- Host: GitHub
- URL: https://github.com/anime-db/smotret-anime-browser-bundle
- Owner: anime-db
- License: gpl-3.0
- Created: 2017-07-19T15:38:50.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-01T09:16:13.000Z (almost 8 years ago)
- Last Synced: 2024-04-28T06:48:15.364Z (about 1 year ago)
- Topics: browser, php, plugin, smotret-anime
- Language: PHP
- Size: 32.2 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://smotret-anime.ru)
[](https://packagist.org/packages/anime-db/smotret-anime-browser-bundle)
[](https://packagist.org/packages/anime-db/smotret-anime-browser-bundle)
[](https://travis-ci.org/anime-db/smotret-anime-browser-bundle)
[](https://coveralls.io/github/anime-db/smotret-anime-browser-bundle?branch=master)
[](https://scrutinizer-ci.com/g/anime-db/smotret-anime-browser-bundle/?branch=master)
[](https://insight.sensiolabs.com/projects/2a347b13-5d26-4d06-a66d-e45c5f72606e)
[](https://styleci.io/repos/97733674)
[](https://github.com/anime-db/smotret-anime-browser-bundle)Smotret-Anime.ru API browser
============================Installation
------------Pretty simple with [Composer](http://packagist.org), run:
```sh
composer require anime-db/smotret-anime-browser-bundle
```Add AnimeDbSmotretAnimeBrowserBundle to your application kernel
```php
// app/appKernel.phppublic function registerBundles()
{
$bundles = array(
// ...
new AnimeDb\Bundle\SmotretAnimeBrowserBundle\AnimeDbSmotretAnimeBrowserBundle(),
);
}
```Configuration
-------------```yml
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'
```Usage
-----First get browser
```php
$browser = $this->get('anime_db.smotret_anime.browser');
```### Translations
Last added translations:
```php
$content = $browser->get('translations');
```Last translations for ongoings:
```php
$content = $browser->get('translations?feed=recent');
```List of all translations (at the beginning of the oldest, convenient for a full scan):
```php
$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):```php
$content = $browser->get('translations?feed=id&afterId=10000');
```One translation:
```php
$content = $browser->get('translations/905760');
```### Series
Anime List:
```php
$content = $browser->get('series');
```You can select only specific fields:
```php
$content = $browser->get('series?fields=id,title,typeTitle,posterUrlSmall');
```Advanced filter as on the [site](https://smotret-anime.ru/catalog/filter/genre@=8,35;genre_op=and):
```php
$content = $browser->get('series?chips=genre@=8,35;genre_op=and');
```You can filter by parameters:
```php
$content = $browser->get('series?myAnimeListId=24133');
```Search by name:
```php
$content = $browser->get('series?query=gate');
```Information about a specific anime and a list of episodes:
```php
$content = $browser->get('series/9866');
```### Episodes
Information about a specific episode and a list of translations:
```php
$content = $browser->get('episodes/102173');
```### Limit and Offset
Through `limit` and `offset`, you can adjust the number of elements "on the page" and the offset from the beginning:
```php
$content = $browser->get('series?limit=1&offset=10');
```### Catch exceptions
```php
use AnimeDb\Bundle\SmotretAnimeBrowserBundle\Exception\NotFoundException;try {
$content = $browser->get('series/1');
} catch (NotFoundException $e) {
// series not found
} catch (\Exception $e) {
// other exceptions
}
```### Request options
You can customize request options. See [Guzzle Documentation](http://docs.guzzlephp.org/en/stable/request-options.html).
License
-------This bundle is under the [GPL v3 license](http://opensource.org/licenses/GPL-3.0).
See the complete license in the file: LICENSE