{% extends "base.html.j2" %} {% import 'macros.imp.j2' as macros %} {% block title %} {% if rows is not none %}{{ query | e }} — Search results {% else %}Search Youtube Videos{% endif %} {% endblock %} {% block content %}
{% if rows is not none %} {{ super() }} {# TODO: this is mostly copy-pasted (changed video infobar) from watch.j2's info/endcard section -- dedup! #}
{%for x in rows|selectattr('content.error')%}{{x.content.error}}{%endfor%}
{% for card in rows %} {% set c = card.content %} {% if card.type == 'VIDEO' %} {% call macros.card(c.video_id, c.title, c.length) %} {{ macros.infobar_subscriptions(c.video_id, c.channel_id, c.author) }} {{ c.published if c.published }}  {% endcall %} {% elif card.type == 'CHANNEL' and c.channel_id != channel_id %} {% call macros.card_generic("/channel/"~c.channel_id, c.icons[c.icons.largest] if 'icons' in c else '', c.title) %} Channel {{ c.subscribers }} {% endcall %} {% elif card.type == 'PLAYLIST' %} {% call macros.card_generic("/playlist?list="~c.playlist_id, "https://i.ytimg.com/vi/"~c.video_id~"/mqdefault.jpg", c.title) %} {{ c.author }} {{ c.n_videos }} videos {% endcall %} {% elif card.type == 'WEBSITE' %} {% call macros.card_generic(c.url, c.icons[250] if 'icons' in c else '', c.title) %} {{ c.domain }} {% endcall %} {% endif %} {% endfor %} {{ macros.dummycard() }}
{% if page > 1 %} {{ macros.pagination("previous", {'page':(-1,1)}, -1) }} {% endif %} {{ macros.pagination("next", {'page':(+1,1)}, +1) }}
{% else %} please type a search query. {% endif %} {% endblock %} {% block footer %}
{% endblock %}