V
V
Vanik Khachatryan2017-06-22 15:50:01
PHP
Vanik Khachatryan, 2017-06-22 15:50:01

How to make a bot to visit the site 1 time per minute?

We need a bot that would just have rights on the site, and visit only one page. For example, every minute.
How is it and what is done? I'm guessing it's in Node.js, but I'm not sure.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stalker_RED, 2017-06-22
@Stalker_RED

You can visit a page once a minute on anything that timers and http can do. On the node including.
At the expense of rights - describe in more detail.

D
dummyman, 2017-06-22
@dummyman

Casper can help
here docs.casperjs.org/en/latest/quickstart.html#now-le...

var links = [];
var casper = require('casper').create();

function getLinks() {
    var links = document.querySelectorAll('h3.r a');
    return Array.prototype.map.call(links, function(e) {
        return e.getAttribute('href');
    });
}

casper.start('http://google.fr/', function() {
   // Wait for the page to be loaded
   this.waitForSelector('form[action="/search"]');
});

casper.then(function() {
   // search for 'casperjs' from google form
   this.fill('form[action="/search"]', { q: 'casperjs' }, true);
});

casper.then(function() {
    // aggregate results for the 'casperjs' search
    links = this.evaluate(getLinks);
    // now search for 'phantomjs' by filling the form again
    this.fill('form[action="/search"]', { q: 'phantomjs' }, true);
});

casper.then(function() {
    // aggregate results for the 'phantomjs' search
    links = links.concat(this.evaluate(getLinks));
});

casper.run(function() {
    // echo results in some pretty fashion
    this.echo(links.length + ' links found:');
    this.echo(' - ' + links.join('\n - ')).exit();
});

Run
Get
20 links found:
 - https://github.com/casperjs/casperjs
 - https://github.com/casperjs/casperjs/issues/2
 - https://github.com/casperjs/casperjs/tree/master/samples
 - https://github.com/casperjs/casperjs/commits/master/
 - http://www.facebook.com/people/Casper-Js/100000337260665
 - http://www.facebook.com/public/Casper-Js
 - http://hashtags.org/tag/CasperJS/
 - http://www.zerotohundred.com/newforums/members/casper-js.html
 - http://www.yellowpages.com/casper-wy/j-s-enterprises
 - http://local.trib.com/casper+wy/j+s+chinese+restaurant.zq.html
 - http://www.phantomjs.org/
 - http://code.google.com/p/phantomjs/
 - http://code.google.com/p/phantomjs/wiki/QuickStart
 - http://svay.com/blog/index/post/2011/08/31/Paris-JS-10-%3A-Introduction-%C3%A0-PhantomJS
 - https://github.com/ariya/phantomjs
 - http://dailyjs.com/2011/01/28/phantoms/
 - http://css.dzone.com/articles/phantom-js-alternative
 - http://pilvee.com/blog/tag/phantom-js/
 - http://ariya.blogspot.com/2011/01/phantomjs-minimalistic-headless-webkit.html
 - http://www.readwriteweb.com/hack/2011/03/phantomjs-the-power-of-webkit.php

C
catHD, 2017-06-23
@catHD

#!/bin/bash
lynx <url>

The description of the problem is HORRIBLE.

A
Alexey Sergeev, 2017-08-15
@SergeevAI

Cron + GET request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question