How to implement this on Node.js?

There is a certain website. For example, transport.surge.sh There when you click on the button "Example" retrieving file.

How do I write on Node.js a script that every minute go to to this site through a web browser and downloaded the file?

In what side generally to dig? What modules/frameworks/libraries to use? Just don't even know which side to approach
July 9th 19 at 10:28
5 answers
July 9th 19 at 10:30
Node.js has integration with Phantom.js(which is a headless browser, as you ask)

var phantom = require('phantom');

var sitepage = null;
var phInstance = null;
phantom.create()
 .then(instance => {
 phInstance = instance;
 return instance.createPage();
})
 .then(page => {
 sitepage = page;
 return page.open('https://stackoverflow.com/');
})
 .then(status => {
console.log(status);
 return sitepage.property('content');
})
 .then(content => {
console.log(content);
sitepage.close();
phInstance.exit();
})
 .catch(error => {
console.log(error);
phInstance.exit();
 });
July 9th 19 at 10:32
setInterval + each time the request headers are changing
and on what basis they should be changed? - brannon_Christians commented on July 9th 19 at 10:35
as chrome, put chrome headers, when we need Opera, put the headers of the Opera, etc. - aniya.Kertzmann65 commented on July 9th 19 at 10:38
July 9th 19 at 10:34
Through the browser Node.js can't. Just download - can.
But why?
July 9th 19 at 10:36
that every minute go to to this site through a web browser and downloaded the file?

The browser UserAgent is determined by usually.
Usate a simple HTTP client, for example, the module request, and your user-agent to him skarbilovich, substituting chrome, Opera and others. Thousands of them on the Internet. Will you your file via the car browsers.
July 9th 19 at 10:38
https://github.com/request/request#custom-http-headers

This is an example of the substitution of arbitrary headers in the request module.
Wrap it in a setInterval callback and handle saving to a file, like so:
https://nodejs.org/api/fs.html#fs_fs_writefile_fil...

Find more questions by tags JavaScriptNode.js