Skip to content

Instantly share code, notes, and snippets.

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
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',
@natzir
natzir / crux-api-bulk.ipynb
Created July 4, 2023 09:10
CrUX-API-bulk.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 / google-api-indexing.ipynb
Created November 12, 2020 14:50
Google-API-Indexing.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natzir
natzir / Internal-Link-Checker-Bookmarklet.js
Last active February 19, 2024 08:51
Internal Link Checker Bookmarklet
@natzir
natzir / getPercentDiff.js
Last active February 29, 2024 02:16
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 / 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();})();