Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromURL, loadBuffer, decodeStream missing #3101

Open
edemaine opened this issue Apr 1, 2023 · 9 comments
Open

fromURL, loadBuffer, decodeStream missing #3101

edemaine opened this issue Apr 1, 2023 · 9 comments

Comments

@edemaine
Copy link
Contributor

edemaine commented Apr 1, 2023

The documentation says that this should work:

import * as cheerio from 'cheerio';
cheerio.fromURL('https://example.com')

or

require('cheerio').fromURL('https://example.com')

However, cheerio does not appear to have a fromURL property, in the released NPM version 1.0.0-rc.12. Perhaps related to #2774? Similarly, decodeStream which fromURL is built on, loadBuffer, stringStream all seem to be missing. I have contains, load, html, merge, parseHTML, root, text, xml.

As a first-time user to Cheerio, this was pretty confusing, as it seems like the easiest way to get started with the library.

@edemaine edemaine changed the title fromURL missing fromURL, loadBuffer, decodeStream missing Apr 1, 2023
@AlGhaliyahM
Copy link

@edemaine I have faced the same issue and revert to cheerio documentation. As per the documentation
Only the load method is available by default. If you are using current NodeJS version, other methods will be available if you use an ES Module imports (your file has a .mjs extension, or you have type: "module" in your package.json). You can also directly import or require cheerio/lib/batteries.

I have directly imported cheerio/lib/batteries to use fromUrl property but it seems to be missing.

@edemaine
Copy link
Contributor Author

FWIW, I'm already using ESM via type: "module". The word fromURL does not appear in any files within node_modules/cheerio, so my guess is that it's an issue of code not yet published to NPM.

@fb55
Copy link
Member

fb55 commented Apr 18, 2023

This hasn't been released yet — as the banner at the top of the website says:

Cheerio's website is still a work-in-progress, and covers Cheerio's next release that isn't available yet.

I want to wrap up work on the website before issuing the release, but haven't been able to focus on that for a while.

@edemaine
Copy link
Contributor Author

edemaine commented Apr 18, 2023

Thanks for confirming! I'm new to Cheerio so it was just a confusing on-boarding experience. (I just wrote my own fromURL for now.)

The site looks great! Let me know if there's something you could use help with. I did have a docs wording suggestion for newcomers, so I'll go make a PR.

@michaelfaith
Copy link

Would love for this to become GA. It's such a great option for us

@realChakrawarti
Copy link

Coming to this after 4 months,
Any update on this? Wasted quite a few minutes to figure out what's wrong with my setup.

Please flag the docs accordingly: https://cheerio.js.org/docs/api#fromurl. Will raise a PR if required.

@laygir
Copy link

laygir commented Sep 3, 2023

I do not see any implementation of fromURL in the package I get from npm. And unable to require from cheerio/lib/batteries as it does not appear to exist. What am I missing?

@michaelfaith
Copy link

As they said, it hasn't been released yet

@krel99
Copy link

krel99 commented Jan 13, 2024

It does appear that new loading documents have still not been released. I am upvoting this as it is confusing to work with a documentation of "future" when building tools for today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants