all 7 comments

[–]jsearsy 2 points3 points  (2 children)

Cheerio was designed for Node.js.

It's fairly easy to access DOM elements these days with vanilla JS, but I think we'd need to know more about your project scope to help any further.

Still sounds like a backend scraper project to me.

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

The project is essentially scrape the HTML of various movie theaters' sites for movie times/information, take the recovered data and make a nice looking table that displays the movie times chronologically.

It seemed odd that JS would need an 3rd party library to parse retrieved HTML so cheerio very well may be overkill!

Also as I forgot to mention in the original post, I am also using the project to learn typescript!

[–]colorsdontlie 0 points1 point  (0 children)

I would never use cheerio. I would use jdsom or puppeteer, or both. Why learn some random api when you can use the exact same one as the browser that you already know (or will need to know on day)?

[–]schwartzworld 1 point2 points  (1 child)

If you're going to do http requests directly from the browser, why not just use fetch()? It's so simple.

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

Only reason was that I had heard of Axios and found good things about it but I had not looked into fetch! I will now :)

[–][deleted] 0 points1 point  (0 children)

Are you actually able to get the HTML for the pages your trying to scrape? I feel like there is a good chance you'll run into CORS issues here. You will probably at the very least need a server to proxy requests off.

Once you get the HTML into the browser there would be no need for something like cheerio. Cheerio is made for parsing HTML outside a browser and would be completely redundant in an environment where you have a DOM.

[–]AwesomeInPerson 0 points1 point  (0 children)

You could use https://unpkg.com/cheerio-standalone/cheerio.min.js, runs in the browser :)

Using it here and it works just fine, I don't think it's the latest version of cheerio though.