Last active
January 24, 2022 02:45
-
-
Save thecaffeinedev/5e6d0ff9409344f88248bd8066226f68 to your computer and use it in GitHub Desktop.
Download Image URLs in a file Google Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urls = Array.from(document.querySelectorAll('.rg_di .rg_meta')).map(el=>JSON.parse(el.textContent).ou); | |
window.open('data:text/csv;charset=utf-8,' + escape(urls.join('\n'))); |
Hye @Alpha-T30
Try this code
var urls=Array.from(document.querySelectorAll('.rg_i')).map(el=> el.hasAttribute('data-src')?el.getAttribute('data-src'):el.getAttribute('data-iurl'));
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(urls.join('\n'));
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.txt';
hiddenElement.click();
even this giving an empty file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not working on chrome incognito window , load an empty 'download' file