Merge pull request #882 from return42/fix-873

[fix] replace embedded HTML by data_src
This commit is contained in:
Alexandre Flament 2022-02-18 20:55:40 +01:00 committed by GitHub
commit bf2a2ed48f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 135 additions and 132 deletions

View file

@ -4,7 +4,7 @@ Bandcamp (Music)
@website https://bandcamp.com/ @website https://bandcamp.com/
@provide-api no @provide-api no
@results HTML @results HTML
@parse url, title, content, publishedDate, embedded, thumbnail @parse url, title, content, publishedDate, iframe_src, thumbnail
""" """
from urllib.parse import urlencode, urlparse, parse_qs from urllib.parse import urlencode, urlparse, parse_qs
@ -27,10 +27,7 @@ paging = True
base_url = "https://bandcamp.com/" base_url = "https://bandcamp.com/"
search_string = search_string = 'search?{query}&page={page}' search_string = search_string = 'search?{query}&page={page}'
embedded_url = '''<iframe width="100%" height="166" iframe_src = "https://bandcamp.com/EmbeddedPlayer/{type}={result_id}/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/transparent=true/"
scrolling="no" frameborder="no"
data-src="https://bandcamp.com/EmbeddedPlayer/{type}={result_id}/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/transparent=true/"
></iframe>'''
def request(query, params): def request(query, params):
@ -74,8 +71,9 @@ def response(resp):
if thumbnail: if thumbnail:
new_result['thumbnail'] = thumbnail[0] new_result['thumbnail'] = thumbnail[0]
if "album" in result.classes: if "album" in result.classes:
new_result["embedded"] = embedded_url.format(type='album', result_id=result_id) new_result["iframe_src"] = iframe_src.format(type='album', result_id=result_id)
elif "track" in result.classes: elif "track" in result.classes:
new_result["embedded"] = embedded_url.format(type='track', result_id=result_id) new_result["iframe_src"] = iframe_src.format(type='track', result_id=result_id)
results.append(new_result) results.append(new_result)
return results return results

View file

@ -25,11 +25,6 @@ paging = True
# search-url # search-url
# see http://www.dailymotion.com/doc/api/obj-video.html # see http://www.dailymotion.com/doc/api/obj-video.html
search_url = 'https://api.dailymotion.com/videos?fields=created_time,title,description,duration,url,thumbnail_360_url,id&sort=relevance&limit=5&page={pageno}&{query}' # noqa search_url = 'https://api.dailymotion.com/videos?fields=created_time,title,description,duration,url,thumbnail_360_url,id&sort=relevance&limit=5&page={pageno}&{query}' # noqa
embedded_url = (
'<iframe frameborder="0" width="540" height="304" '
+ 'data-src="https://www.dailymotion.com/embed/video/{videoid}" allowfullscreen></iframe>'
)
supported_languages_url = 'https://api.dailymotion.com/languages' supported_languages_url = 'https://api.dailymotion.com/languages'
@ -64,7 +59,6 @@ def response(resp):
content = html_to_text(res['description']) content = html_to_text(res['description'])
thumbnail = res['thumbnail_360_url'] thumbnail = res['thumbnail_360_url']
publishedDate = datetime.fromtimestamp(res['created_time'], None) publishedDate = datetime.fromtimestamp(res['created_time'], None)
embedded = embedded_url.format(videoid=res['id'])
# http to https # http to https
thumbnail = thumbnail.replace("http://", "https://") thumbnail = thumbnail.replace("http://", "https://")
@ -76,7 +70,7 @@ def response(resp):
'title': title, 'title': title,
'content': content, 'content': content,
'publishedDate': publishedDate, 'publishedDate': publishedDate,
'embedded': embedded, 'iframe_src': "https://www.dailymotion.com/embed/video/" + res['id'],
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
) )

View file

