Ковыряю конки на предмет погоды. живу в 30км от москвы и погода москвы мне не очень подходит, а быково не на всех метеосайтах есть.
Попробовал написать скрипт для яндекса, ничего нормального не получилось, смог извлечь только сегодняшнюю погоду, и то не рационально.
Подскажите, какие методы могут помочь? как оптимизировать скрипт?
download.sh#!/bin/bash
curl http://m.ya.ru/weather/index.xml?city=27527 -s | cat > ~/.conky/yaweather/weather.html
cat ~/.conky/yaweather/weather.html | tail -13 | head -1 | cat > ~/.conky/yaweather/wea
curl "http://m.ya.ru/weather/"`cat ~/.conky/yaweather/weather.html | tail -4 | head -1 | cut -d \" -f 38 ` -s | tail -4 | head -1 | cat >> ~/.conky/yaweather/wea
weather.sh#!/bin/bash
dir="~/.conky/yaweather"
image() {
case $1 in
1.gif) expr rain ;;
2.gif) expr snow ;;
3.gif) expr rain? ;;
4.gif) expr rain ;;
5.gif) expr etc ;;
6.gif) expr 6 ;;
7.gif) expr 7 ;;
8.gif) expr 8 ;;
9.gif) expr 9 ;;
*) echo $1 ;;
esac
}
case "$1" in
tempnow) cat ~/.conky/yaweather/wea | head -1 | cut -d \> -f 22 | cut -d \< -f1 ;;
weanow) image `cat ~/.conky/yaweather/wea | head -1 | cut -d \" -f 44 | cut -c11-` ;;
tempmorn) cat ~/.conky/yaweather/wea | tail -1 | cut -d \> -f 37 | cut -d \< -f1 ;;
weamorn) image `cat ~/.conky/yaweather/wea | tail -1 | cut -d \" -f 62 | cut -c11-` ;;
tempday) cat ~/.conky/yaweather/wea | tail -1 | cut -d \> -f 76 | cut -d \< -f1 ;;
weaday) image `cat ~/.conky/yaweather/wea | tail -1 | cut -d \" -f 86 | cut -c11-` ;;
tempeven) cat ~/.conky/yaweather/wea | tail -1 | cut -d \> -f 115 | cut -d \< -f1 ;;
weaeven) image `cat ~/.conky/yaweather/wea | tail -1 | cut -d \" -f 110 | cut -c11-` ;;
esac