google-img-scrap 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/constant/GOOGLE_CONSTANT.js +3 -3
- package/dist/constant/GOOGLE_CONSTANT.js.map +1 -1
- package/dist/constant/query/GOOGLE_QUERY.d.ts +1 -1
- package/dist/core/buildGoogleDork.d.ts +1 -1
- package/dist/core/constructGoogleUrl.d.ts +1 -1
- package/dist/core/inverseGetGoogleImageURL.js +2 -0
- package/dist/core/inverseGetGoogleImageURL.js.map +1 -1
- package/dist/core/limitResultSize.d.ts +1 -1
- package/dist/core/parseGoogleImages.d.ts +1 -1
- package/dist/core/parseGoogleImages.js +24 -38
- package/dist/core/parseGoogleImages.js.map +1 -1
- package/dist/core/verifyGoogleQuery.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/types/config.d.ts +22 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/googleQuery.d.ts +49 -0
- package/dist/types/googleQuery.js +3 -0
- package/dist/types/googleQuery.js.map +1 -0
- package/dist/types/imageResultItem.d.ts +9 -0
- package/dist/types/imageResultItem.js +3 -0
- package/dist/types/imageResultItem.js.map +1 -0
- package/{types → dist/types}/results.d.ts +3 -5
- package/dist/types/results.js +3 -0
- package/dist/types/results.js.map +1 -0
- package/package.json +13 -2
- package/tsconfig.json +2 -2
- package/assets/demonSlayer.png +0 -0
- package/example/index.js +0 -10
- package/example/inverseUpload.js +0 -12
- package/example/inverseUrl.js +0 -9
- package/jest.config.ts +0 -10
- package/src/constant/GOOGLE_CONSTANT.ts +0 -18
- package/src/constant/extensions/IMAGES_EXTENSIONS.json +0 -1
- package/src/constant/query/GOOGLE_COLORS.ts +0 -16
- package/src/constant/query/GOOGLE_PARAMS.ts +0 -11
- package/src/constant/query/GOOGLE_QUERY.ts +0 -57
- package/src/core/buildGoogleDork.ts +0 -103
- package/src/core/constructGoogleUrl.ts +0 -24
- package/src/core/getSearchFromGoogleUrl.ts +0 -11
- package/src/core/inverseGetGoogleImageURL.ts +0 -50
- package/src/core/limitResultSize.ts +0 -22
- package/src/core/parseGoogleImages.ts +0 -109
- package/src/core/verifyGoogleQuery.ts +0 -33
- package/src/index.ts +0 -86
- package/src/utils/utils.ts +0 -40
- package/test/domains.test.ts +0 -17
- package/test/excludeDomains.test.ts +0 -19
- package/test/excludeWords.test.ts +0 -14
- package/test/filterByTitles.test.ts +0 -20
- package/test/inverseUpload.test.ts +0 -15
- package/test/inverseUrl.test.ts +0 -11
- package/test/limit.test.ts +0 -18
- package/test/proxy.test.ts +0 -16
- package/test/query.test.ts +0 -18
- package/test/urlMatch.test.ts +0 -21
- package/tsconfig.build.json +0 -4
- package/types/config.d.ts +0 -24
- package/types/googleQuery.d.ts +0 -55
- package/types/imageResultItem.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const GOOGLE_CONSTANT = {
|
|
4
|
-
url: "https://
|
|
4
|
+
url: "https://www.google.com/search",
|
|
5
5
|
inverse: {
|
|
6
6
|
base: "https://lens.google.com/",
|
|
7
|
-
upload: "https://lens.google.com/upload",
|
|
7
|
+
upload: "https://lens.google.com/v3/upload?hl=en-CA&re=df&st=1706741689844&vpw=1067&vph=961&ep=gisbubb",
|
|
8
8
|
url: "https://lens.google.com/uploadbyurl?url=",
|
|
9
9
|
},
|
|
10
10
|
queryParam: "tbs",
|
|
@@ -12,7 +12,7 @@ const GOOGLE_CONSTANT = {
|
|
|
12
12
|
tbm: "isch", //needed to search on google image instead of google
|
|
13
13
|
},
|
|
14
14
|
headers: {
|
|
15
|
-
"User-Agent": "Mozilla/5.0 (
|
|
15
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0",
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
exports.default = GOOGLE_CONSTANT;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GOOGLE_CONSTANT.js","sourceRoot":"","sources":["../../src/constant/GOOGLE_CONSTANT.ts"],"names":[],"mappings":";;AAAA,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE
|
|
1
|
+
{"version":3,"file":"GOOGLE_CONSTANT.js","sourceRoot":"","sources":["../../src/constant/GOOGLE_CONSTANT.ts"],"names":[],"mappings":";;AAAA,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,+BAA+B;IACpC,OAAO,EAAE;QACP,IAAI,EAAE,0BAA0B;QAChC,MAAM,EACJ,+FAA+F;QACjG,GAAG,EAAE,0CAA0C;KAChD;IACD,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,EAAE,oDAAoD;KAClE;IACD,OAAO,EAAE;QACP,YAAY,EACV,+HAA+H;KAClI;CACF,CAAC;AAEF,kBAAe,eAAe,CAAC"}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const axios_1 = __importDefault(require("axios"));
|
|
16
16
|
const GOOGLE_CONSTANT_1 = __importDefault(require("../constant/GOOGLE_CONSTANT"));
|
|
17
17
|
const utils_1 = require("../utils/utils");
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
19
|
/**
|
|
19
20
|
* Return google images url from lens.google.com inverse search image engine
|
|
20
21
|
* @param url
|
|
@@ -31,6 +32,7 @@ function inverseGetGoogleImageURL(url, proxy, formData) {
|
|
|
31
32
|
}
|
|
32
33
|
//we scrap google lens to get the original google image search
|
|
33
34
|
const data = (yield axios_1.default.get(url, Object.assign({ headers: GOOGLE_CONSTANT_1.default.headers }, (proxy !== null && proxy !== void 0 ? proxy : {})))).data;
|
|
35
|
+
fs_1.default.writeFileSync("tttt.txt", data, "utf-8");
|
|
34
36
|
const urlStr = data.match(/https:\/\/www.google.com\/search\?q[^"]+/gi)[0];
|
|
35
37
|
return ((0, utils_1.unicodeToChar)(urlStr) +
|
|
36
38
|
"&" +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverseGetGoogleImageURL.js","sourceRoot":"","sources":["../../src/core/inverseGetGoogleImageURL.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,kFAA0D;AAC1D,0CAA+C;
|
|
1
|
+
{"version":3,"file":"inverseGetGoogleImageURL.js","sourceRoot":"","sources":["../../src/core/inverseGetGoogleImageURL.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,kFAA0D;AAC1D,0CAA+C;AAG/C,4CAAoB;AAEpB;;;;;GAKG;AACH,SAAe,wBAAwB,CACrC,GAAW,EACX,KAAwB,EACxB,QAAmB;;QAEnB,IAAI,QAAQ,EAAE;YACZ,oCAAoC;YACpC,MAAM,IAAI,GAAG,CACX,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,kBAC5B,OAAO,kCACF,yBAAe,CAAC,OAAO,GACvB,QAAQ,CAAC,UAAU,EAAE,KAEvB,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,EAChB,CACH,CAAC,IAAI,CAAC;YACP,8CAA8C;YAC9C,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3D;QAED,8DAA8D;QAC9D,MAAM,IAAI,GAAG,CACX,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,kBACjB,OAAO,EAAE,yBAAe,CAAC,OAAO,IAC7B,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,EAChB,CACH,CAAC,IAAI,CAAC;QAEP,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3E,OAAO,CACL,IAAA,qBAAa,EAAC,MAAM,CAAC;YACrB,GAAG;YACH,MAAM,CAAC,OAAO,CAAC,yBAAe,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAClE,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,wBAAwB,CAAC"}
|
|
@@ -21,31 +21,24 @@ const { FastHTMLParser } = require("fast-html-dom-parser");
|
|
|
21
21
|
* @param url
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
function
|
|
24
|
+
function scrapGoogleImages(url, proxy) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
const { data } = yield (0, axios_1.default)(url, Object.assign({ headers: GOOGLE_CONSTANT_1.default.headers }, (proxy !== null && proxy !== void 0 ? proxy : {})));
|
|
27
|
-
|
|
28
|
-
const scripts = parser.getElementsByTagName("script");
|
|
29
|
-
return scripts;
|
|
27
|
+
return data;
|
|
30
28
|
});
|
|
31
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Construct the final object image from regex match with all informations
|
|
32
|
+
* @param informationsMatch
|
|
33
|
+
* @param otherInformationsMatch
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
32
36
|
function getGoogleImageObject(informationsMatch, otherInformationsMatch) {
|
|
33
|
-
const [r, g, b] = [
|
|
34
|
-
informationsMatch[4],
|
|
35
|
-
informationsMatch[5],
|
|
36
|
-
informationsMatch[6],
|
|
37
|
-
].map((e) => parseInt(e, 10));
|
|
38
37
|
return {
|
|
39
38
|
id: otherInformationsMatch[1],
|
|
40
39
|
title: otherInformationsMatch[3],
|
|
41
40
|
url: (0, utils_1.unicodeToChar)(informationsMatch[1]),
|
|
42
41
|
originalUrl: otherInformationsMatch[2],
|
|
43
|
-
averageColor: `rgb(${r}, ${g}, ${b})`,
|
|
44
|
-
averageColorObject: {
|
|
45
|
-
r,
|
|
46
|
-
g,
|
|
47
|
-
b,
|
|
48
|
-
},
|
|
49
42
|
height: parseInt(informationsMatch[2], 10),
|
|
50
43
|
width: parseInt(informationsMatch[3], 10),
|
|
51
44
|
};
|
|
@@ -58,31 +51,24 @@ function getGoogleImageObject(informationsMatch, otherInformationsMatch) {
|
|
|
58
51
|
function parseGoogleImages(url, proxy) {
|
|
59
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
53
|
const result = [];
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
const body = yield scrapGoogleImages(url, proxy);
|
|
55
|
+
//getting image url, height, width, color average
|
|
56
|
+
const informationsRegex = /\["(http[^"]+?)",(\d+),(\d+)\]/gi;
|
|
57
|
+
//getting originalUrl, title, id
|
|
58
|
+
const otherInformationsRegex = /\[[\w\d]+?,"([^"]+?)","(http[^"]+?)","([^"]+?)"/gi;
|
|
59
|
+
let informationsMatch;
|
|
60
|
+
while ((informationsMatch = informationsRegex.exec(body)) !== null) {
|
|
61
|
+
if (informationsMatch[1].startsWith("https://encrypted-tbn0.gstatic.com"))
|
|
68
62
|
continue;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//getting originalUrl, title, id
|
|
72
|
-
const otherInformationsRegex = /\[[\w\d]+?,"([^"]+?)","(http[^"]+?)","([^"]+?)"/gi;
|
|
73
|
-
let informationsMatch, otherInformationsMatch;
|
|
74
|
-
while ((informationsMatch = informationsRegex.exec(body)) !== null &&
|
|
75
|
-
(otherInformationsMatch = otherInformationsRegex.exec(body)) !== null) {
|
|
76
|
-
if (informationsMatch.length < 4 || otherInformationsMatch.length < 4)
|
|
77
|
-
continue;
|
|
78
|
-
if (informationsMatch[1].match(/http/gi).length > 2 ||
|
|
79
|
-
otherInformationsMatch[2].match(/http/gi).length > 2)
|
|
80
|
-
continue;
|
|
81
|
-
result.push(getGoogleImageObject(informationsMatch, otherInformationsMatch));
|
|
82
|
-
}
|
|
83
|
-
//if we get the correct scripts with all images we can exit
|
|
84
|
-
if (result.length > 0)
|
|
63
|
+
const otherInformationsMatch = otherInformationsRegex.exec(body);
|
|
64
|
+
if (otherInformationsMatch === null)
|
|
85
65
|
return result;
|
|
66
|
+
if (informationsMatch.length < 4 || otherInformationsMatch.length < 4)
|
|
67
|
+
continue;
|
|
68
|
+
if (informationsMatch[1].match(/http/gi).length > 2 ||
|
|
69
|
+
otherInformationsMatch[2].match(/http/gi).length > 2)
|
|
70
|
+
continue;
|
|
71
|
+
result.push(getGoogleImageObject(informationsMatch, otherInformationsMatch));
|
|
86
72
|
}
|
|
87
73
|
return result;
|
|
88
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseGoogleImages.js","sourceRoot":"","sources":["../../src/core/parseGoogleImages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"parseGoogleImages.js","sourceRoot":"","sources":["../../src/core/parseGoogleImages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0CAA+C;AAC/C,kFAA0D;AAC1D,kDAAgD;AAIhD,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE3D;;;;GAIG;AACH,SAAe,iBAAiB,CAAC,GAAW,EAAE,KAAwB;;QACpE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,eAAK,EAAC,GAAG,kBAC9B,OAAO,EAAE,yBAAe,CAAC,OAAO,IAC7B,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,EAChB,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAED;;;;;GAKG;AACH,SAAS,oBAAoB,CAC3B,iBAAkC,EAClC,sBAAuC;IAEvC,OAAO;QACL,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAC7B,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAChC,GAAG,EAAE,IAAA,qBAAa,EAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACxC,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC;QACtC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAe,iBAAiB,CAC9B,GAAW,EACX,KAAwB;;QAExB,MAAM,MAAM,GAAsB,EAAE,CAAC;QAErC,MAAM,IAAI,GAAW,MAAM,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAEzD,iDAAiD;QACjD,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;QAC7D,gCAAgC;QAChC,MAAM,sBAAsB,GAC1B,mDAAmD,CAAC;QAEtD,IAAI,iBAAkC,CAAC;QAEvC,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE;YAClE,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,oCAAoC,CAAC;gBACvE,SAAS;YAEX,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEjE,IAAI,sBAAsB,KAAK,IAAI;gBAAE,OAAO,MAAM,CAAC;YAEnD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC;gBACnE,SAAS;YACX,IACE,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;gBAC/C,sBAAsB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;gBAEpD,SAAS;YAEX,MAAM,CAAC,IAAI,CACT,oBAAoB,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAChE,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAED,kBAAe,iBAAiB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import Config from "
|
|
3
|
-
import Results from "
|
|
2
|
+
import Config from "./types/config";
|
|
3
|
+
import Results from "./types/results";
|
|
4
4
|
import GOOGLE_QUERY from "./constant/query/GOOGLE_QUERY";
|
|
5
5
|
/**
|
|
6
6
|
* Inverse google image search engine with image buffer
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AxiosProxyConfig } from "axios";
|
|
2
|
+
type Config = {
|
|
3
|
+
search: string;
|
|
4
|
+
proxy?: AxiosProxyConfig;
|
|
5
|
+
limit?: number;
|
|
6
|
+
query?: {
|
|
7
|
+
TYPE?: string;
|
|
8
|
+
DATE?: string;
|
|
9
|
+
COLOR?: string;
|
|
10
|
+
SIZE?: string;
|
|
11
|
+
LICENCE?: string;
|
|
12
|
+
EXTENSION?: string;
|
|
13
|
+
};
|
|
14
|
+
urlMatch?: string[][];
|
|
15
|
+
domains?: string[];
|
|
16
|
+
excludeWords?: string[];
|
|
17
|
+
custom?: string;
|
|
18
|
+
safeSearch?: boolean;
|
|
19
|
+
excludeDomains?: string[];
|
|
20
|
+
filterByTitles?: string[][];
|
|
21
|
+
};
|
|
22
|
+
export default Config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
type GoogleQuery = {
|
|
2
|
+
SIZE: {
|
|
3
|
+
LARGE: string;
|
|
4
|
+
MEDIUM: string;
|
|
5
|
+
ICON: string;
|
|
6
|
+
};
|
|
7
|
+
COLOR: {
|
|
8
|
+
BLACK_AND_WHITE: string;
|
|
9
|
+
TRANSPARENT: string;
|
|
10
|
+
RED: string;
|
|
11
|
+
BLUE: string;
|
|
12
|
+
PURPLE: string;
|
|
13
|
+
ORANGE: string;
|
|
14
|
+
YELLOW: string;
|
|
15
|
+
GREEN: string;
|
|
16
|
+
TEAL: string;
|
|
17
|
+
PINK: string;
|
|
18
|
+
WHITE: string;
|
|
19
|
+
GRAY: string;
|
|
20
|
+
BLACK: string;
|
|
21
|
+
BROWN: string;
|
|
22
|
+
};
|
|
23
|
+
TYPE: {
|
|
24
|
+
CLIPART: string;
|
|
25
|
+
DRAW: string;
|
|
26
|
+
GIF: string;
|
|
27
|
+
};
|
|
28
|
+
EXTENSION: {
|
|
29
|
+
JPG: "jpg";
|
|
30
|
+
GIF: "gif";
|
|
31
|
+
BMP: "bmp";
|
|
32
|
+
PNG: "png";
|
|
33
|
+
SVG: "svg";
|
|
34
|
+
WEBP: "webp";
|
|
35
|
+
ICO: "ico";
|
|
36
|
+
RAW: "raw";
|
|
37
|
+
};
|
|
38
|
+
DATE: {
|
|
39
|
+
DAY: string;
|
|
40
|
+
WEEK: string;
|
|
41
|
+
MONTH: string;
|
|
42
|
+
YEAR: string;
|
|
43
|
+
};
|
|
44
|
+
LICENCE: {
|
|
45
|
+
CREATIVE_COMMONS: string;
|
|
46
|
+
COMMERCIAL_AND_OTHER: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export default GoogleQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"googleQuery.js","sourceRoot":"","sources":["../../src/types/googleQuery.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageResultItem.js","sourceRoot":"","sources":["../../src/types/imageResultItem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/types/results.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-img-scrap",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Scrap images from google images with customs pre filled google dork options",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"example": "node ./example/index.js",
|
|
9
9
|
"build": "tsc",
|
|
10
|
-
"test": "jest"
|
|
10
|
+
"test": "jest --colors"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"README.md",
|
|
16
|
+
"tsconfig.json",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
12
19
|
"repository": {
|
|
13
20
|
"type": "git",
|
|
14
21
|
"url": "git+https://github.com/yoannchb-pro/google-img-scrap.git"
|
|
@@ -18,6 +25,10 @@
|
|
|
18
25
|
"image",
|
|
19
26
|
"scrap",
|
|
20
27
|
"options",
|
|
28
|
+
"google-scrap",
|
|
29
|
+
"dork",
|
|
30
|
+
"google-dork",
|
|
31
|
+
"reverse-search-engine",
|
|
21
32
|
"query",
|
|
22
33
|
"powerfull",
|
|
23
34
|
"easy",
|
package/tsconfig.json
CHANGED
package/assets/demonSlayer.png
DELETED
|
Binary file
|
package/example/index.js
DELETED
package/example/inverseUpload.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const { GOOGLE_IMG_INVERSE_ENGINE_UPLOAD } = require("../dist");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
(async function () {
|
|
6
|
-
const image = fs.readFileSync(
|
|
7
|
-
path.resolve(__dirname, "../assets/demonSlayer.png")
|
|
8
|
-
);
|
|
9
|
-
const test = await GOOGLE_IMG_INVERSE_ENGINE_UPLOAD(image);
|
|
10
|
-
|
|
11
|
-
console.log(test, test.result.length);
|
|
12
|
-
})();
|
package/example/inverseUrl.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const { GOOGLE_IMG_INVERSE_ENGINE_URL } = require("../dist");
|
|
2
|
-
|
|
3
|
-
(async function () {
|
|
4
|
-
const test = await GOOGLE_IMG_INVERSE_ENGINE_URL(
|
|
5
|
-
"https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_3x4.jpg"
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
console.log(test, test.result.length);
|
|
9
|
-
})();
|
package/jest.config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const GOOGLE_CONSTANT = {
|
|
2
|
-
url: "https://images.google.com/search",
|
|
3
|
-
inverse: {
|
|
4
|
-
base: "https://lens.google.com/",
|
|
5
|
-
upload: "https://lens.google.com/upload",
|
|
6
|
-
url: "https://lens.google.com/uploadbyurl?url=",
|
|
7
|
-
},
|
|
8
|
-
queryParam: "tbs",
|
|
9
|
-
forceGoogleImage: {
|
|
10
|
-
tbm: "isch", //needed to search on google image instead of google
|
|
11
|
-
},
|
|
12
|
-
headers: {
|
|
13
|
-
"User-Agent":
|
|
14
|
-
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default GOOGLE_CONSTANT;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
["jpg", "gif", "bmp", "png", "svg", "webp", "ico", "raw"]
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import GOOGLE_PARAMS from "./GOOGLE_PARAMS";
|
|
2
|
-
import COLORS from "./GOOGLE_COLORS";
|
|
3
|
-
import EXTENSIONS from "../extensions/IMAGES_EXTENSIONS.json";
|
|
4
|
-
import GoogleQuery from "../../../types/googleQuery";
|
|
5
|
-
|
|
6
|
-
const GOOGLE_QUERY = {
|
|
7
|
-
SIZE: {
|
|
8
|
-
LARGE: GOOGLE_PARAMS.SIZE + ":l",
|
|
9
|
-
MEDIUM: GOOGLE_PARAMS.SIZE + ":m",
|
|
10
|
-
ICON: GOOGLE_PARAMS.SIZE + ":i",
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
COLOR: {
|
|
14
|
-
BLACK_AND_WHITE: GOOGLE_PARAMS.COLOR + ":gray",
|
|
15
|
-
TRANSPARENT: GOOGLE_PARAMS.COLOR + ":trans",
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
TYPE: {
|
|
19
|
-
CLIPART: GOOGLE_PARAMS.TYPE + ":clipart",
|
|
20
|
-
DRAW: GOOGLE_PARAMS.TYPE + ":lineart",
|
|
21
|
-
GIF: GOOGLE_PARAMS.TYPE + ":animated",
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
EXTENSION: {},
|
|
25
|
-
|
|
26
|
-
DATE: {
|
|
27
|
-
DAY: GOOGLE_PARAMS.DATE + ":d",
|
|
28
|
-
WEEK: GOOGLE_PARAMS.DATE + ":w",
|
|
29
|
-
MONTH: GOOGLE_PARAMS.DATE + ":m",
|
|
30
|
-
YEAR: GOOGLE_PARAMS.DATE + ":y",
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
LICENCE: {
|
|
34
|
-
CREATIVE_COMMONS: GOOGLE_PARAMS.LICENCE + ":cl",
|
|
35
|
-
COMMERCIAL_AND_OTHER: GOOGLE_PARAMS.LICENCE + ":ol",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
//build extension
|
|
40
|
-
for (const EXTENSION of EXTENSIONS) {
|
|
41
|
-
const queryName = EXTENSION.toUpperCase();
|
|
42
|
-
(GOOGLE_QUERY as any).EXTENSION[queryName] =
|
|
43
|
-
GOOGLE_PARAMS.IMAGE_EXTENSION + ":" + EXTENSION;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//build colors
|
|
47
|
-
for (const COLOR of COLORS) {
|
|
48
|
-
const queryName = COLOR.toUpperCase();
|
|
49
|
-
(GOOGLE_QUERY as any).COLOR[queryName] =
|
|
50
|
-
GOOGLE_PARAMS.COLOR +
|
|
51
|
-
":specific," +
|
|
52
|
-
GOOGLE_PARAMS.SPECIFIC_COLOR +
|
|
53
|
-
":" +
|
|
54
|
-
COLOR;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default GOOGLE_QUERY as GoogleQuery;
|