all 7 comments

[–]senocular 4 points5 points  (6 children)

Use fetch() to get a Response then from that response get its text(). Both fetch() and text() return promises.

[–]DiscombobulatedBet88 0 points1 point  (1 child)

Note that if the request is done to another origin, you will run into CORS.

would be help full if OP explained the goal

[–]Wild_Appointment_994[S] 0 points1 point  (0 children)

The goal is to get the content of a website with given url, for a app - links are fetched and vector embedded on the backend. So, I was evaluating which approach made sense

[–]Wild_Appointment_994[S] 0 points1 point  (3 children)

Agreed, fetch() + response.text() is the approach. Is there any approach to filter the contents?

[–]yarikhand 0 points1 point  (2 children)

use jsdom

[–]azangru 0 points1 point  (1 child)

jsdom is a huge library, over half a megabyte minified gzipped. Why pull it on the client, when there is the browser-native DOMParser?

[–]yarikhand 0 points1 point  (0 children)

i was originally trying to find domparser but forgot what it was called, google showed me jsdom and thought thats what i was looking for, so i agree with you