fix security concat

This commit is contained in:
Jesús 2019-07-07 18:47:47 -05:00
parent 24f6e40491
commit 3a4f47ad89
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -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}')