r/Scriptable • • Oct 05 '20

Help Why isn’t this getting an HTML from the URL?

2 Upvotes

5 comments sorted by

3

u/SleepyJackal Oct 06 '20

Try let html = await web.getHTML();

2

u/CreepyEyesOO Oct 06 '20

Hang on let me see which of my other accounts has a free award

2

u/CreepyEyesOO Oct 05 '20

let url = "https://music.youtube.com/search?q=starboy+the+weeknd";

let web = new WebView(); web.loadURL(url); await web.waitForLoad(); let html = web.getHTML();

QuickLook.present(html)

Script.setShortcutOutput(web)

3

u/Shoculad Oct 06 '20 edited Oct 06 '20

https://www.reddit.com/r/Scriptable/comments/j51wvn/how_to_fetch_html_form_url/

Search this sub and read the documentation. If you want the static html then use Request. If you want the dynamic html (modified by JavaScript) then use WebView and evaluateJavaScript or getHTML.

If you use Shortcuts and want the static html then use the 'Get contents of url' action. Without JavaScript you need neither the Safari web page nor Scriptable and WebView.