@ -23,13 +23,7 @@ paging = True
# search-url # search-url
url = 'https://api.deezer.com/' url = 'https://api.deezer.com/'
search_url = url + 'search?{query}&index={offset}' search_url = url + 'search?{query}&index={offset}'
iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
embedded_url = (
'<iframe scrolling="no" frameborder="0" allowTransparency="true" '
+ 'data-src="https://www.deezer.com/plugins/player?type=tracks&id={audioid}" '
+ 'width="540" height="80"></iframe>'
)
# do search-request # do search-request
def request(query, params): def request(query, params):
@ -57,10 +51,10 @@ def response(resp):
content = '{} - {} - {}'.format(result['artist']['name'], result['album']['title'], result['title']) content = '{} - {} - {}'.format(result['artist']['name'], result['album']['title'], result['title'])
embedded = embedded_url.format(audioid=result['id'])
# append result # append result
results.append({'url': url, 'title': title, 'embedded': embedded, 'content': content}) results.append(
{'url': url, 'title': title, 'iframe_src': iframe_src.format(audioid=result['id']), 'content': content}
)
# return results # return results
return results return results

View file

@ -29,9 +29,6 @@ search_url = (
url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}" url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}"
) )
embedded_url = '<audio controls><source src="{uri}" type="audio/{ftype}"></audio>'
# search request # search request
def request(query, params): def request(query, params):
params["url"] = search_url.format( params["url"] = search_url.format(
@ -52,7 +49,6 @@ def response(resp):
content = result["description"][:128] content = result["description"][:128]
publishedDate = datetime.fromisoformat(result["created"]) publishedDate = datetime.fromisoformat(result["created"])
uri = result["download"] uri = result["download"]
embedded = embedded_url.format(uri=uri, ftype=result["type"])
# append result # append result
results.append( results.append(
@ -60,7 +56,7 @@ def response(resp):
"url": result["url"], "url": result["url"],
"title": title, "title": title,
"publishedDate": publishedDate, "publishedDate": publishedDate,
"embedded": embedded, "audio_src": uri,
"content": content, "content": content,
} }
) )

View file

@ -58,14 +58,6 @@ def response(resp):
results = [] results = []
search_results = resp.json() search_results = resp.json()
embedded_url = (
'<iframe width="540" height="304" '
+ 'data-src="'
+ resp.search_params['base_url']
+ '/embed/{videoid}" '
+ 'frameborder="0" allowfullscreen></iframe>'
)
base_invidious_url = resp.search_params['base_url'] + "/watch?v=" base_invidious_url = resp.search_params['base_url'] + "/watch?v="
for result in search_results: for result in search_results:
@ -76,7 +68,6 @@ def response(resp):
continue continue
url = base_invidious_url + videoid url = base_invidious_url + videoid
embedded = embedded_url.format(videoid=videoid)
thumbs = result.get("videoThumbnails", []) thumbs = result.get("videoThumbnails", [])
thumb = next((th for th in thumbs if th["quality"] == "sddefault"), None) thumb = next((th for th in thumbs if th["quality"] == "sddefault"), None)
if thumb: if thumb:
@ -100,7 +91,7 @@ def response(resp):
"template": "videos.html", "template": "videos.html",
"author": result.get("author"), "author": result.get("author"),
"publishedDate": publishedDate, "publishedDate": publishedDate,
"embedded": embedded, "iframe_src": resp.search_params['base_url'] + '/embed/' + videoid,
"thumbnail": thumbnail, "thumbnail": thumbnail,
} }
) )

View file

