1
0
Fork 0
mirror of https://github.com/imjasonh/urls synced 2026-07-17 22:53:22 +00:00
urls/crawl.sh

19 lines
402 B
Bash
Executable file

#! /usr/bin/env bash
set -euo pipefail
while read l; do
[[ -z $l ]] && continue
[[ $l =~ ^#.* ]] && continue
fn=${l#"https://"}
echo $fn
mkdir -p $(dirname $fn)
curl -s $l | jq > $fn
if [ "$(jq 'has("keys")' $fn)" == "true" ]; then
jq -S -s 'sort_by(.keys[].kid)' $fn | sponge $fn
fi
if grep -q "BEGIN CERTIFICATE" $fn; then
jq -S '.' $fn | sponge $fn
fi
done < urls.txt