-
Notifications
You must be signed in to change notification settings - Fork 71
/
index.d.ts
76 lines (72 loc) · 1.67 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { LaunchOptions } from 'puppeteer';
export default class Scraper {
constructor(options: Scraper.ScraperOptions);
/**
* Scrape for a given query until we reached the limit.
* @param searchQuery the search query.
* @param limit search limit, defaults to 100
*/
scrape(searchQuery: string | string[], limit?: number): Promise<Array<Scraper.ScrapeResult>>;
}
declare namespace Scraper {
export interface ScraperOptions {
/**
* The user agent when browsing.
* @default "Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64"
*/
userAgent?: string;
/**
* Scroll delay in milliseconds before scrolling down.
* Set to a high value for slow connections.
* @default 500
*/
scrollDelay?: number;
/**
* Extra options to the Puppeteer headless browser API
* @default {}
*/
puppeteer?: LaunchOptions;
/**
* Custom search options
* @default {}
*/
tbs?: SearchOptions;
/**
* Enables/disables safe search
* @default false
*/
safe?: boolean;
}
export interface SearchOptions {
/**
* Icon size, l(arge), m(edium), i(cons), etc.
*/
isz?: string;
/**
* Type, clipart, face, lineart, news, photo
*/
itp?: string;
/**
* Colors, color, gray, trans
*/
ic?: string;
/**
* Commercial options, fmc (commercial reuse with modification), fc (commercial
*/
sur?: string;
}
export interface ScrapeResult {
/**
* The URL for an image.
*/
url: string;
/**
* The source for an image.
*/
source: string;
/**
* Title for an image.
*/
title: string;
}
}