ToKeiChun

[Image] URL Grabber from Google Images Search Result

Feb 9th, 2025 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Extract all text content from the page
  2. const text = document.body.innerHTML;
  3.  
  4. // Regular expression to match image URLs
  5. const regex = /,\["(https?:\/\/[^"]+)",\d+,\d+\]/g;
  6.  
  7. let matches = [];
  8. let match;
  9.  
  10. while ((match = regex.exec(text)) !== null) {
  11.     const url = match[1].replace(/\\u003d/g, "=").replace(/\\u0026/g, "&");
  12.    
  13.     // Skip URLs from gstatic.com domain
  14.     if (!url.includes('.gstatic.com')) {
  15.         matches.push(url);
  16.     }
  17. }
  18.  
  19. // Print results to console, filtering out any debugger messages
  20. const cleanedMatches = matches.filter(url => !url.startsWith('debugger'));
  21.  
  22. console.log(cleanedMatches.join('\n'));
Add Comment
Please, Sign In to add comment