From f8a4d080faa068f7f34f700834c892ab46101ab4 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Sat, 8 Feb 2025 17:59:46 +0300 Subject: [PATCH] Update: use dump.csv.gz file from z-i --- update.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index 4ad1bd2..cc1503e 100755 --- a/update.sh +++ b/update.sh @@ -4,14 +4,15 @@ set -e HERE="$(dirname "$(readlink -f "${0}")")" cd "$HERE" -LISTLINK='https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv' +LISTLINK='https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv.gz' NXDOMAINLINK='https://raw.githubusercontent.com/zapret-info/z-i/master/nxdomain.txt' -curl -f --fail-early --compressed -o temp/list_orig.csv "$LISTLINK" || exit 1 +curl -f --fail-early --compressed -o temp/list_orig.csv.gz "$LISTLINK" || exit 1 +zcat temp/list_orig.csv.gz > temp/list_orig.csv iconv -f cp1251 -t utf8 temp/list_orig.csv > temp/list.csv curl -f --fail-early --compressed -o temp/nxdomain.txt "$NXDOMAINLINK" || exit 1 LISTSIZE="$(curl -sI "$LISTLINK" | awk 'BEGIN {IGNORECASE=1;} /content-length/ {sub(/[ \t\r\n]+$/, "", $2); print $2}')" -[[ "$LISTSIZE" != "$(stat -c '%s' temp/list_orig.csv)" ]] && echo "List 1 size differs" && exit 2 +[[ "$LISTSIZE" != "$(stat -c '%s' temp/list_orig.csv.gz)" ]] && echo "List 1 size differs" && exit 2 LISTSIZE="$(curl -sI "$NXDOMAINLINK" | awk 'BEGIN {IGNORECASE=1;} /content-length/ {sub(/[ \t\r\n]+$/, "", $2); print $2}')" [[ "$LISTSIZE" != "$(stat -c '%s' temp/nxdomain.txt)" ]] && echo "List 2 size differs" && exit 2