mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
28 lines
686 B
TypeScript
28 lines
686 B
TypeScript
import * as GoogleImages from "google-images";
|
|
|
|
const client = new GoogleImages('CSE ID', 'API KEY');
|
|
|
|
client.search('Steve Angello')
|
|
.then(images => {
|
|
/*
|
|
[{
|
|
"url": "http://steveangello.com/boss.jpg",
|
|
"type": "image/jpeg",
|
|
"width": 1024,
|
|
"height": 768,
|
|
"size": 102451,
|
|
"thumbnail": {
|
|
"url": "http://steveangello.com/thumbnail.jpg",
|
|
"width": 512,
|
|
"height": 512
|
|
}
|
|
}]
|
|
*/
|
|
});
|
|
|
|
// paginate results
|
|
client.search('Steve Angello', {page: 2});
|
|
|
|
// search for certain size
|
|
client.search('Steve Angello', {size: 'large'});
|