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

maverick28

macrumors 6502a
Mar 14, 2014
630
312
Thanks for the tip about the calendar, but I don't actually care to know what phase of the moon is in, I just want the widget to work correctly. It was a nice touch in the original. But if we can't get good data I guess the moon will just always be full...

But you need to understand the mechanics of the Moon to write the code :)
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
Okay, the attachment in the first post has been updated—the widget now uses Weatherbit instead of DarkSky.

This was a good thing in many ways—all the original weather conditions work, and because Weatherbit supports plain-old http, it should function in 10.4 – 10.8 without any weird workarounds. (But as of now it has only been tested on 10.6—thanks @Princess Cake for that!)

This has basically been working since early April, I just never got around to packaging the whole thing up. And, I wanted to test it for a while on my own machine in case something went horribly wrong.

I do have half a mind to change APIs again, though—I found out that HERE provides about 8x as many weather API calls for free, and includes the location lookup stuff, so you'd only need to enter a single key. Their weather forecasts also may or may not be more accurate—I can't tell for sure.

The primary reason I decided against using HERE is that—like DarkSky—they're HTTPS-only, so we'd be back to needing a proxy server for Mountain Lion and older. I want this widget to work everywhere—or, at minimum, at least back to the venerable Snow Leopard!
 
Last edited:
  • Like
Reactions: otetzone and madrag

madrag

macrumors 6502
Nov 2, 2007
375
98
Nice one!

Unfortunately, when I tried to create the MaQuest's API Key, it gives me this error
  • There was a problem with your form submission. Please wait 2592000 seconds and try again.
  • CAPTCHA session reuse attack detected.
I think this is a bug in their form...
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
Nice one!

Unfortunately, when I tried to create the MaQuest's API Key, it gives me this error
  • There was a problem with your form submission. Please wait 2592000 seconds and try again.
  • CAPTCHA session reuse attack detected.
I think this is a bug in their form...

Ugh, again?! A different problem with MapQuest happened at one point early on, but they fixed it.

You might try a different computer/browser/IP address to generate the key, although it's concerning that they seemingly want you to wait a month (!) before trying again.

My hands are a little tied since I don't control MapQuest. If anyone else experiences issues, please keep letting me know! If this keeps happening I'll need to reconsider switching to the HERE api for everything.

Edit: If you're willing to try, you may also consider contacting them, since it's clearly a problem on their side. Just let them know you're trying to generate a key and getting that error.
 
Last edited:
  • Like
Reactions: madrag

madrag

macrumors 6502
Nov 2, 2007
375
98
Thanks for you suggestions.

I ended up by using a VPN to change my IP and it worked, now I have a key.

I installed it and it works as expected!

Also thank you for your effort and dedication to returning the weather widget, it's sad that the companies block something that is so useful.
 
Last edited:

madrag

macrumors 6502
Nov 2, 2007
375
98
I think there is an issue, it shows me the forecast starting in monday, but we are in tuesday...
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
Turns out Madrag found a pretty bad timezone bug! Sorry about that, update coming soon...
 
  • Like
Reactions: madrag

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
The attachment in the first post has been updated to fix the timezone error reported by @madrag. Please update—this is one of those bugs that can result in inaccurate weather forecasts (by way of mismatched day of the week labels), and I really hate to think there are people out there getting misinformation because of me.

Hopefully this is the last bug of this sort? Unfortunately, handling time zones actually gets pretty complicated—there's the local time of your computer, the local time of the location you’re viewing, and UTC time all combining in different ways. Tracking which is in use at a given point in the code gets tricky.
 
Last edited:
  • Like
Reactions: madrag

maverick28

macrumors 6502a
Mar 14, 2014
630
312
Thank you, it works! However, if they implement TLS changes it will require using proxy again. Works as is in 10.7 as of now. I archived the old one, just in case.
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
The DarkSky version—and every version I've ever uploaded here—is also on the Macintosh Garden should you ever need them. Use the Garden's "Show Revision History" link.

Mind, the proxy would work just as well with this iteration, you'll just want to change the "url" line in WeatherParser.js to point to the URL of your proxy. For such a simple php script it’s really quite versatile—I also use it to make certain https RSS feeds work with NetNewsWire 4 on Mavericks.

I also don't forsee Weatherbit up and dropping http without warning, that could potentially break a lot of clients. DarkSky never supported http as far as I can tell.
 
Last edited:

madrag

macrumors 6502
Nov 2, 2007
375
98
The attachment in the first post has been updated to fix the timezone error reported by @madrag. Please update—this is one of those bugs that can result in inaccurate weather forecasts (by way of mismatched day of the week labels), and I really hate to think there are people out there getting misinformation because of me.

Hopefully this is the last bug of this sort? Unfortunately, handling time zones actually gets pretty complicated—there's the local time of your computer, the local time of the location your viewing, and UTC time all combining in different ways. Tracking which is in use at a given point in the code gets tricky.
Works great, thank you very much!

No one can blame you on the possible "misinformation", this is a gift that you've given to the community.

Anyone that uses this widget should be thankful, not to mention your dedication in making this happen and also in fixing eventual bugs, it is commendable!
 

Adam1988

macrumors regular
The Weather dashboard widget that ships with Mac OS X 10.4 – 10.14 broke in 2019, when the APIs it uses went offline. Luckily, the widget is all just editable Javascript code, so I rewrote a portion of the code to use the freely-accessible DarkSky and MapQuest APIs. Then I rewrote it again a few months later to use the Weatherbit API after Apple bought DarkSky.

