Skip to content

Instantly share code, notes, and snippets.

#source: https://www.searchenginejournal.com/google-algorithm-history/
Date,Google Update
2021-06-02,1
2021-04-08,1
2021-02-10,1
2020-12-03,1
2020-05-04,1
2020-01-22,1
2020-01-13,1
@prykon
prykon / sql-query-splitter.py
Last active October 22, 2021 16:12
This script splits your .sql files into files that are roughly under 100 MB.
filename = '' # Add filename here
import os
if os.path.isdir('split_queries'):
print('The \'split_folder\' folder already exists. Splitting query...')
pass
else:
print('Creating \'split_queries\' folder...')
os.mkdir('split_queries')
@prykon
prykon / Google Top Stories.py
Created February 8, 2021 11:10
Scrape Top Stories URLs and titles from Google SERPs.
#Scrape Google SERPs for Top Stories URLs and titles
import requests
from bs4 import BeautifulSoup
keyword = 'keyword goes here'
url = 'https://www.google.com/search?q=%s' % keyword
source = requests.get(url).content
soup = BeautifulSoup(source, 'lxml')
var keyword = $('input[name$="q"]').value
var results = $$('div[class="r"]');
var date = new Date().toISOString().split('T')[0];
var content = '';
for (var i = 0; i < results.length; i++){
var rank = i+1;
var current_url = results[i].innerHTML.match(/<a href="([^"]*)/)[1];
var current_title = results[i].innerHTML.match(/<h3.*?>(.*?)</)[1];
content += '<tr><td>' + date + '</td><td>' + rank + '</td><td>' + keyword + '</td><td>' + current_title + '</td><td class="tdurl">' + current_url + '</td></tr>';
var stopwords = ['algún', 'alguna', 'algunas', 'alguno', 'algunos', 'ambos', 'ampleamos', 'ante', 'antes', 'aquel', 'aquellas', 'aquellos', 'aqui', 'arriba', 'atras', 'bajo', 'bastante', 'bien', 'cada', 'cierta', 'ciertas', 'cierto', 'ciertos', 'como', 'con', 'conseguimos', 'conseguir', 'consigo', 'consigue', 'consiguen', 'consigues', 'cual', 'cuando', 'dentro', 'desde', 'donde', 'dos', 'el', 'ellas', 'ellos', 'empleais', 'emplean', 'emplear', 'empleas', 'empleo', 'en', 'encima', 'entonces', 'entre', 'era', 'eramos', 'eran', 'eras', 'eres', 'es', 'esta', 'estaba', 'estado', 'estais', 'estamos', 'estan', 'estoy', 'fin', 'fue', 'fueron', 'fui', 'fuimos', 'gueno', 'ha', 'hace', 'haceis', 'hacemos', 'hacen', 'hacer', 'haces', 'hago', 'incluso', 'intenta', 'intentais', 'intentamos', 'intentan', 'intentar', 'intentas', 'intento', 'ir', 'la', 'largo', 'las', 'lo', 'los', 'mientras', 'mio', 'modo', 'muchos', 'muy', 'nos', 'nosotros', 'otro', 'para', 'pero', 'podeis', 'podemos', 'poder', 'podria', 'podriais', 'podriam
@prykon
prykon / gsc-keyword-rankings.py
Last active February 11, 2020 14:32
Graficador de Keyword Rankings para data extraída de Google Search Console con Google Data Studio.
import pandas as pd
import matplotlib.pyplot as plt
keywords = ['keyword 1', 'keyword 2', 'keyword 3'] #poné tus keywords acá
rank_limit = 30 #Cantidad de posiciones a analizar
#No hace falta modificar las siguientes líneas
df = pd.read_csv('data.csv')
df['Date'] = pd.to_datetime(df['Date'], format='%Y%m%d')
df = df[df['Query'].isin(keywords)].sort_values(by=['Date'])
@prykon
prykon / google-serp-n-grams.js
Created October 24, 2019 11:26
Extract keyword n-grams from a Google SERP
var stopwords = [
'about', 'after', 'all', 'also', 'am', 'an', 'and', 'another', 'any', 'are', 'as', 'at', 'be',
'because', 'been', 'before', 'being', 'between', 'both', 'but', 'by', 'came', 'can',
'come', 'could', 'did', 'do', 'each', 'for', 'from', 'get', 'got', 'has', 'had',
'he', 'have', 'her', 'here', 'him', 'himself', 'his', 'how', 'if', 'in', 'into',
'is', 'it', 'like', 'make', 'many', 'me', 'might', 'more', 'most', 'much', 'must',
'my', 'never', 'now', 'of', 'on', 'only', 'or', 'other', 'our', 'out', 'over',
'said', 'same', 'see', 'should', 'since', 'some', 'still', 'such', 'take', 'than',
'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'those',
'through', 'to', 'too', 'under', 'up', 'very', 'was', 'way', 'we', 'well', 'were',
@prykon
prykon / categorizar-google-sheets.gs
Last active September 4, 2019 15:46
UDF para Google Sheets que permite categorizar gran cantidad de entradas
function categorizar(slug) {
//Escribí un array para cada categoría y llenalo de keywords
var keywords_tutoriales = [
"tutorial", "how-to", "guide", "step-by-step",
];
var keywords_links = [
"link", "anchor",
];
@prykon
prykon / tfidf.js
Last active July 22, 2021 21:38
TF-IDF SEO function for Google Sheets
/**
* Return the time that the referenced cell or range was last changed.
* Initial use shows current time.
*
* @param {"keyword"} term La keyword a analizar
* @param {"texto"} flow El texto que contiene la keyword
* @param {"corpus"} document Todos los textos de tu sitio
* @param {"verbose"} verbose VERDADERO o FALSO: muestra un detalle del análisis
* @customfunction
*/
@prykon
prykon / slug.gs
Created May 31, 2019 18:51
UDF - SEO Friendly URL Slug
function slug(input) {
input = input.toLowerCase();
input = input.replace(/\s+/g, "-");
input = input.replace(/[&\/\\#,+()$~%.'":*¿?¡!<>{}]/g, '');
return input;
}