Git Product home page Git Product logo

Comments (9)

jorgerosal avatar jorgerosal commented on June 1, 2024 2

Try using osmosis module. It has login feature. But is limited to the given generic login selector. But it should work in most cases. You can do post request if you want.

Another option you have is to use a headless browser. Try using CasperJs or PhantomJs. It lets you manipulate the DOM and input some fields.

from cheerio.

lbdremy avatar lbdremy commented on June 1, 2024

Cheerio does not retrieve a HTML page for us(or login to access a webpage and scrap the site after), Cheerio is there to parse HTML data and allows us to scrap text, tag, attribute in the HTML page using selectors for example.

from cheerio.

matthewmueller avatar matthewmueller commented on June 1, 2024

Yah, so scraping sites requires some additional logic to request the page. The authentication should be part of the request logic.

Cheerio is meant to work exclusively with HTML, you give it HTML, you can mess around with the HTML, then you can output it.

The screencast in the README might be worth checking out if you haven't done so already. It shows how you might scrape a page using cheerio and Mikeal's request library. Doesn't cover authentication though.

from cheerio.

ekanna avatar ekanna commented on June 1, 2024

Hi Matthew,

Thank you for your reply. I came across many tutorials on scrapping websites with nodejs. But none of them explains how to scrap a site which requires login. If you can do that it will be really help full.

Thanks
koti

from cheerio.

matthewmueller avatar matthewmueller commented on June 1, 2024

@ekanna, to be honest - I'm not really sure myself. I believe you have to send the appropriate cookie information along with the header when you request the page.

This is probably what I would try: log into a page, grab the appropriate cookie from your browser, use the request library to set the cookie, then try it.

I could be way off though :-)

from cheerio.

ekanna avatar ekanna commented on June 1, 2024

@matthew, thank you. I will try using cheerio and request, if i am successful, i will let you know.

from cheerio.

MHM5000 avatar MHM5000 commented on June 1, 2024

any luck?

from cheerio.

oseisaac avatar oseisaac commented on June 1, 2024

any luck?

from cheerio.

adrian110288 avatar adrian110288 commented on June 1, 2024

@oseisaac there are a few options mentioned here https://stackoverflow.com/questions/8726079/how-can-i-scrape-sites-that-require-authentication-using-node-js. Hope it helps

from cheerio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.