Skip to content

Instantly share code, notes, and snippets.

@eggman
Last active April 9, 2020 21:07
Show Gist options
  • Save eggman/b5feb8af46f1558146f0a50297b1c47e to your computer and use it in GitHub Desktop.
Save eggman/b5feb8af46f1558146f0a50297b1c47e to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import os
import googleapiclient.discovery
import googleapiclient.errors
import json
import pprint
scopes = ["https://www.googleapis.com/auth/youtube.readonly"]
def main():
api_service_name = "youtube"
api_version = "v3"
json_open = open('config.json', 'r')
json_load = json.load(json_open)
api_key = json_load['api_key']
ch = json_load['channel']
youtube = googleapiclient.discovery.build(
api_service_name, api_version, developerKey=api_key)
request = youtube.playlists().list(
part="snippet,contentDetails",
channelId=ch,
maxResults=25
)
response = request.execute()
pprint.pprint(response)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment