*nohtml*

local/bin/weather

   1 #!/bin/bash
   2 
   3 f=~/.cache/weather
   4 
   5 [[ $1 == -n && -f $f ]] && cat $f && exit
   6 
   7 read weather icon desc < <(
   8     lynx -dump -display_charset utf-8 \
   9     https://yandex.ru/pogoda/saint-petersburg |
  10     grep -B 3 'Ощущается как' | sed \$d | tr \\n ' '
  11 )
  12 
  13 [[ $weather ]] || exit
  14 
  15 echo "$weather ${desc,,}" | tee $f
  16 curl -s https://yastatic.net/weather/i/icons/funky/light/${icon:1:-1} |
  17 sed 's/="24"/="48"/g' > $f.svg