From be3a4240d0eb5b8d40633459b669d4ae4e14a4c3 Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Mon, 28 Jun 2021 14:29:11 -0400 Subject: [PATCH] Outline for basic YouTube API wrapper --- youtube_api.py | 10 ++++++++++ yt-unlist-saver.py | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 youtube_api.py diff --git a/youtube_api.py b/youtube_api.py new file mode 100644 index 0000000..1fd1763 --- /dev/null +++ b/youtube_api.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +# Python wrapper for REST API for some of the YouTube API. +from requests import get, post +import json + +class YouTubeAPI(object): + def __init__(self, key): + self.url = 'https://www.googleapis.com/youtube/v3/' + self.key = key diff --git a/yt-unlist-saver.py b/yt-unlist-saver.py index ea3d1ae..d45d284 100644 --- a/yt-unlist-saver.py +++ b/yt-unlist-saver.py @@ -1,6 +1,10 @@ +#!/usr/bin/env python3 + +from youtube_api import YouTubeAPI + # Read YouTube API Key def getYouTubeAPIKey(): return open('youtube.key', 'r').read() +api = YouTubeAPI(getYouTubeAPIKey()) print(getYouTubeAPIKey()) -exit(0)