Mac美化,GeekTool获取Yahoo天气图片

来源:互联网 发布:ios icon制作软件 编辑:程序博客网 时间:2024/05/01 04:54

最近有兴趣折腾一下Mac下的GeekTool工具,在获取实时天气图片的时候从网络上查阅的代码中发现从https://weather.yahoo.com/获取图片总是不成功的。

现在的解决方案是从http://uk.weather.yahoo.com/中进行获取,command代码如下

curl --silent "https://uk.weather.yahoo.com/china/beijing/beijing-2151330/" | grep "current-weather" | sed "s/.*background\:url.'//g" | sed "s/'. no.*.//g" | xargs curl --silent -o /tmp/weather.png



文字的获取还是从http://weather.yahoo.com/的订阅网页中获取,command代码如下

curl --silent "http://xml.weather.yahoo.com/forecastrss?p=CHXX0008&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' | tail -n1


0 0