Youtube Data Api v3 Node.js请求模块错误:错误:0906D06C

时间:2018-06-24 12:05:18

标签: node.js youtube-data-api

我正在尝试使用请求模块通过Node.js使用YouTube数据api v3的api密钥对http get请求进行请求,但是出现错误。这是我的下面的代码

const express = require('express');
const app = express();
const request = require('request');

const apiKey = 'API-KEY-HERE';

const options = {
    url: 'https://www.googleapis.com/youtube/v3/playlistItems',
    method: 'GET',
    part: 'snippet',
    key: apiKey,
    maxResults: 20,
    playlistId: 'PL2fnLUTsNyq7A335zB_RpOzu7hEUcSJbB'
};
const playlistCB = (err,response,body)=>{
   console.log(err);
}
request(options,playlistCB);

const port = process.env.PORT || 3000;

app.listen(port);

运行此代码时出现的错误是这个。

Error: error:0906D06C:PEM routines:PEM_read_bio:no start line    at Object.createSecureContext (_tls_common.js:104:17)
    at Object.exports.connect (_tls_wrap.js:1049:48)
    at Agent.createConnection (https.js:111:22)
    at Agent.createSocket (_http_agent.js:227:26)
    at Agent.addRequest (_http_agent.js:185:10)
    at new ClientRequest (_http_client.js:258:16)
    at Object.request (http.js:38:10)
    at Object.request (https.js:239:15)

0 个答案:

没有答案