JS consol sript


Adminram

Uploaded on Aug 7, 2025

Category Business

Extract Image link and image alt tag using this script

Category Business

Comments

                     

JS consol sript

(() => { const images = Array.from(document.querySelectorAll("img")); const baseURL = window.location.origin; if (images.length === 0) { console.log("? No tags found on this page."); return; } console.log(`? Found ${images.length} images:\n`); images.forEach((img, index) => { let rawSrc = img.getAttribute("src") || img.getAttribute("data-src") || img.getAttribute("data-lazy") || img.getAttribute("data-original") || ""; // Construct full proxy URL (if relative) const proxyURL = rawSrc.startsWith("http") ? rawSrc : baseURL + rawSrc; // Decode the real image URL if it's in a query param let actualURL = proxyURL; const match = proxyURL.match(/url=([^&]+)/); if (match && match[1]) { actualURL = decodeURIComponent(match[1]); } const alt = img.hasAttribute("alt") ? img.getAttribute("alt").trim() : "? No alt text"; // console.log(`${index + 1}.`); console.log(`Image URL: ${proxyURL}`); console.log(`Alt Text: ${alt}\n`); }); })();