From f0dbb580b2fc0ea8cd1a50745bf27e8726d6248c Mon Sep 17 00:00:00 2001 From: Christian Colglazier Date: Mon, 28 Jun 2021 16:13:04 -0400 Subject: [PATCH] Video information print out --- youtube_api.py | 3 ++- yt-unlist-saver.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/youtube_api.py b/youtube_api.py index 5f0792c..e90ec2c 100644 --- a/youtube_api.py +++ b/youtube_api.py @@ -27,9 +27,10 @@ class YouTubeAPI(object): title = snippet['title'] date = snippet['publishedAt'] channel = snippet['channelTitle'] + channelId = snippet['channelId'] description = snippet['description'] tags = snippet['tags'] privacy = status['privacyStatus'] - return title, date, channel, description, tags, privacy + return title, date, channel, channelId, description, tags, privacy diff --git a/yt-unlist-saver.py b/yt-unlist-saver.py index 4d2fc7f..a49c3f9 100644 --- a/yt-unlist-saver.py +++ b/yt-unlist-saver.py @@ -8,4 +8,10 @@ def getYouTubeAPIKey(): return open('youtube.key', 'r').read() api = YouTubeAPI(getYouTubeAPIKey()) -print(api.getVideoInfo(sys.argv[1])) +title, date, channel, channelId, description, tags, privacy = api.getVideoInfo(sys.argv[1]) +print('Title: ' + title) +print('Date: ' + date) +print('Channel: {} ({})'.format(channel, channelId) ) +print('Description: ' + description) +print('Tags: ', tags) +print('Privacy: ' + privacy)