From 3a4f47ad8954610f052110fff0e71cf6609eb1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 7 Jul 2019 18:47:47 -0500 Subject: fix security concat --- livie.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/livie.py b/livie.py index dd31bc5..6327aaf 100644 --- a/livie.py +++ b/livie.py @@ -6,21 +6,21 @@ import json import requests BASE_URL = 'https://invidious.snopyta.org' - -URL = BASE_URL + '/api/v1/search?q=' + sys.argv[1] - +ITAG = '&itag=18&local=true' +URL = "{}/api/v1/search?q={}".format(BASE_URL, sys.argv[1]) RUTA = requests.get(URL) -VIDEOS = json.loads(RUTA.content) - FIRST = True # skip line +VIDEOS = json.loads(RUTA.content) + for video in VIDEOS: title = video.get('title', '') videoid = video.get('videoId', '') author = video.get('author', '') - link = BASE_URL + '/latest_version?id=' + videoid + '&itag=18&local=true' - time = str(datetime.timedelta(seconds=video.get('lengthSeconds', ''))) + link = "{}/latest_version?id={}{}".format(BASE_URL, videoid, ITAG) + timer = video.get('lengthSeconds', '') + time = str(datetime.timedelta(seconds=timer)) publish = video.get('publishedText', '') if FIRST: @@ -29,8 +29,8 @@ for video in VIDEOS: print() # print skip line # prints - print(f' title: {title}') - print(f' url: {link}') - print(f' channel: {author}') - print(f' time: {time}') - print(f' publish: {publish}') + print(f' title: {title}') + print(f' url: {link}') + print(f' channel: {author}') + print(f' time: {time}') + print(f' publish: {publish}') -- cgit v1.2.3