@ -24,12 +24,7 @@ paging = True
# search-url # search-url
url = 'https://api.mixcloud.com/' url = 'https://api.mixcloud.com/'
search_url = url + 'search/?{query}&type=cloudcast&limit=10&offset={offset}' search_url = url + 'search/?{query}&type=cloudcast&limit=10&offset={offset}'
iframe_src = "https://www.mixcloud.com/widget/iframe/?feed={url}"
embedded_url = (
'<iframe scrolling="no" frameborder="0" allowTransparency="true" '
+ 'data-src="https://www.mixcloud.com/widget/iframe/?feed={url}" width="300" height="300"></iframe>'
)
# do search-request # do search-request
def request(query, params): def request(query, params):
@ -51,12 +46,17 @@ def response(resp):
title = result['name'] title = result['name']
url = result['url'] url = result['url']
content = result['user']['name'] content = result['user']['name']
embedded = embedded_url.format(url=url)
publishedDate = parser.parse(result['created_time']) publishedDate = parser.parse(result['created_time'])
# append result # append result
results.append( results.append(
{'url': url, 'title': title, 'embedded': embedded, 'publishedDate': publishedDate, 'content': content} {
'url': url,
'title': title,
'iframe_src': iframe_src.format(url=url),
'publishedDate': publishedDate,
'content': content,
}
) )
# return results # return results

View file

@ -51,12 +51,6 @@ def response(resp):
search_res = loads(resp.text) search_res = loads(resp.text)
embedded_url = (
'<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts allow-popups" '
+ 'src="'
+ sanitized_url
+ '{embed_path}" frameborder="0" allowfullscreen></iframe>'
)
# return empty array if there are no results # return empty array if there are no results
if "data" not in search_res: if "data" not in search_res:
return [] return []
@ -72,7 +66,6 @@ def response(resp):
content = "" content = ""
thumbnail = sanitized_url + res["thumbnailPath"] thumbnail = sanitized_url + res["thumbnailPath"]
publishedDate = datetime.strptime(res["publishedAt"], "%Y-%m-%dT%H:%M:%S.%fZ") publishedDate = datetime.strptime(res["publishedAt"], "%Y-%m-%dT%H:%M:%S.%fZ")
embedded = embedded_url.format(embed_path=res["embedPath"])
results.append( results.append(
{ {
@ -81,7 +74,7 @@ def response(resp):
"title": title, "title": title,
"content": content, "content": content,
"publishedDate": publishedDate, "publishedDate": publishedDate,
"embedded": embedded, "iframe_src": sanitized_url + res["embedPath"],
"thumbnail": thumbnail, "thumbnail": thumbnail,
} }
) )

View file

@ -41,9 +41,6 @@ time_range_table = {
} }
embedded_url = '<iframe width="540" height="304" src="{url}" frameborder="0" allowfullscreen></iframe>'
def minute_to_hm(minute): def minute_to_hm(minute):
if isinstance(minute, int): if isinstance(minute, int):
return "%d:%02d" % (divmod(minute, 60)) return "%d:%02d" % (divmod(minute, 60))
@ -88,7 +85,6 @@ def response(resp):
content = result['description'] content = result['description']
thumbnail = result['thumbnailUrl'] thumbnail = result['thumbnailUrl']
publishedDate = parser.parse(result['publishedAt']) publishedDate = parser.parse(result['publishedAt'])
embedded = embedded_url.format(url=result.get('embedUrl'))
author = result.get('account', {}).get('displayName') author = result.get('account', {}).get('displayName')
length = minute_to_hm(result.get('duration')) length = minute_to_hm(result.get('duration'))
url = result['url'] url = result['url']
@ -102,7 +98,7 @@ def response(resp):
'length': length, 'length': length,
'template': 'videos.html', 'template': 'videos.html',
'publishedDate': publishedDate, 'publishedDate': publishedDate,
'embedded': embedded, 'iframe_src': result.get('embedUrl'),
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
) )

View file

