tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit 3a4b228af260ef80ed25cfa8fb238586b6dad493
parent 058ec98653c9e3ec1cc560e9365e606c6557b9c0
Author: rbckman <rob@tarina.org>
Date:   Mon,  9 Mar 2020 18:27:45 +0000

use url shortener for youtube uploader api

Diffstat:
Minstall.sh | 3+++
Mmods/youtube-upload/youtube_upload/auth/console.py | 13+++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/install.sh b/install.sh @@ -227,6 +227,9 @@ cp extras/.vimrc /root/.vimrc cp extras/.vimrc /home/pi/.vimrc echo "Installing youtube upload mod..." +sudo pip3 install pyshorteners +sudo pip3 install google-api-python-client==1.7.3 oauth2client==4.1.2 progressbar2==3.38.0 httplib2==0.15.0 + cd mods ./install-youtube-upload.sh cd .. diff --git a/mods/youtube-upload/youtube_upload/auth/console.py b/mods/youtube-upload/youtube_upload/auth/console.py @@ -1,13 +1,19 @@ import sys +import pyshorteners + +def shorten_url(url): + s = pyshorteners.Shortener() + short_url = s.tinyurl.short(url) + return short_url def get_code(authorize_url): - + short_url = shorten_url(authorize_url) """Show authorization URL and return the code the user wrote.""" - message = "Check this link in your browser: {0}".format(authorize_url) + message = "Check this link in your browser: " + short_url sys.stderr.write(message + "\n") try: input = raw_input #For Python2 compatability except NameError: #For Python3 on Windows compatability try: from builtins import input as input except ImportError: pass - return input("Enter verification code: ")- \ No newline at end of file + return input("Enter verification code: ")