Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacManiac76

macrumors 68000
Original poster
Apr 21, 2007
1,842
679
Arizona
I had been using a Geektool shell command to show the Sunrise/Sunset on my desktop, but it has stopped working at all over the past week or so. The command that used to work is:

Code:
curl http://m.wund.com/US/AZ/Overgaard.html | grep 'Sunrise' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -e 's/Sunrise/Sunrise: /g' | sed -e 's/PST//g'

I'm assuming the code on the website has changed that displayed the Sunrise/Sunset.

Can anybody help me with getting a new set of code working from this site or any other site? Thanks.
 

tag

macrumors 6502a
Apr 29, 2005
918
9
I checked out the weather underground page and wrote up the following two command strings which should do what you are looking for.

Sunrise code...
Code:
curl -s https://www.wunderground.com/cgi-bin/findweather/getForecast?query=Overgaard+az | grep 'cc-sun-rise' | awk -F'[/>]' '{print "Sunrise: "$3,$6;exit}' | sed 's/[<]//g'

Sunset code...
Code:
curl -s https://www.wunderground.com/cgi-bin/findweather/getForecast?query=Overgaard+az | grep 'cc-sun-set' | awk -F'[/>]' '{print "Sunset: "$3,$6;exit}' | sed 's/[<]//g'
 
Last edited:
  • Like
Reactions: MacManiac76

MacManiac76

macrumors 68000
Original poster
Apr 21, 2007
1,842
679
Arizona
I checked out the weather underground page and wrote up the following two command strings which should do what you are looking for.

Sunrise code...
Code:
curl -s https://www.wunderground.com/cgi-bin/findweather/getForecast?query=Overgaard+az | grep 'cc-sun-rise' | awk -F'[/>]' '{print "Sunrise: "$3,$6;exit}' | sed 's/[<]//g'

Sunset code...
Code:
curl -s https://www.wunderground.com/cgi-bin/findweather/getForecast?query=Overgaard+az | grep 'cc-sun-set' | awk -F'[/>]' '{print "Sunset: "$3,$6;exit}' | sed 's/[<]//g'

I need your help again if you are up for it. They must have changed the site again as the above commands no longer work. Appreciate any help you can give. Thanks in advance.
 

MacManiac76

macrumors 68000
Original poster
Apr 21, 2007
1,842
679
Arizona
Anybody else know how to fix this Geektool command? I wish I knew how to code this since these sites keep changing their page layouts for no reason. It doesn't need to come from this site, if anybody else has a similar sunrise/sunset code that works for them that they can share, that would be awesome! Thanks for any help or other advise that can be offered.
 

tag

macrumors 6502a
Apr 29, 2005
918
9
Hey sorry, I haven't been on this site in a few months so I didn't see this in a timely manner.

Not sure if you still need this, but I looked around and found sunrise-sunset.org which looks pretty good. Here are the commands to get the times from that site...

Sunrise code...
Code:
curl -s https://sunrise-sunset.org/search?location=Overgaard%2C+Heber-Overgaard%2C+AZ%2C+United+States | sed -n '/div id="today"/,/div id="tomorrow"/p' | grep 'Sunrise time:' | awk -F'[/>]' '{print "Sunrise: "$3;exit}'| sed 's/[<]//g'

Sunset code...
Code:
curl -s https://sunrise-sunset.org/search?location=Overgaard%2C+Heber-Overgaard%2C+AZ%2C+United+States | sed -n '/div id="today"/,/div id="tomorrow"/p' | grep 'Sunset time:' | awk -F'[/>]' '{print "Sunset: "$3;exit}'| sed 's/[<]//g'

And just for the heck of it since the information is there in case you want it...

Day length code....
Code:
curl -s https://sunrise-sunset.org/search?location=Overgaard%2C+Heber-Overgaard%2C+AZ%2C+United+States | sed -n '/div id="today"/,/div id="tomorrow"/p' | grep 'daylength' | awk -F'[/>]' '{print "Day length: "$3;exit}'| sed 's/[<]//g'
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.