Created
March 16, 2017 01:38
-
-
Save flaviosilveira/457ae829e07b4da25226f24e73596c8b to your computer and use it in GitHub Desktop.
CasperJS Script to grab google popular time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inicia Casper, simulando User Agent | |
var casper = require('casper').create({ | |
pageSettings: { | |
userAgent: 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36' | |
} | |
} | |
); | |
// Vai até o endereço | |
casper.start('https://www.google.com.br/search?q=tuk%20tuk%20curitiba&*', function() { | |
// Pega título | |
this.echo(this.getTitle()); | |
// Tira um print screen | |
this.capture('google.png'); | |
// Retorna todo o HTML da página, incluindo o popular Time. | |
this.echo(this.getHTML()); | |
}); | |
// Roda o casper | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment