A
A
Andrey Salnikov2017-06-23 10:30:10
JavaScript
Andrey Salnikov, 2017-06-23 10:30:10

How to log in to a site using a node request?

I am writing a parser for images from a website. If I am not authorized, then some of the images are not displayed. More precisely, an inscription is displayed instead of an image - only for registered users. The question arose how to log in and at the same time save the session.
I use the following packages:
request - for downloading images.
request-promise is for requesting pages through promises.
also worth { jar: true }. The documentation says that it is needed to save the session.
First I make a request to a page with a form, from there I take the csrf token.
Then I make a request to the same page again, but with the data filled in.
It is logical that I logged in and the images should be displayed, but this unfortunately does not work. Tell me how to do it right. The website is reactor.cc if needed.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question