aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-07-07 18:47:47 -0500
committerJesús <heckyel@hyperbola.info>2019-07-07 18:47:47 -0500
commit3a4f47ad8954610f052110fff0e71cf6609eb1e7 (patch)
treebdf91d93de185766d4e44a199d2bedade9f200d0
parent24f6e4049193d6422b4a505b449540e8fe140203 (diff)
downloadlivie-3a4f47ad8954610f052110fff0e71cf6609eb1e7.tar.lz
livie-3a4f47ad8954610f052110fff0e71cf6609eb1e7.tar.xz
livie-3a4f47ad8954610f052110fff0e71cf6609eb1e7.zip
fix security concat
-rw-r--r--livie.py24
1 files 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}')