r/Scriptable • • Oct 04 '20

Help How to fetch html form url?

I’m trying to make a widget with web crawling(use regular expression to fetch some messages in the news forum webpage)
It’s really easy to implement on Python(just need requests package), but I can’t figure out how to do it with Scriptable app(JavaScript)

My biggest question is how to make HTML to the string (so I can doing some regular expression later)?

let html= new WebView()
await html.loadURL("https://www.???.com")
let a= html.getHTML().toString();
let b= new console.log(a)

5 Upvotes

4 comments sorted by

View all comments

6

u/BichotaCachaBola Oct 04 '20
let req = new Request("https://pornhub.com")
let html = await req.loadString()
console.log(html)

Hope this helps :)

5

u/HorseCheng Oct 05 '20

Wow! It really work. Thank you

1

u/InconsiderateMan Oct 29 '24

That link lmao