@ -37,12 +37,6 @@ search_url = (
'&client_id={client_id}' '&client_id={client_id}'
) # noqa ) # noqa
embedded_url = (
'<iframe width="100%" height="166" '
+ 'scrolling="no" frameborder="no" '
+ 'data-src="https://w.soundcloud.com/player/?url={uri}"></iframe>'
)
cid_re = re.compile(r'client_id:"([^"]*)"', re.I | re.U) cid_re = re.compile(r'client_id:"([^"]*)"', re.I | re.U)
guest_client_id = '' guest_client_id = ''
@ -97,7 +91,6 @@ def response(resp):
content = result['description'] or '' content = result['description'] or ''
publishedDate = parser.parse(result['last_modified']) publishedDate = parser.parse(result['last_modified'])
uri = quote_plus(result['uri']) uri = quote_plus(result['uri'])
embedded = embedded_url.format(uri=uri)
# append result # append result
results.append( results.append(
@ -105,7 +98,7 @@ def response(resp):
'url': result['permalink_url'], 'url': result['permalink_url'],
'title': title, 'title': title,
'publishedDate': publishedDate, 'publishedDate': publishedDate,
'embedded': embedded, 'iframe_src': "https://w.soundcloud.com/player/?url=" + uri,
'content': content, 'content': content,
} }
) )

View file

@ -29,10 +29,6 @@ api_client_secret = None
url = 'https://api.spotify.com/' url = 'https://api.spotify.com/'
search_url = url + 'v1/search?{query}&type=track&offset={offset}' search_url = url + 'v1/search?{query}&type=track&offset={offset}'
embedded_url = '<iframe data-src="https://embed.spotify.com/?uri=spotify:track:{audioid}"\
width="300" height="80" frameborder="0" allowtransparency="true"></iframe>'
# do search-request # do search-request
def request(query, params): def request(query, params):
offset = (params['pageno'] - 1) * 20 offset = (params['pageno'] - 1) * 20
@ -66,10 +62,15 @@ def response(resp):
url = result['external_urls']['spotify'] url = result['external_urls']['spotify']
content = '{} - {} - {}'.format(result['artists'][0]['name'], result['album']['name'], result['name']) content = '{} - {} - {}'.format(result['artists'][0]['name'], result['album']['name'], result['name'])
embedded = embedded_url.format(audioid=result['id'])
# append result # append result
results.append({'url': url, 'title': title, 'embedded': embedded, 'content': content}) results.append(
{
'url': url,
'title': title,
'iframe_src': "https://embed.spotify.com/?uri=spotify:track:" + result['id'],
'content': content,
}
)
# return results # return results
return results return results

View file

@ -25,12 +25,6 @@ paging = True
base_url = 'https://vimeo.com/' base_url = 'https://vimeo.com/'
search_url = base_url + '/search/page:{pageno}?{query}' search_url = base_url + '/search/page:{pageno}?{query}'
embedded_url = (
'<iframe data-src="https://player.vimeo.com/video/{videoid}" '
+ 'width="540" height="304" frameborder="0" '
+ 'webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'
)
# do search-request # do search-request
def request(query, params): def request(query, params):
@ -54,7 +48,6 @@ def response(resp):
title = result['name'] title = result['name']
thumbnail = result['pictures']['sizes'][-1]['link'] thumbnail = result['pictures']['sizes'][-1]['link']
publishedDate = parser.parse(result['created_time']) publishedDate = parser.parse(result['created_time'])
embedded = embedded_url.format(videoid=videoid)
# append result # append result
results.append( results.append(
@ -64,7 +57,7 @@ def response(resp):
'content': '', 'content': '',
'template': 'videos.html', 'template': 'videos.html',
'publishedDate': publishedDate, 'publishedDate': publishedDate,
'embedded': embedded, 'iframe_src': "https://player.vimeo.com/video/" + videoid,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
) )

View file

