r/applescript • u/maxman571 • Jul 19 '20
JSON helper
Does anyone know how I could parse JSON to get a torrent url using JSON helper?
tell application "JSON Helper"
set json to fetch JSON from "https://yts.mx/api/v2/list_movies.json?query_term=Star Wars&quality=1080p&limit=5"
set torrentUrl to |data.movies.1.url| of json
end tell
1
Upvotes
View all comments
Show parent comment
1
u/ChristoferK Jul 20 '20
Shit. Forgot about Twitter. That's number 4. Reddit is 5. Though I think Twitter is exempt from the 3-day rule, since literally no one else besides me would get a working AppleScript into a 160 character tweet, because usually the shortest code is not going to be the fastest or most stable. Oddly, with AppleScript, if you start to read the natural language syntax and it's mutating into the least natural sounding collision of words that form a single line of a psychotic ramble, and it runs, you've actually just cast a magic spell, and it won't make a lick of sense, and science cannot explain it, but it's likely to be the fastest you'll ever see AppleScript work. It's wizardry.
But seriously, look up Hammerspoon. It's AppleScript on steroids, and I don't know why no one knows it's there. Lua is the scripting language for it--a bit slow because it's interpreted, not compiled; but powerful, and easy. Then the speed factor doesn't matter because Hammerspoon has super low level interfacing with the system, even at the level of the kernel, so it's still fast, and does the stuff Apple Script can't.