L
L
Lorem Ipsum2021-12-05 14:32:46
Node.js
Lorem Ipsum, 2021-12-05 14:32:46

Why is old HTML returned when parsing a site?

I'm parsing a page with a swing where I'm interested in the price, but for some reason the HTTPS.get request returns the old HTML source code. Tried to set headers - did not help.

const HTTPS = require('https');

HTTPS.get('https://www.obi.ru/sadovye-kacheli/sadovye-kacheli-greengard-santorini-bordo/p/4480281', {
  headers: {
    'Content-Type': 'text/html',
    'Cache-Control': 'private, no-cache, no-store, must-revalidate',
    'Expires': '-1',
    'Pragma': 'no-cache',
  },
}, (resp) => {
  resp.on('data', async (chunk) => {
    const OUTPUT_HTML = bufferParse(chunk);
  });
});


OUTPUT_HTML contains the old HTML, which has already been parsed before.

I extract the productCost value from the HTML.

UPD:
Now I went to the site and saw that you can choose a city there ... I didn’t take this into account))) Maybe he thinks that I’m in some other city and parses that page.


All of a sudden it worked. Why? Unclear.

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