#!/bin/bash declare -A strings if [[ ${cfg[template]} == 'default' ]]; then meta[title]="youtube but not really" source templates/head.sh fi if [[ "${get_data[q]}" ]]; then query="${get_data[q]}" query_nice=$(sed -s 's/+/ /g' <<< "${get_data[q]}") strings[search]="
" else strings[search]="" fi if [[ "${get_data[q]}" ]]; then data=$(haruhi-dl "ytsearch30:${get_data[q]}" --flat-playlist -J | jq '.entries[]') IFS=$'\n' id=($(jq -r '.id' <<< "$data")) title=($(jq -r '.title' <<< "$data")) runtime=($(jq -r '.duration' <<< "$data")) views=($(jq -r '.view_count' <<< "$data")) channel=($(jq -r '.channel' <<< "$data")) channel_id=($(jq -r '.channel_id' <<< "$data")) unset IFS for (( i=0; i<${#id[@]}; i++ )); do strings[results]+="
${title[$i]}
| ${runtime[$i]} seconds | ${views[$i]} views
Uploaded by ${channel[$i]}
" done else echo "search for something will 'ya?" fi source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/search.t"