N
N
newkoss2021-08-08 21:54:53
Node.js
newkoss, 2021-08-08 21:54:53

Authorization on request request through cookies and getting data?

I want to get data by link, but they are available only to authorized users.
Found the answer for python and it was to receive the request along with the steamLoginSecure cookies

cookie = {'steamLoginSecure': '76561138023312211%7C%7CC601EA857111ADADA2FB350CBA0A2C1E02C39E5C'};
item = requests.get('https://steamcommunity.com/market/pricehistory?currency=3&appid=730&market_hash_name=%27Blueberries%27%20Buckshot%20|%20NSWC%20SEAL', cookies=cookie); 
item = item.content;
item = json.loads(item);
print(item);

Everything works perfectly!
But I would like such a solution for Node Js

. Tried this:
var j = request.jar();
var cookie = request.cookie('steamLoginSecure=76561138023312211%7C%7CC601EA857111ADADA2FB350CBA0A2C1E02C39E5C');
var url = 'https://steamcommunity.com/market/pricehistory?currency=3&appid=730&market_hash_name=%27Blueberries%27%20Buckshot%20|%20NSWC%20SEAL');
j.setCookie(cookie, url);
request.get({url: url, jar: j}, function(err, response, body) {
        console.log(body);
  return;
});


But nothing happens, it gives out karakozyabrs with or without cookies

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