get-nitter-instances (854B)
1 #!/bin/sh 2 3 # SPDX-FileCopyrightText: 2023 Yuval Langer <yuval.langer@gmail.com> 4 # 5 # SPDX-License-Identifier: AGPL-3.0-or-later 6 7 if [ -z "$(command -v git)" ]; then 8 printf "Please install git."; 9 exit 1; 10 fi 11 12 nitter_wiki_address="https://github.com/zedeus/nitter.wiki.git" 13 nitter_wiki_directory="$HOME/.cache/get-nitter-instances" 14 instances_filename="Instances.md" 15 16 if [ "$1" = "--update" ]; then 17 do_update="true" 18 fi 19 20 (git clone "$nitter_wiki_address" "$nitter_wiki_directory" > /dev/null 2>&1 || 21 (if [ -n "$do_update" ]; then 22 cd "$nitter_wiki_directory" 23 git pull -v > /dev/null 2>&1 24 fi) 25 ) && 26 grep white_check_mark "$nitter_wiki_directory/$instances_filename" | 27 grep 'white_check_mark:\s*|\s*:white_check_mark' | 28 sed " 29 s#white_check_mark.*##; 30 s#.*](##; 31 s#).*##" | 32 sort -h | 33 uniq