diff options
author | jwanek <eddie.atten.ea29@gmail.com> | 2020-03-30 20:18:25 +0100 |
---|---|---|
committer | jwanek <eddie.atten.ea29@gmail.com> | 2020-03-30 20:18:25 +0100 |
commit | b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f (patch) | |
tree | 1e900d65d4ea462b89ae9b4469b7bbe15df70220 /ytapi.py | |
parent | a6053befbb0b2d61e3aa53058e1f27832b0753b6 (diff) | |
parent | 4a9f566d2d45c7634a4b4ee4ccde7a1a4afe528b (diff) | |
download | SmallYTChannelBot-b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f.tar.gz SmallYTChannelBot-b6976fd5bc7d74e3dff8b888a812ecfc4edc3e1f.zip |
Started major refactoring, see README.md
Diffstat (limited to 'ytapi.py')
-rwxr-xr-x[-rw-r--r--] | ytapi.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,7 +1,11 @@ from googleapiclient.discovery import build from googleapiclient.errors import HttpError +import json import js2py +with open("config.json", "r") as f: + CONFIG = json.load(f) + ERROR_DICT = { "title": "ERROR Video deleted?", "description": "ERROR Video deleted?", @@ -22,7 +26,7 @@ ERROR_DICT = { # tab of # https://cloud.google.com/console # Please ensure that you have enabled the YouTube Data API for your project. -DEVELOPER_KEY = 'AIzaSyBQsuU5GgCTZdFi7cBmPQHWZwIa545zLUE' +DEVELOPER_KEY = CONFIG["youtubeapi"]["developer_key"] YOUTUBE_API_SERVICE_NAME = 'youtube' YOUTUBE_API_VERSION = 'v3' @@ -92,6 +96,6 @@ def get_video_data(videoId): if __name__ == '__main__': try: - print(get_channel_data("https://www.youtube.com/watch?v=XPpAkggrdaU&feature=youtu.be")) + print(get_video_data(get_videoId_from_url("https://www.youtube.com/watch?v=ZYqG31V4qtA"))) except HttpError as e: print('An HTTP error %d occurred:\n%s' % (e.resp.status, e.content))
\ No newline at end of file |