From 2ec6b582c41d626ceb7bcb6447af0a7973b9d2b8 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Fri, 7 Mar 2025 19:45:05 +0800 Subject: [PATCH] =?UTF-8?q?check-pls=20-=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=81=D1=8B=D0=BB?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D0=BA=D0=B0=D0=BD=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B9=20=D0=BF=D1=80=D0=BE=D0=B1=D0=B5=D0=BB=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check-pls.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check-pls.sh b/check-pls.sh index 51ed0eb..3eae46b 100755 --- a/check-pls.sh +++ b/check-pls.sh @@ -21,6 +21,9 @@ ################################################# awk ' + function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } + function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s } + function trim(s) { return rtrim(ltrim(s)); } BEGIN { total_count=0 success_count=0 @@ -46,13 +49,14 @@ awk ' } { sub("\r$", "", $0) # crlf -> lf + $0 = trim($0) if ($0 ~ /^#EXTINF:.+,/) { total_count++ channel_name = substr($0, index($0, ",") + 1, length($0)) print "\n[" total_count "] " channel_name } if ($0 ~ /^http(s)?:\/\/.*/) { - url = sprintf("%c%s%c", 34, $0, 34) # 34 is " + url = sprintf("%c%s%c", 34, $0, 34) # code 34 is double-qoute char (") cmd = "curl -fs --max-time 5 -w \"%{http_code}\" --max-filesize 5000 -o /dev/null " url cmd | getline http_code code = close(cmd)