@ -26,13 +26,6 @@ api_key = None
# search-url # search-url
base_url = 'https://www.googleapis.com/youtube/v3/search' base_url = 'https://www.googleapis.com/youtube/v3/search'
search_url = base_url + '?part=snippet&{query}&maxResults=20&key={api_key}' search_url = base_url + '?part=snippet&{query}&maxResults=20&key={api_key}'
embedded_url = (
'<iframe width="540" height="304" '
+ 'data-src="https://www.youtube-nocookie.com/embed/{videoid}" '
+ 'frameborder="0" allowfullscreen></iframe>'
)
base_youtube_url = 'https://www.youtube.com/watch?v=' base_youtube_url = 'https://www.youtube.com/watch?v='
@ -77,8 +70,6 @@ def response(resp):
url = base_youtube_url + videoid url = base_youtube_url + videoid
embedded = embedded_url.format(videoid=videoid)
# append result # append result
results.append( results.append(
{ {
@ -87,7 +78,7 @@ def response(resp):
'content': content, 'content': content,
'template': 'videos.html', 'template': 'videos.html',
'publishedDate': publishedDate, 'publishedDate': publishedDate,
'embedded': embedded, 'iframe_src': "https://www.youtube-nocookie.com/embed/" + videoid,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
) )

View file

@ -32,12 +32,6 @@ time_range_url = '&sp=EgII{time_range}%253D%253D'
next_page_url = 'https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' next_page_url = 'https://www.youtube.com/youtubei/v1/search?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8'
time_range_dict = {'day': 'Ag', 'week': 'Aw', 'month': 'BA', 'year': 'BQ'} time_range_dict = {'day': 'Ag', 'week': 'Aw', 'month': 'BA', 'year': 'BQ'}
embedded_url = (
'<iframe width="540" height="304" '
+ 'data-src="https://www.youtube-nocookie.com/embed/{videoid}" '
+ 'frameborder="0" allowfullscreen></iframe>'
)
base_youtube_url = 'https://www.youtube.com/watch?v=' base_youtube_url = 'https://www.youtube.com/watch?v='
@ -91,7 +85,7 @@ def parse_next_page_response(response_text):
'author': section['ownerText']['runs'][0]['text'], 'author': section['ownerText']['runs'][0]['text'],
'length': section['lengthText']['simpleText'], 'length': section['lengthText']['simpleText'],
'template': 'videos.html', 'template': 'videos.html',
'embedded': embedded_url.format(videoid=section['videoId']), 'iframe_src': 'https://www.youtube-nocookie.com/embed/' + section['videoId'],
'thumbnail': section['thumbnail']['thumbnails'][-1]['url'], 'thumbnail': section['thumbnail']['thumbnails'][-1]['url'],
} }
) )
@ -150,7 +144,6 @@ def parse_first_page_response(response_text):
thumbnail = 'https://i.ytimg.com/vi/' + videoid + '/hqdefault.jpg' thumbnail = 'https://i.ytimg.com/vi/' + videoid + '/hqdefault.jpg'
title = get_text_from_json(video.get('title', {})) title = get_text_from_json(video.get('title', {}))
content = get_text_from_json(video.get('descriptionSnippet', {})) content = get_text_from_json(video.get('descriptionSnippet', {}))
embedded = embedded_url.format(videoid=videoid)
author = get_text_from_json(video.get('ownerText', {})) author = get_text_from_json(video.get('ownerText', {}))
length = get_text_from_json(video.get('lengthText', {})) length = get_text_from_json(video.get('lengthText', {}))
@ -163,7 +156,7 @@ def parse_first_page_response(response_text):
'author': author, 'author': author,
'length': length, 'length': length,
'template': 'videos.html', 'template': 'videos.html',
'embedded': embedded, 'iframe_src': 'https://www.youtube-nocookie.com/embed/' + videoid,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
} }
) )

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
import re import re
from urllib.parse import urlunparse from urllib.parse import urlunparse, urlparse
from searx import settings from searx import settings
from searx.plugins import logger from searx.plugins import logger
from flask_babel import gettext from flask_babel import gettext
@ -17,16 +17,30 @@ replacements = {re.compile(p): r for (p, r) in settings[plugin_id].items()} if p
logger = logger.getChild(plugin_id) logger = logger.getChild(plugin_id)
parsed = 'parsed_url' parsed = 'parsed_url'
_url_fields = ['iframe_src', 'audio_src']
def on_result(request, search, result): def on_result(request, search, result):
if parsed not in result:
return True
for (pattern, replacement) in replacements.items(): for (pattern, replacement) in replacements.items():
if parsed in result:
if pattern.search(result[parsed].netloc): if pattern.search(result[parsed].netloc):
# to keep or remove this result from the result list depends
# (only) on the 'parsed_url'
if not replacement: if not replacement:
return False return False
result[parsed] = result[parsed]._replace(netloc=pattern.sub(replacement, result[parsed].netloc)) result[parsed] = result[parsed]._replace(netloc=pattern.sub(replacement, result[parsed].netloc))
result['url'] = urlunparse(result[parsed]) result['url'] = urlunparse(result[parsed])
for url_field in _url_fields:
if result.get(url_field):
url_src = urlparse(result[url_field])
if pattern.search(url_src.netloc):
if not replacement:
del result[url_field]
else:
url_src = url_src._replace(netloc=pattern.sub(replacement, url_src.netloc))
result[url_field] = urlunparse(url_src)
return True return True

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
iframe[src^="https://w.soundcloud.com"] {
height: 120px;
}
iframe[src^="https://www.deezer.com"] {
// The real size is 92px, but 94px are needed to avoid an inner scrollbar of
// the embedded HTML.
height: 94px;
}
iframe[src^="https://www.mixcloud.com"] {
// the embedded player from mixcloud has some quirks: initial there is an
// issue with an image URL that is blocked since it is an a Cross-Origin
// request. The alternative text (<img alt='Mixcloud Logo'> then cause an
// scrollbar in the inner of the iframe we can't avoid. Another quirk comes
// when pressing the play button, somtimes the shown player has an height of
// 200px, somtimes 250px.
height: 250px;
}

