diff --git a/iptv-m3u-update b/iptv-m3u-update index 09e1155..f324ddb 100755 --- a/iptv-m3u-update +++ b/iptv-m3u-update @@ -52,9 +52,9 @@ function update { if [[ "$id" = 'id' ]]; then printf '%s\n' "${REPLY},link" else - match="$(grep -A1 'tvg-id="'"$id"'"' "$tmp_m3u_file")" + match="$(grep -A1 'tvg-id="'"$id"'"' "$tmp_m3u_file" | grep -e '^http' | head -n 1)" - if (( $? == 0 )); then + if (( $? == 0 )) && [[ -n "$match" ]]; then link="$(grep -e '^http' <<< "$match")" printf '%s\n' "$REPLY,$link" fi