edwellbrook / node-tvdb

Node.js library for accessing TheTVDB API

Home Page:https://edwellbrook.github.io/node-tvdb/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`getSeriesByName` fails if the name needs to be URL-encoded

axelstudios opened this issue · comments

Some series' names, at least ones with an ampersand, need to be url encoded. It probably makes more sense to change this on the library side:

Not working: tvdb.getSeriesByName('Eastbound & Down')
Working: tvdb.getSeriesByName(encodeURIComponent('Eastbound & Down'))

Error message

{ Error: Requires only one of name, imdbId, zap2itId params
    at res.json.then (C:\Commands\node_modules\node-tvdb\index.js:451:23)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  response:
   Body {
     url: 'https://api.thetvdb.com/search/series?name=Eastbound & Down',
     status: 405,
     statusText: 'Method Not Allowed',
     headers: Headers { _headers: [Object] },
     ok: false,
     body:
      PassThrough {
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: true,
        _transformState: [Object] },
     bodyUsed: true,
     size: 0,
     timeout: 0,
     _raw: [ <Buffer 7b 0a 20 20 22 45 72 72 6f 72 22 3a 20 22 52 65 71 75 69 72 65 73 20 6f 6e 6c 79 20 6f 6e 65 20 6f 66 20 6e 61 6d 65 2c 20 69 6d 64 62 49 64 2c 20 7a ... > ],
     _abort: false,
     _bytes: 67 } }

Thanks for the heads up! Just fixed and updated on npm (v3.1.2). Cheers!