Youtube api 使用python将youtube频道列为后端进程,无需提示输入用户名和密码
我想运行一个后端进程,在不提示输入用户名密码的情况下从youtube获取频道列表Youtube api 使用python将youtube频道列为后端进程,无需提示输入用户名和密码,youtube-api,Youtube Api,我想运行一个后端进程,在不提示输入用户名密码的情况下从youtube获取频道列表 #!/usr/bin/python from apiclient.discovery import build from optparse import OptionParser DEVELOPER_KEY = "MY API KEY" YOUTUBE_API_SERVICE_NAME = "youtube" YOUTUBE_API_VERSION = "v3" youtube = build(YOUTUBE
#!/usr/bin/python
from apiclient.discovery import build
from optparse import OptionParser
DEVELOPER_KEY = "MY API KEY"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION,developerKey=DEVELOPER_KEY)
channels_response = youtube.channels().list(
part="contentDetails",
managedByMe="true",
onBehalfOfContentOwner=ownerdetail
).execute()
for channel in channels_response["items"]:
channel_id = channel["id"]
channel_title = channel["snippet"]["title"]
print "Channel details: %s - %s" % channel_id % channel_title
print "Done"
当我尝试运行此代码时,控制台中出现“未配置访问权限”>错误
我的要求是在不提示输入用户名和密码的情况下成功运行此程序(因为我希望它作为后端进程)。任何帮助都是,这将非常有用,因为我是新手。您可以通过从youtube对象获取刷新令牌并将其设置在youtube对象中来实现