View file

@ -17,6 +17,7 @@
@import "autocomplete.less"; @import "autocomplete.less";
@import "detail.less"; @import "detail.less";
@import "animations.less"; @import "animations.less";
@import "embedded.less";
// for index.html template // for index.html template
@import "index.less"; @import "index.less";
@ -296,10 +297,34 @@ article[data-vim-selected].category-social {
padding: 0 5px 25px 0 !important; padding: 0 5px 25px 0 !important;
} }
.audio-control audio {
width: 100%;
padding: 10px 0 0 0;
}
.embedded-content iframe {
width: 100%;
padding: 10px 0 0 0;
}
.result-videos .content { .result-videos .content {
overflow: hidden; overflow: hidden;
} }
.result-videos .embedded-video iframe {
width: 100%;
aspect-ratio: 16 / 9;
padding: 10px 0 0 0;
}
@supports not (aspect-ratio: 1 / 1) {
// support older browsers which do not have aspect-ratio
// https://caniuse.com/?search=aspect-ratio
.result-videos .embedded-video iframe {
height: calc(@results-width * 9 / 16);
}
}
.engines { .engines {
.ltr-float-right(); .ltr-float-right();
color: var(--color-result-engines-font); color: var(--color-result-engines-font);

View file

@ -3,13 +3,13 @@
{{- result_header(result, favicons, loop.index) -}} {{- result_header(result, favicons, loop.index) -}}
{{- result_sub_header(result, loop.index) -}} {{- result_sub_header(result, loop.index) -}}
{%- if result.embedded -%} {%- if result.iframe_src -%}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small> <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small>
{%- endif -%} {%- endif -%}
{%- if result.embedded -%} {% if result.iframe_src -%}
<div id="result-media-{{ index }}" class="collapse"> <div id="result-media-{{ index }}" class="embedded-content invisible">
{{- result.embedded|safe -}} <iframe data-src="{{result.iframe_src}}" frameborder="0" scrolling="no" allowfullscreen></iframe>
</div> </div>
{%- endif -%} {%- endif -%}
@ -24,6 +24,13 @@
{%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%} {%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%}
{%- endif -%} {%- endif -%}
{% if result.audio_src -%}
<div id="result-media-{{ index }}" class="audio-control">
<audio controls><source src="{{result.audio_src}}"></audio>
</div>
{%- endif %}
{%- if rtl -%} {%- if rtl -%}
{{ result_footer_rtl(result, loop.index) }} {{ result_footer_rtl(result, loop.index) }}
{%- else -%} {%- else -%}

View file

@ -3,15 +3,15 @@
{{- result_header(result, favicons, loop.index) -}} {{- result_header(result, favicons, loop.index) -}}
{{- result_sub_header(result, loop.index) -}} {{- result_sub_header(result, loop.index) -}}
{%- if result.embedded -%} {%- if result.iframe_src -%}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}" aria-labelledby="result-{{loop.index}}">{{ icon('film') }} {{ _('show video') }}</a></small> <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}" aria-labelledby="result-{{loop.index}}">{{ icon('film') }} {{ _('show video') }}</a></small>
{%- endif -%} {%- endif -%}
{%- if result.embedded -%} {% if result.iframe_src -%}
<div id="result-video-{{ index }}" class="collapse"> <div id="result-video-{{ index }}" class="embedded-video collapse">
{{- result.embedded|safe -}} <iframe data-src="{{result.iframe_src}}" width="540" height="304" frameborder="0" scrolling="no" allowfullscreen></iframe>
</div> </div>
{%- endif -%} {%- endif %}
<div class="container-fluid">{{- "" -}} <div class="container-fluid">{{- "" -}}
<div class="row">{{- "" -}} <div class="row">{{- "" -}}

View file

@ -2,7 +2,7 @@
{{ result_header(result, favicons, image_proxify) -}} {{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}} {{- result_sub_header(result) -}}
{% if result.embedded -%} {% if result.iframe_src -%}
<p class="altlink"> &bull; <a class="btn-collapse collapsed media-loader disabled_if_nojs" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music-note') }} {{ _('show media') }}</a></p> <p class="altlink"> &bull; <a class="btn-collapse collapsed media-loader disabled_if_nojs" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music-note') }} {{ _('show media') }}</a></p>
{%- endif %} {%- endif %}
{%- if result.content %} {%- if result.content %}
@ -15,9 +15,14 @@
</p> </p>
{% endif -%} {% endif -%}
{{- result_sub_footer(result, proxify) -}} {{- result_sub_footer(result, proxify) -}}
{% if result.embedded -%} {% if result.iframe_src -%}
<div id="result-media-{{ index }}" class="invisible"> <div id="result-media-{{ index }}" class="embedded-content invisible">
{{- result.embedded|safe -}} <iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
</div>
{%- endif %}
{% if result.audio_src -%}
<div id="result-media-{{ index }}" class="audio-control">
<audio controls><source src="{{result.audio_src}}"></audio>
</div> </div>
{%- endif %} {%- endif %}
{{- result_footer(result) }} {{- result_footer(result) }}

View file

@ -2,7 +2,7 @@
{{ result_header(result, favicons, image_proxify) }} {{ result_header(result, favicons, image_proxify) }}
{{ result_sub_header(result) }} {{ result_sub_header(result) }}
{% if result.embedded -%} {% if result.iframe_src -%}
<p class="altlink"> &bull; <a class="btn-collapse collapsed media-loader disabled_if_nojs" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film-outline') }} {{ _('show video') }}</a></p> <p class="altlink"> &bull; <a class="btn-collapse collapsed media-loader disabled_if_nojs" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film-outline') }} {{ _('show video') }}</a></p>
{%- endif %} {%- endif %}
{%- if result.content %} {%- if result.content %}
@ -16,9 +16,9 @@
{% endif -%} {% endif -%}
</p> </p>
{{- result_sub_footer(result, proxify) -}} {{- result_sub_footer(result, proxify) -}}
{% if result.embedded -%} {% if result.iframe_src -%}
<div id="result-video-{{ index }}" class="invisible"> <div id="result-video-{{ index }}" class="embedded-video invisible">
{{- result.embedded|safe -}} <iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
</div> </div>
{%- endif %} {%- endif %}
{{ result_footer(result) }} {{ result_footer(result) }}