A
A
artur12142020-05-04 09:51:33
Python
artur1214, 2020-05-04 09:51:33

Why does json from a website only work in operagx?

I needed to parse the catalog from the site instacart.ca, if you register there, you will be able to use api, which, you see, is much more convenient than parsing everything from html, but there is a problem, I use the OperaGX browser, and when I go here:
https:/ /www.instacart.ca/v3/retailers/462/module_d... (only works if you are logged in to this site),
I get a json object that contains information about 30 products. however, if in python, using requests, to add cookies from opera to the request (so that the site thinks that I am logged in), an object is returned where there is information about only 25 objects (some are omitted), I thought that something was wrong in python.
However, I noticed that in google chrome and in normal opera the result is similar to that in python, hence my question to knowledgeable people: what could be the reason for this, and how to treat it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey_Dolg, 2020-05-04
@Andrey_Dolg

Very fragmentary information. However, there can be many reasons for this behavior, and all of them will be on the server side. In your case, if the api still works, which means the cookie field is read by the server, then there are several options.
1) Try to copy all headers for requests similar to OperaGX.
2) Look at what these 5 missing goods are, otherwise it looks very much like a recommendation system or advertising. They clearly must have some special features.
But in general, nothing prevents the server from analyzing which browser the request came from and responding to each in its own way. I also advise you to play around with the &per=30 parameter, perhaps there are still available values ​​​​or direct reading (I saw something like an almost direct sql query in url XD).
UPD
If not for similar results in Chrome, then I would have thought of a fake. But in general, there is no magic in requests - this is the usual transfer of text with the analysis of the received fields.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question