Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Just wondering if the Stocks widget could be fixed using the method used in the iOS StocksX tweak.
I don't know, I haven't looked at the StocksX source code. I'm not going to have time to look into this I'm afraid.

lso curious if the rest of the internet-requiring widgets could be fixed by fixing the urls being requested
This would only work if the new URL provided data in the exact same format as the original URL. Because this doesn't happen, fixing widgets generally requires actually rewriting all of the data parsing code, not just changing the URL.
 
  • Like
Reactions: GalacticStag
I don't know, I haven't looked at the StocksX source code. I'm not going to have time to look into this I'm afraid.


This would only work if the new URL provided data in the exact same format as the original URL. Because this doesn't happen, fixing widgets generally requires actually rewriting all of the data parsing code, not just changing the URL.
the original widget seems to be using a plain old yahoo finance url
the stocksx tweak also uses yahoo finance, not with a url, but rather using the yfinance module in python, which connects to yahoo finance through python
 
ok so i did some modifications on the stocks parser javascript file, and a developer of stocksx is hosting an instance at weatherx.yzu.moe/dgw. i modified the script to use that url. i also modified some other things in the xml request to spoof an ios 4.1 device. however, it is still not working and charles is giving me 500 internal server error. i went into the stocks app on my ios 4.1 ipod touch and the stocks works just fine. the exclamation points in charles are connections from the mac. others are connections from the pod. i even added some charles rewrite rules to spoof the headers for the request, but still no luck. the request for the mac and the ipod are pretty much identical, so i dont know why im not getting a response from the server on a mac. attached below is my charles session file and my modified parser js. i am making a little bit of progress, however. instead of infinitely spinning, the widget now tells me that there was an error retrieving the chart.

EDIT: the charles file is for weather.skyglow.es:5002/dgw which is another instance, i set up a rewrite rule to redirect yzu.moe to skyglow.es, but both are basically identical, with some minor differences.
 

Attachments

  • StocksXSkyglow.chls.zip
    2.7 KB · Views: 3
  • stocksParser.js.zip
    4 KB · Views: 5
guess what? i managed to get the stocks widget (chart and adding new stocks only for now) working! i have attached my stocksParser.js below, it should work. move the js into /system/library/widgetresources/.parsers. enjoy!
 

Attachments

  • Screen Shot 2025-04-23 at 15.55.51.png
    Screen Shot 2025-04-23 at 15.55.51.png
    84.1 KB · Views: 9
  • stocksParser Fixed.js.zip
    4 KB · Views: 5
  • Love
Reactions: Wowfunhappy
guess what? i managed to get the stocks widget (chart only for now) working! i have attached my stocksParser.js below, it should work. move the js into /system/library/widgetresources/.parsers. enjoy!
Awesome work!!! You should be able to edit the path to stocksParser.js inside index.html so that it looks for a local copy inside the widget, and no one has to edit /System/.
 
Awesome work!!! You should be able to edit the path to stocksParser.js inside index.html so that it looks for a local copy inside the widget, and no one has to edit /System/.
idk if you saw but i just edited my message with a new js, this time including adding new symbols functionality (i accidentally put in getchart instead of getsymbol, we all make mistakes)
 
may i ask, how do i edit the path lol
edit: nvm i figured it out
Sorry for being vague, I was on my phone at the time.

You almost got it! There are actually multiple locations where a user could install the widget (namely Library vs /Library), so you don't want to use the absolute path.

Instead of

Code:
<script type='text/javascript' src="file:///Library/Widgets/Stocks.wdgt/stocksParser.js" charset='utf-8'></script>

Do:

Code:
<script type="text/javascript" src="stocksParser.js" charset="utf-8"></script>

It seems you tried this and commented it out? But it works fine!
 
Sorry for being vague, I was on my phone at the time.

You almost got it! There are actually multiple locations where a user could install the widget (namely Library vs /Library), so you don't want to use the absolute path.

Instead of

Code:
<script type='text/javascript' src="file:///Library/Widgets/Stocks.wdgt/stocksParser.js" charset='utf-8'></script>

Do:

Code:
<script type="text/javascript" src="stocksParser.js" charset="utf-8"></script>

It seems you tried this and commented it out? But it works fine!
yes, i updated it again to just use "stocksParser.js" instead of file:///Library/Widgets etc
 
  • Like
Reactions: Wowfunhappy
Sorry for being vague, I was on my phone at the time.

You almost got it! There are actually multiple locations where a user could install the widget (namely Library vs /Library), so you don't want to use the absolute path.

Instead of

Code:
<script type='text/javascript' src="file:///Library/Widgets/Stocks.wdgt/stocksParser.js" charset='utf-8'></script>

Do:

Code:
<script type="text/javascript" src="stocksParser.js" charset="utf-8"></script>

It seems you tried this and commented it out? But it works fine!
i changed it to stocksParser.js and the comment underneath was there by default, wasnt written by me
 
So, where can I download the updated copy of the widget? The one that was uploaded a few posts back doesn't display data in the green info cards and chart parameters at the bottom.
 
Last edited:
So, where can I download the updated copy of the widget? The one that was posted a few posts back doesn't display the data in the green info cards and chart parameters at the bottom.
i havent implemented those so far, and afaik, the server doesnt support the green info cards (because the server uses yfinance in python, which is partially broken rn)
 
Last edited:
i genuinely have no idea how to get the details page to display information, so if anyone wants to give it a go, youre welcome to try. heres the current js file. i am able to get a 200 ok proper response from the server, but its not able to display it.
 

Attachments

  • stocksParser.js.zip
    4.1 KB · Views: 5
Hello,
I finally obtained my DeepL API key, followed your instructions to the T, but the Translation widget won't translate. I copied it to the Widgets dir of my home Library because Squid doesn't run for the other accounts on my machine (I tested it by switching the Guest account). No dice. The Console won't show anything related either. However, the CURL method works.

A small note, though. On 10.7, there's no translationParser.js. Instead, it's called parser.js. I didn't completely replace the three original files (one HTML and two JS). I made them invisible, renaming translationParser.js to parser.js in the process. I noticed that the latter's code doesn't fully match the former.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.