limbusart/utils/filter-dead-twitter-links.sh

16 lines
399 B
Bash
Raw Normal View History

2024-06-11 02:51:07 +03:00
#!/usr/bin/env bash
touch filtered_arts.txt
while IFS= read -r line
do
2024-11-02 13:00:05 +03:00
if [[ $line == *"twitter.com"* ]]; then
header=$(curl -o save -w "%{header_json}" "$line" 2> /dev/null)
echo $header | jq -e '.location[]' >/dev/null
if [ "$?" = "0" ]; then
echo "$line" >> filtered_arts.txt
fi
else
2024-06-11 02:51:07 +03:00
echo "$line" >> filtered_arts.txt
fi
2024-11-02 13:00:05 +03:00
done < $1