Scriptable: wget capable Javascript?

I really don’t know any Javascript (but are hoping to learn sometime soon :crossed_fingers:) but I was wondering if it is:

  • possible to run a wget capable kind of JS script in Scriptable?

    • presenting the downloaded HTML page through the Webviev instance in Scriptable (I’ve been going through the documentation in Scriptable)?
      • I’m hoping to create a web app out of open-source JS web apps, that resides and is called from iCloud drive
        • Hoping this could be done through Scriptable :crossed_fingers:
  • is it possible to do webscraping through JS in Scriptable?

    • if so: I’ve been searching for a type of generic JS that delivers a JSON result making it possible to deliver the resulting dictionary to Siri Shortcut and extract key values in plain text for further presentation in Shortcut
      • Possible?

Follow-up question - somewhat related to previous scripts but also generic JS scripts

I’ve read it’s possible to create a temporary web page to run custom JS within

  • is this done through Siri Shortcut, Scriptable, or through a combination of both?

That’s quite a few questions, so here’s a few brief answers.

Take a look at Request in Scriptable. This can be used to retrieve web content which is what WGET does.

You can indeed load any HTML you retrieve in a Scriptable web view, or even load it directly from a URL.

iCloud Drive is file based rather than URL based access, so look at Scriptable’s FileManager for that.

In terms of web scraping, if you use a Scriptable web view to evaluate a URL, you can then access the resulting content through the document object model for the page. There are a few examples of this on this forum.

JSON is JavaScript Object Notation, so it’s built into the language. Just read an intro to get a handle on it.

You can run JavaScript ‘in a page’ in both Scriptable and Shortcuts. There are examples of both available in this forum.

Hope that’s enough to point you in the right direction on things.


Thanks for your answers, you call them brief, but it’s great for pointing me in the right direction (no sense in giving solutions - where’s the fun & challenge in that, I agree + I want to learn :slightly_smiling_face:)

I’ll look at the intro and scour this forum for the info I need.

If/when I get this working I’ll throw an iCloud link for the script(s) :wink: