Geektool Geektool Sunrise/Sunset shell command no longer working

Discussion in 'UI Customization' started by MacManiac76, Mar 16, 2017.

  1. MacManiac76 macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #1
    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.
     
  2. tag, Mar 29, 2017
    Last edited: Mar 30, 2017

    tag macrumors 6502a

    tag

    Joined:
    Apr 29, 2005
    Location:
    US
    #2
    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'
    
     
  3. MacManiac76 thread starter macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
  4. MacManiac76 thread starter macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #4
    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.
     
  5. MacManiac76 thread starter macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #5
    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.
     
  6. tag, Nov 14, 2017 at 6:05 PM
    Last edited: Nov 14, 2017 at 6:18 PM

    tag macrumors 6502a

    tag

    Joined:
    Apr 29, 2005
    Location:
    US
    #6
    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'
    
     

Share This Page