Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/*Obtenemos el status code*/
function getStatusCode(url){
var options = {
'muteHttpExceptions': true,
'followRedirects': false
var url_trimmed = url.trim();
var response = UrlFetchApp.fetch(url_trimmed, options);
return response.getResponseCode();
/*Obtenemos los elementos que nos intera de la web*/
function getContents(url) {
var result = UrlFetchApp.fetch(url);
var contents = result.getContentText();
return contents;
function Title(url) {
var html = getContents(url);
var title = html.match('<title>([^\<]+)</title>')[1];
return title;
function H1(url) {
var html = getContents(url);
var H1 = html.match('<h1>([^\<]+)</h1>')[1];
return H1;
function Robots(url) {
var html = getContents(url);
var Robots = html.match('<meta name=\"robots\" content=\"([^\<]+)\">')[1];
return Robots;
function Canonical(url){
var html = getContents(url);
var Canonical = html.match('<link .*nonical.* href="([^\<]+)"')[1];
return Canonical;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.