Recent issue with wget2, json and the future of the scripts. #524
Replies: 7 comments 59 replies
-
Also @ivan-hc just in case you haven't notice, the issue was not So yeah, any day if github has an update all 2000 scripts can suddenly stop working. |
Beta Was this translation helpful? Give feedback.
-
@ivan-hc Using curl instead of wget is NOT A FIX. The site still gives you json formatted data. The issue is with parsing json. Once again the ideal solution would be start to use jq. However the Both of those are json, both contain the same information, a json parser will have no issue getting the right info you want from any. however using grep, sed, awk, etc will have issues depending on how you use them. |
Beta Was this translation helpful? Give feedback.
-
Today I've also tested the differences between wget and wget2 in terms of options and the ones we use now are not compatible at all.
this is what I've changed for now
As long as api.github.com maintains compatibility with "curl" at the user agent level (since it recognizes "curl" and "wget 1.x" calls, but not yet "wget2", which is not yet an established CLI) we can rest assured. As for the installation interface available since version 6.6.2 (and for which I fought so hard), I will certainly have to adapt to that of "wget2", which is not different from:
|
Beta Was this translation helpful? Give feedback.
-
Btw @ivan-hc have you done anything with |
Beta Was this translation helpful? Give feedback.
-
@ivan-hc I will reply here for better viewing:
For example this is what I use with amdgpu_top to get the GPU USAGE and VRAM USAGE. Just two values + it calculates the results in GiB.
Something that if the data was given as plain text would be a very simple awk command. For example here is the equivalent with nvidia-smi back when I was using nvidia:
Of course jq doesn't have to be used for everything, But I'm not sure at which point I can stop using jq and switch back to the coreutils to do the rest of operation.
Here is the jq equivalent to get the appimagetool link:
I tried for 3 hours to get it to work, in the end I had to ask for help and someone I know that knows a lot of js did it for me. Honestly I really hope my sed trick never breaks so that I don't have to deal with jq or even gron in the future. |
Beta Was this translation helpful? Give feedback.
-
@Samueru-sama @nazdridoy what about this? In APP-MANAGER
the function is called when running the option -i Maybe I can include it in install.am directly, I've changed it like this
|
Beta Was this translation helpful? Give feedback.
-
@ivan-hc make a general beta testing schedule for pushing update. (for example 1 week for major update, 3 days for minoj version, 1 day for minor fix, and hot fix as is ). this will help other contributor (even if they are busy they can certainly spare a few hours in a week) to code review and find bugs before breaking updates. |
Beta Was this translation helpful? Give feedback.
-
Because json formatting doesn't care about whitespaces, we need to be careful when using grep and sed on it.
That means that all
wget
need to be piped first intosed 's/"/ /g; s/ /\n/g'
which will get rid of the quotations and turn every space into a new line. Then grep can be run to get the desired linkWe can't just rely on wget always, because even the websites can change the formatting without changing the actual data and break stuff.
This is what I'm using now to get go-appimage/appimagetool in my scripts:
wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | sed 's/"/ /g; s/ /\n/g' | grep -o 'https.*continuous.*tool.*86_64.*mage$'
It works with both wget and wget2.
The more ideal solution would be using jq. But that introduces a new dependency.
EDIT: This other combination is useful for finding the URL, as it get rids of the parenthesis, curly brackets, double quotes and commas before turning each space into one line.
sed 's/[()",{}]/ /g; s/ /\n/g' | grep https
Beta Was this translation helpful? Give feedback.
All reactions