GithubHelp home page GithubHelp logo

canihavesomecoffee / thetvdbapi Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 8.0 245 KB

PHP implementation for the 2nd version of the TheTVDb API

License: ISC License

PHP 100.00%
php api-client api-wrapper thetvdb thetvdb-api api hacktoberfest

thetvdbapi's People

Contributors

canihavesomecoffee avatar dariusiii avatar dependabot-preview[bot] avatar fossil01 avatar tntsoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

thetvdbapi's Issues

Package symfony/inflector is abandoned

Package symfony/inflector is abandoned, you should avoid using it. Use use EnglishInflector from the String component instead instead.

It looks like this package is called by symfony/property-access 4.x which is now at version 5.x without that dependency.

502 error from TheTVDB api

I am having issues for some time now, because i am getting the 502 error when checking for episodes info.

[2021-12-05 04:54:26] NNTmux.ERROR: Got status code 502 from service at path series/385118/episodes/default {"exception":"[object] (Exception(code: 0): Got status code 502 from service at path **series/385118/episodes/default** at vendor/canihavesomecoffe>[stacktrace]
#0 vendor/canihavesomecoffee/thetvdbapi/src/Route/SeriesRoute.php(191): CanIHaveSomeCoffee\\TheTVDbAPI\\TheTVDbAPI->performAPICallWithJsonResponse()
#1 Blacklight/processing/tv/TVDB.php(338): CanIHaveSomeCoffee\\TheTVDbAPI\\Route\\SeriesRoute->episodes()
#2 Blacklight/processing/tv/TVDB.php(178): Blacklight\\processing\\tv\\TVDB->getEpisodeInfo()#3 Blacklight/processing/PostProcess.php(248): Blacklight\\processing\\tv\\TVDB->processSite()
#4 misc/update/postprocess.php(123): Blacklight\\processing\\PostProcess->processTv()
#5 {main}

Interesting enough, the swagger fails too:

https://api4.thetvdb.com/v4/series/385118/episodes/default?page=0&season=1&episodeNumber=1

image

API Changes

I think we all got this e-mail, but pasting it here just to be sure.

Hello developer,
You are receiving this email because you are the owner of a project key for TheTVDB's v4 API and we wanted to make you aware of a few upcoming updates.
Beginning February 23, 2022, we will deploy a breaking change to the v4 API. The breaking change will involve artwork. Currently, the artwork "image" field and artwork "thumbnail" field on movies is only a relative URL. Additionally, movie actor images also return only a relative URL.
We would like to correct this so that the URL returned is absolute. It is our intent to issue as few breaking changes on the API as possible, but this is occasionally necessary. Please be aware that beginning on February 23rd, these endpoints will return absolute URLs, so please plan to modify your applications accordingly.
Additionally, 3 upcoming API enhancements will also be available at the end of the month:
Ability to download all art for a single series
A new field for content ratings by country at the series level
A new filter endpoint that will allow developers to discover content by status, genre, country, language, etc.
To make use of these new enhancements, please see our [documentation](https://u10505776.ct.sendgrid.net/ls/click?upn=xMYYCP13hVd-2BZPpbVcMPHXB9ppf3Y9h8RMZI83iiSITXhLnfCN1x2goadtIFWWU-2FUMA6_Zd6hRd3O-2Bi7TiTmhDOob5oQxYuS00-2FFaW9waCSXh-2B6jfGPOiHx-2BUziY3ABaSMzlGpX0EG-2Fi75ZhM5V4xL-2BQu-2By3HUgebVI-2FgttyoPCBoTkzUsVKIv5sSh7mFmJTytmDhV1c1yRpBo7divddxzpA2xkZFZbcaBuPl2F5Le0U29gBlqjKGvg2q6gugKWcTghnVNQPBb25eBhWDNyqtRBFoZwnPxAfR0-2Bgd4t-2B8jXFsttV-2FoogZC8qr8BkiWmrDARwxQVmg5DuBUEB5YaMi8SJ-2Fl1UwJmabvfXtAKDGBcxsKDG-2BantsA-2BHxuARuiJOcgeunhTKUkXHdKJpJDNyteEcPL75cQLpTrXlQ-2BCaH6B2FLlkuTrdXqvMUxJoc-2F5gK5Ne-2Feoak-2BPJLdLqMz2AVlVxjr-2FV5Cqh3by-2BjwLhqr7jfl3A-3D).

Sincerely,
TheTVDB Team

Actor Model - NULL imageauthor

The type of the "imageAuthor" attribute for class "CanIHaveSomeCoffee\TheTVDbAPI\Model\Actor" must be one of "int" ("NULL" given)

To fix, please change Model/Actor.php line 60 from
* @var integer
to
* @var integer|null

Unable to use the "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor" class as the "phpdocumentor/reflection-docblock" package is not installed

This happens when I install my application in production without dev dependencies. composer install --no-dev

Looks like phpdocumentor/reflection-docblock is called by phpunit which is also in this repo's dev deps. So not sure why it throws an error in production.

[2022-02-12 14:07:42] REMOVED.ERROR: Unable to use the "Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor" class as the "phpdocumentor/reflection-docblock" package is not installed. {"exception":"[object] (LogicException(code: 0): Unable to use the \"Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor\" class as the \"phpdocumentor/reflection-docblock\" package is not installed. at /var/www/REMOVED/vendor/symfony/property-info/Extractor/PhpDocExtractor.php:63)
[stacktrace]
#0 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/DataParser.php(99): Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor->__construct()
#1 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/DataParser.php(68): CanIHaveSomeCoffee\\TheTVDbAPI\\DataParser::getSerializer()
#2 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/DataParser.php(85): CanIHaveSomeCoffee\\TheTVDbAPI\\DataParser::parseData()
#3 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/Route/SearchRoute.php(85): CanIHaveSomeCoffee\\TheTVDbAPI\\DataParser::parseDataArray()
#4 /var/www/REMOVED/Blacklight/processing/tv/TVDB.php(285): CanIHaveSomeCoffee\\TheTVDbAPI\\Route\\SearchRoute->search()
#5 /var/www/REMOVED/Blacklight/processing/tv/TVDB.php(148): Blacklight\\processing\\tv\\TVDB->getShowInfo()
#6 /var/www/REMOVED/Blacklight/processing/PostProcess.php(248): Blacklight\\processing\\tv\\TVDB->processSite()
#7 /var/www/REMOVED/misc/update/postprocess.php(125): Blacklight\\processing\\PostProcess->processTv()
#8 {main}
"}

symfony/serializer 5.3

Hello canihavesomecoffee,
is it possible to make compatible this package with Symfony serializer component v5? I have not found any mentions about deprecations or BC issues in Symfony blog or documentation. And I would upgrade my app to Symfony framework 5.3.

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires canihavesomecoffee/thetvdbapi 2.* -> satisfiable by canihavesomecoffee/thetvdbapi[2.0.0.beta].
    - canihavesomecoffee/thetvdbapi 2.0.0.beta requires symfony/serializer ^4.0 -> found symfony/serializer[v4.0.0-BETA1, ..., 4.4.x-dev] but these were not loaded, likely because it conflicts with another require.

How would I fetch all episodes for a show?

It looks like it only returns page 1, but the description for getEpisodes() shows: All episodes for a given series. Paginated with 100 results per page.

How would I just feed it a TVDB ID and make it return all episodes at once?

It looks like getLastPage() and getNextPage() is not used anywhere.

Guzzle 7

Any plans for latest Guzzle (7.x) support? It's holding back my application (Laravel) upgrade :-)

I think PHPUnit can also be upgraded to 9.x (maybe).

Possible to search just by title?

I am having an issue where TVDB returns a lot of crap shows when I search for this query DAVE 2020 or DAVE (2020).

It seems to return shows with the word dave in either some URL or the network but the word is not present in the title at all. For example it returns The Island (2022) (UK)

So I was wondering if it is possible to just search by title?

The type of the "banner" attribute for class "CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicSeries" must be one of "string" ("NULL" given)

I've been getting these over the past few days. Did something in the TVDB API change? I didn't make any changes to my code.

[2020-01-28 11:25:51] REMOVED.ERROR: The type of the "banner" attribute for class "CanIHaveSomeCoffee\TheTVDbAPI\Model\BasicSeries" must be one of "string" ("NULL" given). {"exception":"[object] (Symfony\\Component\\Serializer\\Exception\\NotNormalizableValueException(code: 0): The type of the \"banner\" attribute for class \"CanIHaveSomeCoffee\\TheTVDbAPI\\Model\\BasicSeries\" must be one of \"string\" (\"NULL\" given). at /var/www/REMOVED/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:299)
[stacktrace]
#0 /var/www/REMOVED/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php(197): Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer->validateAndDenormalize('CanIHaveSomeCof...', 'banner', NULL, NULL, Array)
#1 /var/www/REMOVED/vendor/symfony/serializer/Serializer.php(182): Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer->denormalize(Array, 'CanIHaveSomeCof...', NULL, Array)
#2 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/DataParser.php(64): Symfony\\Component\\Serializer\\Serializer->denormalize(Array, 'CanIHaveSomeCof...')
#3 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/DataParser.php(80): CanIHaveSomeCoffee\\TheTVDbAPI\\DataParser::parseData(Array, 'CanIHaveSomeCof...')
#4 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/Route/SearchRoute.php(90): CanIHaveSomeCoffee\\TheTVDbAPI\\DataParser::parseDataArray(Array, 'CanIHaveSomeCof...')
#5 /var/www/REMOVED/vendor/canihavesomecoffee/thetvdbapi/src/Route/SearchRoute.php(102): CanIHaveSomeCoffee\\TheTVDbAPI\\Route\\SearchRoute->search('name', 'Undercover Boss...')
#6 /var/www/REMOVED/Blacklight/processing/tv/TVDB.php(287): CanIHaveSomeCoffee\\TheTVDbAPI\\Route\\SearchRoute->searchByName('Undercover Boss...')
#7 /var/www/REMOVED/Blacklight/processing/tv/TVDB.php(148): Blacklight\\processing\\tv\\TVDB->getShowInfo('Undercover Boss...', 'US')
#8 /var/www/REMOVED/Blacklight/processing/PostProcess.php(243): Blacklight\\processing\\tv\\TVDB->processSite('', '', '1')
#9 /var/www/REMOVED/misc/update/postprocess.php(125): Blacklight\\processing\\PostProcess->processTv('', '')
#10 {main}
"}

Unauthorized; please provide valid token.

[2021-10-12 00:02:56] NNTmux.ERROR: Unauthorized; please provide valid token. {"exception":"[object] (CanIHaveSomeCoffee\\TheTVDbAPI\\Exception\\UnauthorizedException(code: 0): Unauthorized; please provide valid token. at /var/www/NNTmux/vendor/canihavesomecoffee/thetvdbapi/src/Exception/UnauthorizedException.php:58)
[stacktrace]
#0 /var/www/NNTmux/vendor/canihavesomecoffee/thetvdbapi/src/TheTVDbAPI.php(284): CanIHaveSomeCoffee\\TheTVDbAPI\\Exception\\UnauthorizedException::invalidToken()
#1 /var/www/NNTmux/vendor/canihavesomecoffee/thetvdbapi/src/TheTVDbAPI.php(307): CanIHaveSomeCoffee\\TheTVDbAPI\\TheTVDbAPI->performAPICall()
#2 /var/www/NNTmux/vendor/canihavesomecoffee/thetvdbapi/src/Route/SeriesRoute.php(191): CanIHaveSomeCoffee\\TheTVDbAPI\\TheTVDbAPI->performAPICallWithJsonResponse()
#3 /var/www/NNTmux/Blacklight/processing/tv/TVDB.php(338): CanIHaveSomeCoffee\\TheTVDbAPI\\Route\\SeriesRoute->episodes()
#4 /var/www/NNTmux/Blacklight/processing/tv/TVDB.php(166): Blacklight\\processing\\tv\\TVDB->getEpisodeInfo()
#5 /var/www/NNTmux/Blacklight/processing/PostProcess.php(248): Blacklight\\processing\\tv\\TVDB->processSite()
#6 /var/www/NNTmux/Blacklight/Nfo.php(346): Blacklight\\processing\\PostProcess->processTv()
#7 /var/www/NNTmux/Blacklight/processing/PostProcess.php(217): Blacklight\\Nfo->processNfoFiles()
#8 /var/www/NNTmux/misc/update/postprocess.php(109): Blacklight\\processing\\PostProcess->processNfos()
#9 {main}
"} 

no clue why it's doing this.. i have a valid api4 key in the .env file

Issue with search

I am trying to implement V4 API but i have hit a wall with simple search.
When i do:

$client = new \CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI();

$token = $client->authentication()->login(config('tvdb.api_key'), config('tvdb.user_pin'));

$client->setToken($token);

Auth is fine and token is set.

Next thing is:

$series = $client->search()->search('Arrow');

Issue begins here, as i receive the following error:

Symfony\Component\Serializer\Exception\NotNormalizableValueException

  The type of the key "ara" must be "int" ("string" given).

  at vendor/symfony/serializer/Normalizer/ArrayDenormalizer.php:54
    50|
    51|         $builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null;
    52|         foreach ($data as $key => $value) {
    53|             if (null !== $builtinType && !('is_'.$builtinType)($key)) {
  > 54|                 throw new NotNormalizableValueException(sprintf('The type of the key "%s" must be "%s" ("%s" given).', $key, $builtinType, get_debug_type($key)));
    55|             }
    56|
    57|             $data[$key] = $this->denormalizer->denormalize($value, $type, $format, $context);
    58|         }

Testing on TheTVDB swagger works properly.

New client performs login right away

So I was using Laravels CLI tool "Artisan", and I have a method to fetch episodes from TVDB based on it's show ID.

Now I noticed every time I ran artisan, also for unrelated commands it would perform a call to TVDB, today it errored out so the error was especially noticable:

vagrant@homestead:~/code/projectname$ php artisan

   Exception  : Got status code 504 from service at path /login

  at /home/vagrant/code/projectname/vendor/canihavesomecoffee/thetvdbapi/src/TheTVDbAPI.php:372
    368|             }
    369|             return $json['data'];
    370|         }
    371|
  > 372|         throw new Exception(
    373|             sprintf(
    374|                 'Got status code %d from service at path %s',
    375|                 $response->getStatusCode(),
    376|                 $path

  Exception trace:

  1   CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI::performAPICallWithJsonResponse("post", "/login", ["{"apikey":"API KEY"}"])
      /home/vagrant/code/projectname/vendor/canihavesomecoffee/thetvdbapi/src/Route/AuthenticationRoute.php:73

  2   CanIHaveSomeCoffee\TheTVDbAPI\Route\AuthenticationRoute::login("API KEY")
      /home/vagrant/code/projectname/Blacklight/processing/tv/TVDB.php:60

  Please use the argument -v to see more details.

Now it looks like Artisan loops through all custom command files, and mine had this package loaded:

use CanIHaveSomeCoffee\TheTVDbAPI\Exception\ResourceNotFoundException;
use CanIHaveSomeCoffee\TheTVDbAPI\Exception\UnauthorizedException;
use CanIHaveSomeCoffee\TheTVDbAPI\TheTVDbAPI;

and in the constructor:

$this->client = new TheTVDbAPI();
$this->client->setAcceptedLanguages(['en']);

If this by design?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.