-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget-image-urls.js
More file actions
20 lines (15 loc) · 837 Bytes
/
get-image-urls.js
File metadata and controls
20 lines (15 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Modified Adrian Rosebrock repo by Britney Muller -- Feb 2019.
// pull down jquery into the JavaScript console
var script = document.createElement('script');
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
// grab the Google Image URLs
var urls = $('.rg_di .rg_meta').map(function() { return JSON.parse($(this).text()).ou; });
// write the image URls to a txt tile (one per line)
var textToSave = urls.toArray().join('\n');
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = 'urls.txt';
hiddenElement.click();
// Find the urls.txt file in your downloads folder. Very useful for labeled training data SOOONNN!