Zuletzt aktiv 1732918193

fetch-for-osascript.js Orginalformat
1/*
2 Try it from the command line on Mac:
3 `osascript -l JavaScript fetch-for-osascript.js`
4*/
5function fetch(url) {
6 const queryURL = $.NSURL.URLWithString(url);
7 const requestData = $.NSData.dataWithContentsOfURL(queryURL);
8 const requestString = $.NSString.alloc.initWithDataEncoding(
9 requestData,
10 $.NSUTF8StringEncoding,
11 ).js;
12 return JSON.parse(requestString);
13}
14
15const json = fetch("https://melaniekat.com/gifs/api")
16console.log(JSON.stringify(json))
17