@ -21,14 +21,15 @@ about = {
# engine dependent config
categories = [ " videos " ]
paging = True
base_url = " https://peer.tube / "
supported_languages_url = base_url + " api/v1/videos/languages"
base_url = " https://peer.tube "
supported_languages_url = base_url + " / api/v1/videos/languages"
# do search-request
def request ( query , params ) :
sanitized_url = base_url . rstrip ( " / " )
pageno = ( params [ " pageno " ] - 1 ) * 15
search_url = base_url + " api/v1/search/videos/?pageno={pageno} & {query} "
search_url = sanitized_url + " / api/v1/search/videos/?pageno={pageno} & {query} "
query_dict = { " search " : query }
language = params [ " language " ] . split ( " - " ) [ 0 ]
# pylint: disable=undefined-variable
@ -46,6 +47,7 @@ def _get_offset_from_pageno(pageno):
# get response from search-request
def response ( resp ) :
sanitized_url = base_url . rstrip ( " / " )
results = [ ]
search_res = loads ( resp . text )
@ -53,7 +55,7 @@ def response(resp):
embedded_url = (
' <iframe width= " 560 " height= " 315 " sandbox= " allow-same-origin allow-scripts allow-popups " '
+ ' src= " '
+ base _url
+ sanitized _url
+ ' {embed_path} " frameborder= " 0 " allowfullscreen></iframe> '
)
# return empty array if there are no results
@ -63,15 +65,15 @@ def response(resp):
# parse results
for res in search_res [ " data " ] :
title = res [ " name " ]
url = base _url + " /videos/watch/ " + res [ " uuid " ]
url = sanitized _url + " /videos/watch/ " + res [ " uuid " ]
description = res [ " description " ]
if description :
content = html_to_text ( res [ " description " ] )
else :
content = None
thumbnail = base _url + res [ " thumbnailPath " ]
content = " "
thumbnail = sanitized _url + res [ " thumbnailPath " ]
publishedDate = datetime . strptime ( res [ " publishedAt " ] , " % Y- % m- %d T % H: % M: % S. %f Z " )
embedded = embedded_url . format ( embed_path = res [ " embedPath " ] [1 : ] )
embedded = embedded_url . format ( embed_path = res [ " embedPath " ] )
results . append (
{