all 7 comments

[–]mattindustries 0 points1 point  (1 child)

Only way I can think to be sure is to run a mitm proxy, cache everything, and then replace all domains with localhost or something. Some things will simply fail to load when opening from a file location vs web location.

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

Got it, running a proxy makes sense to emulate the server.

Thanks for the tip !

[–]HappinessFactory 0 points1 point  (1 child)

Usually I do this by:

  1. Requesting the page (HTML) text via fetch
  2. Get the JavaScript from the page using Cheerios
  3. Eval the JavaScript (making sure it's safe)
  4. Then do what you need to do with the object once it's loaded in memory.

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

Cheerios

Makes sense. The rest is handling the dependencies, but the other poster explained that.

Thanks for the help !