Here's my modified widget. It requires a small amount of setup:
  1. Download and extract the attached file.
  2. Right click Weather.wdgt and select Show Package Contents.
  3. Open the file weatherParser.js in a text editor.
  4. Make accounts at Weatherbit and MapQuest to get API keys for each service.
  5. Paste your API keys into the quotes at the top of the file you opened. When you're done, the beginning of the file should look something like this:
    Code:
    // https://www.weatherbit.io/account/create
    var weatherbitApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    
    // https://developer.mapquest.com/user/me/plan
    var mapQuestApiKey = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
    
    
    //-------------------------------------------------------------------------------------
  6. Go ahead install the modified widget, either by double-clicking Weather.wdgt (recommended), or by replacing Apple's original version in /Library/Widgets/ (if having two copies on your machine would offend your sensibilities).
This widget has been tested on 10.6 "Snow Leopard" and 10.9 "Mavericks", but it should run on the full gamut of Tiger through Mojave. Please let me know if it does not.

Please also post if you encounter problems, notice something wrong, or just find something that could improved.


At first time try, it worked for me in less than 3 minutes!

YOU SIR! ARE ARE AN AMAZING GREAT PERSON!
GOD BLESS YOU WITH MORE KNOWLEDGE! THANK YOU VERY MUCH!


Running the latest mac osx on the mid 2010 21.5 inch iMac.
Mac OSX HIGH SIERRA!!!

The API's are REAL! They worked!!!!

Thank you!??
[automerge]1589347981[/automerge]
Thats for catalina too?


I think its possible as well unless the 64 bit architecture doesnt impedes for you to install it ?
 

Attachments

  • Screen Shot 2020-05-13 at 12.28.14 AM.png
    Screen Shot 2020-05-13 at 12.28.14 AM.png
    122.1 KB · Views: 154
  • Screen Shot 2020-05-13 at 12.28.25 AM.png
    Screen Shot 2020-05-13 at 12.28.25 AM.png
    136.5 KB · Views: 172

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
The download in the first page has been updated to fix... wait for it... yet another timezone bug! ?‍♂️

Previously, the widget would sometimes show a purple "night" background during the day, and vice versa. Now that shouldn't happen... I think. If not, let me know...
 
Last edited:

maverick28

macrumors 6502a
Mar 14, 2014
630
312
Cool, this time the installation went buttery smooth and even didn't require complemental reboots and Dashboard restarts. Or maybe it's just the behaviour of Dashboard was different depending on the macOS: in Lion, it raises an informational window telling that the widget is open and allowing to install on top and thats it, and Dashboard there shows only 1 weather widget whereas in Mavericks and High Sierra there're 2 widgets being displayed - the original one and the modified one and you have to kill Dock or re-load it.
 

Lasthenia

macrumors newbie
May 28, 2020
27
10
The download in the first page has been updated to fix... wait for it... yet another timezone bug! ?‍♂️

Previously, the widget would sometimes show a purple "night" background during the day, and vice versa. Now that shouldn't happen... I think. If not, let me know...

Excellent job reviving this widget!

I am from the exact opposite side of the world from the US and notice that the widget shows the correct day/night background here but appears to show west coast cities to be at night all the time.

Thank you very much!
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
I am from the exact opposite side of the world from the US and find that the widget shows the correct day/night here but seems to show Washington DC to be at night all the time.

Oh $%$

Confirmed. I... have no idea what could still be wrong atm, but I'll look into it at some point.

I hate timezones.
 

vkd

macrumors 6502a
Sep 10, 2012
984
380
Turns out that the Yahoo Finance stocks widget has stopped working now. Any chance of a fix, similar to the Weather Widget?
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
Turns out that the Yahoo Finance stocks widget has stopped working now. Any chance of a fix, similar to the Weather Widget?

Oh, that sucks! But, no, I don't use that one, and the weather widget took a long time to do.

That leaves ESPN, Movies, and the currency-conversion portion of Unit Converter as the only internet-connected stock widgets that are still working, and I think we can safely expect them to go down one-by-one. I would be interested in fixing Unit Converter when it goes down; should be relatively easy, and I use it a lot.

For the rest, if there are other developers who are interested in fixing a widget but aren't sure how to get started, I'd be happy to offer guidance and help with specific problems. You don't really need to know much, just some basic Javascript knowledge. The rest is trial and error, to figure out what the widget accepts.

P.S. New build of the weather widget coming soon. A Japanese user emailed me about a localization bug.
 

Lasthenia

macrumors newbie
May 28, 2020
27
10
That leaves ESPN, Movies, and the currency-conversion portion of Unit Converter as the only internet-connected stock widgets that are still working, and I think we can safely expect them to go down one-by-one. I would be interested in fixing Unit Converter when it goes down; should be relatively easy, and I use it a lot.
Is your Unit Converter widget still updating currency rates? Mine has stopped working and is stuck at "Retrieving data".
 

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
Is your Unit Converter widget still updating currency rates? Mine has stopped working and is stuck at "Retrieving data".

Oh... no, it's not. I bet it used the same finance data as the Stocks widget. It refreshes every three hours, so I guess as of when I posted an hour ago, the time limit hadn't elapsed yet.

Okay, I might actually look into that at some point!
 
Last edited:

Wowfunhappy

macrumors 68000
Original poster
Mar 12, 2019
1,751
2,091
The attachment in the first post has been updated. Two changes:
  • The widget should now work in all languages! Thank you to a Japanese user, "Xu", who emailed me—it's cool to see this being used in multiple languages! Luckily, all of Apple's original localization functionality works, I just had to change literally one character.
  • I reverted the timezone change I made in v2020.05.13—locations in other timezones should now have the correct day/night colors. The issue I was originally trying to fix is no longer happening, so I think it must have been a bug on Weatherbit's end.
As always, please let me know if you run into problems, I appreciate it!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.