Skip to content

Instantly share code, notes, and snippets.

@natzir
natzir / getSistrixSERPScreenshots.js
Created July 9, 2024 13:26
Get Sistrix SERP Screenshots
javascript:'use%20strict'%3Bfunction%20clickLoadMoreButton()%7Bvar%20d%3Ddocument.querySelector('.js-more-button-container%5Bdata-func%3D%22next%22%5D%3Anot(.disabled)%20.btn')%3Breturn!!d%26%26(d.click()%2C!0)%7Dvar%20intervalId%3DsetInterval(function()%7BclickLoadMoreButton()%7C%7C(clearInterval(intervalId)%2CdownloadImages())%7D%2C400)%3Basync%20function%20downloadImages()%7Bvar%20d%3Ddocument.querySelectorAll(%22.device%22)%3Bfor(let%20e%3D0%3Be%3Cd.length%3Be%2B%2B)%7Bvar%20a%3Dd%5Be%5D%2Cc%3Da.querySelector(%22img.serp-screenshot%22)%3Bif(c%26%26c.src%26%26(c%3Dc.src%2Ca%3Da.querySelector(%22.infos%20.label%22)))%7Ba%3Da.textContent.trim()%3Ba%3Da.replace(%2F%3A%2Fg%2C%22_%22)%3Bvar%20b%3Dc.match(%2Fkeyword%5C%2F(%5B%5E%5C%2F%5D*)%5C%2F%2F)%3Ba%3D%60%24%7Be%2B1%7D-%24%7Bb%3Fb%5B1%5D%3A%22unknown%22%7D-%24%7Ba%7D.jpg%60%3Bb%3Ddocument.createElement(%22a%22)%3Bb.href%3Dc%3Bb.download%3Da%3Bdocument.body.appendChild(b)%3Bb.click()%3Bdocument.body.removeChild(b)%7D0%3D%3D(e%2B1)%2510%26%26await%20new%20Prom
@natzir
natzir / Pseudo-Element-Highlighter-Bookmarklet.js
Created September 25, 2023 08:18
Pseudo-Element Highlighter Bookmarklet
javascript:(function(){function injectStyle(){var style=document.createElement('style');style.type='text/css';style.innerHTML='*::before, *::after {background-color: rgba(255,0,0,0.3) !important;}';document.head.appendChild(style);}injectStyle();})();
@natzir
natzir / Internal-Link-Checker-Bookmarklet.js
Last active February 19, 2024 08:51
Internal Link Checker Bookmarklet
@natzir
natzir / getPercentDiff.js
Last active July 7, 2024 20:37
getPercentDiff.js
javascript:(function()%7Bjavascript%3A!function()%7Bfunction%20e(e)%7Blet%20l%3De.querySelectorAll(%22tr%22)%2Cn%3Dl%5B1%5D%3Bif(!(n%26%26(n.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%20%3E%20span%22)%7C%7Cn.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%20%3E%20span%22))))for(let%20a%3D1%3Ba%3Cl.length%3Ba%2B%2B)%7Blet%20r%3Dl%5Ba%5D%3Br.cells%5B1%5D.getAttribute(%22data-numeric-value%22)%3Blet%20i%3Dr.cells%5B2%5D.getAttribute(%22data-numeric-value%22)%2Cc%3Dr.cells%5B3%5D.getAttribute(%22data-numeric-value%22)%3Br.cells%5B4%5D.getAttribute(%22data-numeric-value%22)%3Blet%20s%3Dr.cells%5B5%5D.getAttribute(%22data-numeric-value%22)%2Co%3Dr.cells%5B6%5D.getAttribute(%22data-numeric-value%22)%2Cd%3Di%2Cu%3Ds%2Cp%3Dt(c%2Cd)%2Ch%3Dt(o%2Cu)%2Cf%3Dr.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%22)%2Cm%3Dr.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%22)%2Cg%3Ddocument.createElement(%22span%22)%2C%24%3Ddocument.createElement(%22span%22)%3Bg.innerText%3D%60%20(
@natzir
natzir / crux-api-bulk.ipynb
Created July 4, 2023 09:10
CrUX-API-bulk.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natzir
natzir / crux-from-google-serp.ipynb
Last active July 2, 2023 09:54
crux-from-google-serp.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var depth = parseInt(prompt("Please enter the scraping depth (we recommend between 1 to 3):", "2"));
if(!Number.isInteger(depth) || depth < 1) {
alert("Invalid depth! Setting depth to default (2).");
depth = 2;
}
var count = 1;
async function start() {
@natzir
natzir / Sistrix-Export-Clusters.js
Created August 9, 2021 13:19
Bookmark to extract Sistrix keyword clusters
javascript:(function(){output="<html><head><title>Sistrix Clusters by @Natzir9</title></head><body><button onclick=\"tableToExcel('sistrixTable','Sistrix Clusters')\">Export Sistrix Clusters</button><table%20id=\"sistrixTable\"><tr><th>Keyword</th><th>Count</th><th>Volume</th></tr>";var myValue=document.getElementById('sidebar').getElementsByClassName('value number');for(var i=0;i<myValue.length;i+=3){output=output+"<tr><td>"+myValue[i].innerText+"</td><td>"+myValue[i+1].innerText+"</td><td>"+Math.round(myValue[i+2].innerText)+"</td></tr>";};output+="</table>";with(window.open()){document.write(output);document.body.appendChild(document.createElement('script')).src='https://bl.ocks.org/insin/raw/1031969/tableToExcel.js';document.close();}})();
@natzir
natzir / google-api-indexing.ipynb
Created November 12, 2020 14:50
Google-API-Indexing.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natzir
natzir / puppeteer-fetch-and-render.js
Last active August 25, 2023 23:44
Fetch and Render as Googlebot
// This code allows you to render a page as Googlebot with puppeter (headless Chrome).
// It even renders elements with the lazy-load implemented through IntersectionObserver.
// Copy and paste it here: https://try-puppeteer.appspot.com/
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Descriptors for other mobile devices: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
const mobile = {
name: 'Nexus 5X',