mirror of https://github.com/searxng/searxng.git
[mod] templates: rename field for <iframe> URL to iframe_src
Rename result field data_src to iframe_src Suggested-by: @dalf https://github.com/searxng/searxng/pull/882#issuecomment-1037997402 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
f5e8cfade2
commit
7352c6bc79
|
@ -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, data_src, 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,7 +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}'
|
||||||
data_src = "https://bandcamp.com/EmbeddedPlayer/{type}={result_id}/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/transparent=true/"
|
iframe_src = "https://bandcamp.com/EmbeddedPlayer/{type}={result_id}/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/transparent=true/"
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -71,9 +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["data_src"] = data_src.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["data_src"] = data_src.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
|
||||||
|
|
|
@ -70,7 +70,7 @@ def response(resp):
|
||||||
'title': title,
|
'title': title,
|
||||||
'content': content,
|
'content': content,
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'data_src': "https://www.dailymotion.com/embed/video/" + res['id'],
|
'iframe_src': "https://www.dailymotion.com/embed/video/" + res['id'],
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +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}'
|
||||||
data_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
|
iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -53,7 +53,7 @@ def response(resp):
|
||||||
|
|
||||||
# append result
|
# append result
|
||||||
results.append(
|
results.append(
|
||||||
{'url': url, 'title': title, 'data_src': data_src.format(audioid=result['id']), 'content': content}
|
{'url': url, 'title': title, 'iframe_src': iframe_src.format(audioid=result['id']), 'content': content}
|
||||||
)
|
)
|
||||||
|
|
||||||
# return results
|
# return results
|
||||||
|
|
|
@ -91,7 +91,7 @@ def response(resp):
|
||||||
"template": "videos.html",
|
"template": "videos.html",
|
||||||
"author": result.get("author"),
|
"author": result.get("author"),
|
||||||
"publishedDate": publishedDate,
|
"publishedDate": publishedDate,
|
||||||
"data_src": resp.search_params['base_url'] + '/embed/' + videoid,
|
"iframe_src": resp.search_params['base_url'] + '/embed/' + videoid,
|
||||||
"thumbnail": thumbnail,
|
"thumbnail": thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,7 +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}'
|
||||||
data_src = "https://www.mixcloud.com/widget/iframe/?feed={url}"
|
iframe_src = "https://www.mixcloud.com/widget/iframe/?feed={url}"
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -53,7 +53,7 @@ def response(resp):
|
||||||
{
|
{
|
||||||
'url': url,
|
'url': url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'data_src': data_src.format(url=url),
|
'iframe_src': iframe_src.format(url=url),
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'content': content,
|
'content': content,
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ def response(resp):
|
||||||
"title": title,
|
"title": title,
|
||||||
"content": content,
|
"content": content,
|
||||||
"publishedDate": publishedDate,
|
"publishedDate": publishedDate,
|
||||||
"data_src": sanitized_url + res["embedPath"],
|
"iframe_src": sanitized_url + res["embedPath"],
|
||||||
"thumbnail": thumbnail,
|
"thumbnail": thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -98,7 +98,7 @@ def response(resp):
|
||||||
'length': length,
|
'length': length,
|
||||||
'template': 'videos.html',
|
'template': 'videos.html',
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'data_src': result.get('embedUrl'),
|
'iframe_src': result.get('embedUrl'),
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -98,7 +98,7 @@ def response(resp):
|
||||||
'url': result['permalink_url'],
|
'url': result['permalink_url'],
|
||||||
'title': title,
|
'title': title,
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'data_src': "https://w.soundcloud.com/player/?url=" + uri,
|
'iframe_src': "https://w.soundcloud.com/player/?url=" + uri,
|
||||||
'content': content,
|
'content': content,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -67,7 +67,7 @@ def response(resp):
|
||||||
{
|
{
|
||||||
'url': url,
|
'url': url,
|
||||||
'title': title,
|
'title': title,
|
||||||
'data_src': "https://embed.spotify.com/?uri=spotify:track:" + result['id'],
|
'iframe_src': "https://embed.spotify.com/?uri=spotify:track:" + result['id'],
|
||||||
'content': content,
|
'content': content,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -57,7 +57,7 @@ def response(resp):
|
||||||
'content': '',
|
'content': '',
|
||||||
'template': 'videos.html',
|
'template': 'videos.html',
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'data_src': "https://player.vimeo.com/video/" + videoid,
|
'iframe_src': "https://player.vimeo.com/video/" + videoid,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -78,7 +78,7 @@ def response(resp):
|
||||||
'content': content,
|
'content': content,
|
||||||
'template': 'videos.html',
|
'template': 'videos.html',
|
||||||
'publishedDate': publishedDate,
|
'publishedDate': publishedDate,
|
||||||
'data_src': "https://www.youtube-nocookie.com/embed/" + videoid,
|
'iframe_src': "https://www.youtube-nocookie.com/embed/" + videoid,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -85,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',
|
||||||
'data_src': 'https://www.youtube-nocookie.com/embed/' + section['videoId'],
|
'iframe_src': 'https://www.youtube-nocookie.com/embed/' + section['videoId'],
|
||||||
'thumbnail': section['thumbnail']['thumbnails'][-1]['url'],
|
'thumbnail': section['thumbnail']['thumbnails'][-1]['url'],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -156,7 +156,7 @@ def parse_first_page_response(response_text):
|
||||||
'author': author,
|
'author': author,
|
||||||
'length': length,
|
'length': length,
|
||||||
'template': 'videos.html',
|
'template': 'videos.html',
|
||||||
'data_src': 'https://www.youtube-nocookie.com/embed/' + videoid,
|
'iframe_src': 'https://www.youtube-nocookie.com/embed/' + videoid,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ 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 = ['data_src', 'audio_src']
|
_url_fields = ['iframe_src', 'audio_src']
|
||||||
|
|
||||||
|
|
||||||
def on_result(request, search, result):
|
def on_result(request, search, result):
|
||||||
|
|
|
@ -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.data_src -%}
|
{%- if result.iframe_src -%}
|
||||||
<small> • <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> • <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.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
||||||
<iframe data-src="{{result.data_src}}" frameborder="0" scrolling="no" allowfullscreen></iframe>
|
<iframe data-src="{{result.iframe_src}}" frameborder="0" scrolling="no" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
|
|
@ -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.data_src -%}
|
{%- if result.iframe_src -%}
|
||||||
<small> • <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> • <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.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-video-{{ index }}" class="embedded-video collapse">
|
<div id="result-video-{{ index }}" class="embedded-video collapse">
|
||||||
<iframe data-src="{{result.data_src}}" width="540" height="304" frameborder="0" scrolling="no" allowfullscreen></iframe>
|
<iframe data-src="{{result.iframe_src}}" width="540" height="304" frameborder="0" scrolling="no" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
|
|
@ -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.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<p class="altlink"> • <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"> • <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,9 @@
|
||||||
</p>
|
</p>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{{- result_sub_footer(result, proxify) -}}
|
{{- result_sub_footer(result, proxify) -}}
|
||||||
{% if result.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
<div id="result-media-{{ index }}" class="embedded-content invisible">
|
||||||
<iframe data-src="{{result.data_src}}" frameborder="0" allowfullscreen></iframe>
|
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% if result.audio_src -%}
|
{% if result.audio_src -%}
|
||||||
|
|
|
@ -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.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<p class="altlink"> • <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"> • <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.data_src -%}
|
{% if result.iframe_src -%}
|
||||||
<div id="result-video-{{ index }}" class="embedded-video invisible">
|
<div id="result-video-{{ index }}" class="embedded-video invisible">
|
||||||
<iframe data-src="{{result.data_src}}" frameborder="0" allowfullscreen></iframe>
|
<iframe data-src="{{result.iframe_src}}" frameborder="0" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{{ result_footer(result) }}
|
{{ result_footer(result) }}
|
||||||
|
|
Loading…
Reference in New Issue