"在代码下面,我尝试使用其视频ID获取你的视频评论,添加了API密钥,但是给出了systemexit ..... 下面是代码"
<ion-menu [content]="mycontent">
<ion-content>
<button ion-button (click)="show_message()">
</buttont>
</ion-content>
&#34; client_scret.json文件获取api密钥的详细信息&#34;
import simplejson as json
from googleapiclient.discovery import build_from_document
from googleapiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
import sys
import os
&#34;收到错误&#34;
YOUTUBE_READ_WRITE_SSL_SCOPE = "https://www.googleapis.com/auth/youtube.force-ssl"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
CLIENT_SECRETS_FILE = "client_secrets.json"
def get_authenticated_service(args):
flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, scope=YOUTUBE_READ_WRITE_SSL_SCOPE)
argparser.add_argument("EKyirtVHsK0",
help="Required; ID for video for which the comment will be inserted.")
# youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,developerKey=DEVELOPER_KEY)
args = argparser.parse_args()
youtube = get_authenticated_service(args)
results = youtube.commentThreads().list(part = "snippet",
maxResults=5,
videoId=video_id,
textFormat="plainText"
).execute
for item in results(["items"]):
comment = item["snippet"]["topLevelComment"]
# text= item["snippet"]["snippet"]["textDisplay"]
author = item["snippet"]["snippet"]["authorDisplayName"]
# text = item["snippet"]["textDisplay"]
# print("Comment by %s: %s" % (author, text))
print(comment)