roccomuso / imdb-cli

Node.js IMDB Command line interface to retrieve movie info.
6 stars 3 forks source link

error when using it "no API key" #3

Open sg-s opened 7 years ago

sg-s commented 7 years ago
Searching for: Chungking Express
{ StatusCodeError: 401 - {"Response":"False","Error":"No API key provided."}
    at new StatusCodeError (/usr/local/lib/node_modules/imdb-cli/node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (/usr/local/lib/node_modules/imdb-cli/node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/imdb-cli/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (/usr/local/lib/node_modules/imdb-cli/node_modules/request/request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/imdb-cli/node_modules/request/request.js:1171:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/imdb-cli/node_modules/request/request.js:1091:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  name: 'StatusCodeError',
  statusCode: 401,
  message: '401 - {"Response":"False","Error":"No API key provided."}',
  error: { Response: 'False', Error: 'No API key provided.' },
  options: 
   { qs: { plot: 'full', r: 'json', y: undefined, t: 'Chungking Express' },
     url: 'https://www.omdbapi.com/',
     json: true,
     callback: [Function: RP$callback],
     transform: undefined,
     simple: true,
     resolveWithFullResponse: false,
     transform2xxOnly: false },
  response: 
   IncomingMessage {
     _readableState: 
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     domain: null,
     _events: 
      { end: [Array],
        close: [Array],
        data: [Function],
        error: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     socket: 
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: false,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'www.omdbapi.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 125,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 11,
        [Symbol(bytesRead)]: 640 },
     connection: 
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: false,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'www.omdbapi.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 125,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 11,
        [Symbol(bytesRead)]: 640 },
     httpVersionMajor: 1,
     httpVersionMinor: 1,
     httpVersion: '1.1',
     complete: true,
     headers: 
      { date: 'Fri, 25 Aug 2017 01:15:56 GMT',
        'content-type': 'application/json; charset=utf-8',
        'content-length': '51',
        connection: 'close',
        'set-cookie': [Array],
        'cache-control': 'public, max-age=3600',
        expires: 'Fri, 25 Aug 2017 02:15:56 GMT',
        'last-modified': 'Fri, 25 Aug 2017 01:15:56 GMT',
        vary: '*',
        'x-aspnet-version': '4.0.30319',
        'x-powered-by': 'ASP.NET',
        'access-control-allow-origin': '*',
        'cf-cache-status': 'MISS',
        server: 'cloudflare-nginx',
        'cf-ray': '393ab3fbcc3e187c-EWR' },
     rawHeaders: 
      [ 'Date',
        'Fri, 25 Aug 2017 01:15:56 GMT',
        'Content-Type',
        'application/json; charset=utf-8',
        'Content-Length',
        '51',
        'Connection',
        'close',
        'Set-Cookie',
        '__cfduid=d9855b855535952f882db8492b24bca1e1503623756; expires=Sat, 25-Aug-18 01:15:56 GMT; path=/; domain=.omdbapi.com; HttpOnly',
        'Cache-Control',
        'public, max-age=3600',
        'Expires',
        'Fri, 25 Aug 2017 02:15:56 GMT',
        'Last-Modified',
        'Fri, 25 Aug 2017 01:15:56 GMT',
        'Vary',
        '*',
        'X-AspNet-Version',
        '4.0.30319',
        'X-Powered-By',
        'ASP.NET',
        'Access-Control-Allow-Origin',
        '*',
        'CF-Cache-Status',
        'MISS',
        'Server',
        'cloudflare-nginx',
        'CF-RAY',
        '393ab3fbcc3e187c-EWR' ],
     trailers: {},
     rawTrailers: [],
     upgrade: false,
     url: '',
     method: null,
     statusCode: 401,
     statusMessage: 'Unauthorized',
     client: 
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: false,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'www.omdbapi.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 125,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 11,
        [Symbol(bytesRead)]: 640 },
     _consuming: true,
     _dumped: false,
     req: 
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: false,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET /?plot=full&r=json&t=Chungking%20Express HTTP/1.1\r\nhost: www.omdbapi.com\r\naccept: application/json\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/?plot=full&r=json&t=Chungking%20Express',
        _ended: true,
        res: [Circular],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     request: 
      Request {
        domain: null,
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        readable: true,
        writable: true,
        _qs: [Object],
        _auth: [Object],
        _oauth: [Object],
        _multipart: [Object],
        _redirect: [Object],
        _tunnel: [Object],
        _rp_resolve: [Function],
        _rp_reject: [Function],
        _rp_promise: [Object],
        _rp_callbackOrig: undefined,
        callback: [Function],
        _rp_options: [Object],
        headers: [Object],
        setHeader: [Function],
        hasHeader: [Function],
        getHeader: [Function],
        removeHeader: [Function],
        method: 'GET',
        localAddress: undefined,
        pool: {},
        dests: [],
        __isRequestRequest: true,
        _callback: [Function: RP$callback],
        uri: [Object],
        proxy: null,
        tunnel: true,
        setHost: true,
        originalCookieHeader: undefined,
        _disableCookies: true,
        _jar: undefined,
        port: 443,
        host: 'www.omdbapi.com',
        url: [Object],
        path: '/?plot=full&r=json&t=Chungking%20Express',
        _json: true,
        httpModule: [Object],
        agentClass: [Object],
        agent: [Object],
        _started: true,
        href: 'https://www.omdbapi.com/?plot=full&r=json&t=Chungking%20Express',
        req: [Object],
        ntick: true,
        response: [Circular],
        originalHost: 'www.omdbapi.com',
        originalHostHeaderName: 'host',
        responseContent: [Circular],
        _destdata: true,
        _ended: true,
        _callbackCalled: true },
     toJSON: [Function: responseToJSON],
     caseless: Caseless { dict: [Object] },
     read: [Function],
     body: { Response: 'False', Error: 'No API key provided.' } } }
roccomuso commented 7 years ago

I never had that error. We're currently using unofficial imdb API, imdb-api. So there are no guarantees.

sg-s commented 7 years ago

perhaps this is the problem?

https://github.com/worr/node-imdb-api#i-see-an-api-key-in-your-examples-is-it-required-how-do-i-get-one

roccomuso commented 7 years ago

@sg-s yeah. It turns out that the Omdb API now requires a Key. And if you wanna get a key you have to pay for it. I'd leave the issue open until the API hopefully become free again.

xxczaki commented 6 years ago

@sg-s It will be fixed as soon as @roccomuso will merge #4 :heart:

gmansi commented 6 years ago

@sg-s yeah. It turns out that the Omdb API now requires a Key. And if you wanna get a key you have to pay for it. I'd leave the issue open until the API hopefully become free again.

Thanks !! I was trying the same to learn and the same error. Also, If I go to the web page I get "Error: Daily request limit reached!"