python - 使用 Youtube Data API V3 获取直播健康状态
问题描述
我可以通过我的 GSuite 邮件 ID xxxx@xxxx.com 访问 Youtube 频道。我正在使用 Youtube Data API V3 列出链接到该频道的直播流。(https://developers.google.com/youtube/v3/live/docs/liveStreams)但是,当我尝试使用它时,我收到以下消息:“使用 Google 登录暂时禁用此应用程序此应用程序有尚未经过 Google 验证才能使用 Google 登录。”
你能告诉我如何解决这个问题吗?
SCOPES = ['https://www.googleapis.com/auth/youtube.readonly']
API_SERVICE_NAME = 'youtube'
API_VERSION = 'v3'
def get_authenticated_service():
try:
flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, scope=SCOPES, message="")
storage = Storage(CLIENT_AUTH_FILE)
credentials = storage.get()
if credentials is None or credentials.invalid:
credentials = run_flow(flow, storage, args)
return build(API_SERVICE_NAME, API_VERSION, http=credentials.authorize(httplib2.Http()))
except Exception as e:
logger.info("ERROR: Exception from get_authenticated_service. " + str(e))
# Retrieve a list of the liveStream resources associated with the currently
# authenticated user's channel.
def list_streams(youtube):
list_streams_request = youtube.liveStreams().list(
# part='id,snippet,status',
part='snippet,status',
mine=True,
maxResults=50
)
if list_streams_request:
list_streams_response = list_streams_request.execute()
if __name__ == '__main__':
youtube = get_authenticated_service()
list_streams(youtube)
解决方案
推荐阅读
- python-3.x - 实例化 Python 对象的方式之间有什么区别?
- postgresql - AWS Glue Relationalize json 数据中的数组到 postgres DB 中的新表
- bash - 重击。使用 cat 在读取多行直到 EOF 时不包括第一行
- python - 熊猫点安装
- ethereum - etherscan-api 不输出挂起的交易
- c - 从C中的字符串解析日期和时间
- angular - Angular8:如何在使用 moment.min.js 时防止 Angular 中的包重复并解决全日历错误?
- python-3.x - 多维数组上的python索引问题
- python-2.7 - 不同孩子的多重继承
- php - SQLSTATE[HY000] [2002] 没有这样的文件或目录 (SQL: select * from `jobs`)