Last active
July 31, 2020 09:14
-
-
Save richardcsuwandi/ca7387d01407366b5b62d9b364e07765 to your computer and use it in GitHub Desktop.
Javascript code to scrape Google Images URLs.
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
let urls = Array.from(document.querySelectorAll('.rg_i')).map(el=> el.hasAttribute('data-src')?el.getAttribute('data-src'):el.getAttribute('data-iurl')); | |
let hiddenElement = document.createElement('a'); | |
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(urls.filter((value, index, arr) => { return value != null}).join('\n')); | |
hiddenElement.target = '_blank'; | |
hiddenElement.download = 'download.csv'; | |
hiddenElement.click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment