Mastodon furthermore implements the whole server-server ActivityPub standard, which can be used for some actions, like following someone, just fine. This is a very well described standard.
Mastodon doesn't implement ActivityPub server-client standard, instead it has the aforementioned selfbrewn "rest" API. Which, IMO is a shame, and has caused all clients (mobile, web, etc) to rely on this nonstandard API.
Edit: the point being:there are several ways to get content from Mastodon, depending on usecase and needs. You really don't need to scrape or parse or load the JS cliënt.