The Movie Database 支持

Hi , I'm gettting this error 5/10 times I make an api call from my app....can someone please guide me...where am i going wrong?? Im stuck on this error...since past 2 days....it works sometimes...and other times it shows the following error.....i have updated node version as well...and my internet connection is pretty stable... this is my code snippet-

try {
    var id = await axios({
      method: "get",
      url: `https://api.themoviedb.org/3/search/movie?api_key=keyc&language=en-US&page=1&include_adult=false&query=${searchTerm}`,
    });
    var id2 = id.data.results[0].id;

    var response = await axios({
      url: `https://api.themoviedb.org/3/movie/${id2}/recommendations?api_key=key&append_to_response=videos&language=en-US&page=1`,
      method: "GET",
    });
    var finalresult = response.data.results;

    const getlink = [];
      for(let i=0;i<finalresult.length;i++){
       const getvideourl =  await axios({
        url: `https://api.themoviedb.org/3/movie/${finalresult[i].id}/videos?api_key=key`,
        method: "GET",
      });
      getlink.push(getvideourl.data.results[0].key);

    }
  } catch (error) {
    console.error(error);
  }

this is the error i receive almost 6 out of 10 times... i make an api call

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) {    
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read',
  config: {
    url: 'https://api.themoviedb.org/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry potter',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.21.1'
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    data: undefined
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'https:',
      path: '/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
      method: 'GET',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'api.themoviedb.org',
      port: null,
      nativeProtocols: [Object],
      pathname: '/3/search/movie',
      search: '?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'GET /3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.21.1\r\n' +
        'Host: api.themoviedb.org\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'api.themoviedb.org',
      protocol: 'https:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    _currentUrl: 'https://api.themoviedb.org/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

3 回复(第 1 页,共 1 页)

Jump to last post

Hey I have been getting the same error. Found any fix?
EDIT: nvm, it is an issue on my network/PC.

How did you solve this Issue

It is the problem from the ISPs. In India, most ISPs have blocked the tmdb ips for some reason, it somehow works sometims but most of the times it will throw you an error. Using a VPN(not Indian IP) will get you out of the error. All you can do now is restart your server again and again until the error is gone(until it appears again) or complaint to your ISP and try to get them unblock the tmdb sites

找不到电影或节目?登录并创建它吧。

全站通用

s 聚焦到搜索栏
p 打开个人资料菜单
esc 关闭打开的窗口
? 打开键盘快捷键窗口

在媒体页面

b 返回(或返回上级)
e 进入编辑页面

在电视季页面

(右箭头)下一季
(左箭头)前一季

在电视集页面

(右箭头)下一集
(左箭头)上一集

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

t 打开翻译选择器
ctrl+ s 提交

在讨论页面

n 创建新讨论
w 切换关注状态
p 设为公开 / 私密讨论
c 关闭 / 开放讨论
a 打开活动页
r 回复讨论
l 跳转至最新回复
ctrl+ enter 发送信息
(右箭头)下一页
(左箭头)前一页

设置

想给这个条目评分或将其添加到片单中?

登录

还不是会员?

注册加入社区