mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
Merge pull request #140 from skelly37/main
This commit is contained in:
commit
076ffa87c0
1 changed files with 19 additions and 0 deletions
19
api_wrappers/wolframalpha.nu
Normal file
19
api_wrappers/wolframalpha.nu
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#Fetch simple anwser from WolframAlpha API
|
||||||
|
def wolfram [...query #Your query
|
||||||
|
] {
|
||||||
|
let appID = #YOUR APP_ID
|
||||||
|
let query_string = ($query | str collect " ")
|
||||||
|
let result = (fetch ("https://api.wolframalpha.com/v1/result?" + ([[appid i]; [$appID $query_string]] | to url)))
|
||||||
|
$result + ""
|
||||||
|
}
|
||||||
|
|
||||||
|
#Fetch image with full anwser from WolframAlpha API
|
||||||
|
def wolframimg [...query #Your query
|
||||||
|
] {
|
||||||
|
let appID = #YOUR APP_ID
|
||||||
|
let query_string = ($query | str collect " ")
|
||||||
|
let filename = ($query_string + ".png")
|
||||||
|
let link = ("https://api.wolframalpha.com/v1/simple?" + ([[appid i]; [$appID $query_string]] | to url) + "&background=F5F5F5&fontsize=20")
|
||||||
|
fetch $link | save $filename
|
||||||
|
echo ("Query result saved in file: " + $filename)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue