如何通过 YouTube API 检索我自己的私人播放列表? [英] How to retrieve my own private playlist through YouTube API?

查看:39
本文介绍了如何通过 YouTube API 检索我自己的私人播放列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种方法来从 YouTube 检索我自己的私人播放列表,以便在我自己的个人网站上显示.到目前为止,所有文档似乎都说,检索私人用户数据(如私人播放列表)需要您网站的用户通过身份验证过程,以便提供他们自己的身份验证.

I'm trying to find a way to retrieve my own private playlists from YouTube, for display on my own personal website. So far, all the documentation appears to say that retrieving private user data (like private playlists) requires that your site's users go through an authentication process in order to provide their own authentication.

就我而言,我不想让我的用户进行身份验证,我希望我的站点我自己的帐户进行身份验证每次访问 Youtube Data API 时,以检索我自己的私人播放列表.

In my case, I don't wan't my users to authenticate, I want my site to authenticate to my own account every time it accesses the Youtube Data API, in order to retrieve my own private playlists.

这可能吗?我认为如果我可以为自己的帐户保存身份验证令牌可能是可行的,但显然令牌 变化?我应该通过什么方法为自己的帐户获取初始授权令牌?

Is that possible? I thought it might be doable if I could just save the authentication token for my own account, but apparently the token changes? And what's the most appropriate method by which I should obtain the initial authorization token for my own account?

推荐答案

您可以通过 OAuth 2 for Installed Applications 流程一次,并生成并保存刷新令牌.然后,您的服务器端代码可以在需要代表您进行 API 调用时使用刷新令牌来获取有效的访问令牌.如果您正确编码,这可能对您网站的访问者完全隐藏.

You can go through the OAuth 2 for Installed Applications flow once, and generate and save a refresh token. Your server-side code can then use the refresh token to get a valid access token whenever it needs to make an API call on your behalf. This could be completely hidden from the visitors of your website if you code it correctly.

这篇关于如何通过 YouTube API 检索我自己的私人播放列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