zhlajiex
commited on
Commit
·
90a4922
1
Parent(s):
44c2758
Fix: Stabilize key-free search tool with random User-Agents and Cheerio parsing
Browse files- backend/package-lock.json +304 -0
- backend/package.json +1 -0
- backend/utils/webSearch.js +41 -19
backend/package-lock.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
"@seald-io/nedb": "^4.1.2",
|
| 14 |
"axios": "^1.13.2",
|
| 15 |
"bcryptjs": "^3.0.3",
|
|
|
|
| 16 |
"cookie-parser": "^1.4.7",
|
| 17 |
"cors": "^2.8.6",
|
| 18 |
"dotenv": "^17.2.3",
|
|
@@ -464,6 +465,12 @@
|
|
| 464 |
"url": "https://opencollective.com/express"
|
| 465 |
}
|
| 466 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
"node_modules/brace-expansion": {
|
| 468 |
"version": "1.1.12",
|
| 469 |
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
|
@@ -606,6 +613,48 @@
|
|
| 606 |
"node": ">=8"
|
| 607 |
}
|
| 608 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 609 |
"node_modules/chokidar": {
|
| 610 |
"version": "3.6.0",
|
| 611 |
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
|
@@ -792,6 +841,34 @@
|
|
| 792 |
"url": "https://opencollective.com/express"
|
| 793 |
}
|
| 794 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 795 |
"node_modules/debug": {
|
| 796 |
"version": "4.4.3",
|
| 797 |
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
@@ -844,6 +921,61 @@
|
|
| 844 |
"node": ">= 0.8"
|
| 845 |
}
|
| 846 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
"node_modules/dotenv": {
|
| 848 |
"version": "17.2.3",
|
| 849 |
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
|
|
@@ -901,6 +1033,31 @@
|
|
| 901 |
"node": ">= 0.8"
|
| 902 |
}
|
| 903 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
"node_modules/engine.io": {
|
| 905 |
"version": "6.6.5",
|
| 906 |
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.5.tgz",
|
|
@@ -973,6 +1130,18 @@
|
|
| 973 |
"node": ">= 0.6"
|
| 974 |
}
|
| 975 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 976 |
"node_modules/es-define-property": {
|
| 977 |
"version": "1.0.1",
|
| 978 |
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
|
@@ -1418,6 +1587,37 @@
|
|
| 1418 |
"node": ">=18.0.0"
|
| 1419 |
}
|
| 1420 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1421 |
"node_modules/http-errors": {
|
| 1422 |
"version": "2.0.1",
|
| 1423 |
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
|
@@ -2139,6 +2339,18 @@
|
|
| 2139 |
"node": ">=0.10.0"
|
| 2140 |
}
|
| 2141 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2142 |
"node_modules/oauth": {
|
| 2143 |
"version": "0.10.2",
|
| 2144 |
"resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.2.tgz",
|
|
@@ -2196,6 +2408,55 @@
|
|
| 2196 |
"opencollective-postinstall": "index.js"
|
| 2197 |
}
|
| 2198 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2199 |
"node_modules/parseurl": {
|
| 2200 |
"version": "1.3.3",
|
| 2201 |
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
@@ -2982,6 +3243,15 @@
|
|
| 2982 |
"dev": true,
|
| 2983 |
"license": "MIT"
|
| 2984 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2985 |
"node_modules/undici-types": {
|
| 2986 |
"version": "7.16.0",
|
| 2987 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
|
@@ -3058,6 +3328,40 @@
|
|
| 3058 |
"node": ">=12"
|
| 3059 |
}
|
| 3060 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3061 |
"node_modules/whatwg-url": {
|
| 3062 |
"version": "14.2.0",
|
| 3063 |
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
|
|
|
|
| 13 |
"@seald-io/nedb": "^4.1.2",
|
| 14 |
"axios": "^1.13.2",
|
| 15 |
"bcryptjs": "^3.0.3",
|
| 16 |
+
"cheerio": "^1.2.0",
|
| 17 |
"cookie-parser": "^1.4.7",
|
| 18 |
"cors": "^2.8.6",
|
| 19 |
"dotenv": "^17.2.3",
|
|
|
|
| 465 |
"url": "https://opencollective.com/express"
|
| 466 |
}
|
| 467 |
},
|
| 468 |
+
"node_modules/boolbase": {
|
| 469 |
+
"version": "1.0.0",
|
| 470 |
+
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
| 471 |
+
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
|
| 472 |
+
"license": "ISC"
|
| 473 |
+
},
|
| 474 |
"node_modules/brace-expansion": {
|
| 475 |
"version": "1.1.12",
|
| 476 |
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
|
|
|
| 613 |
"node": ">=8"
|
| 614 |
}
|
| 615 |
},
|
| 616 |
+
"node_modules/cheerio": {
|
| 617 |
+
"version": "1.2.0",
|
| 618 |
+
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.2.0.tgz",
|
| 619 |
+
"integrity": "sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==",
|
| 620 |
+
"license": "MIT",
|
| 621 |
+
"dependencies": {
|
| 622 |
+
"cheerio-select": "^2.1.0",
|
| 623 |
+
"dom-serializer": "^2.0.0",
|
| 624 |
+
"domhandler": "^5.0.3",
|
| 625 |
+
"domutils": "^3.2.2",
|
| 626 |
+
"encoding-sniffer": "^0.2.1",
|
| 627 |
+
"htmlparser2": "^10.1.0",
|
| 628 |
+
"parse5": "^7.3.0",
|
| 629 |
+
"parse5-htmlparser2-tree-adapter": "^7.1.0",
|
| 630 |
+
"parse5-parser-stream": "^7.1.2",
|
| 631 |
+
"undici": "^7.19.0",
|
| 632 |
+
"whatwg-mimetype": "^4.0.0"
|
| 633 |
+
},
|
| 634 |
+
"engines": {
|
| 635 |
+
"node": ">=20.18.1"
|
| 636 |
+
},
|
| 637 |
+
"funding": {
|
| 638 |
+
"url": "https://github.com/cheeriojs/cheerio?sponsor=1"
|
| 639 |
+
}
|
| 640 |
+
},
|
| 641 |
+
"node_modules/cheerio-select": {
|
| 642 |
+
"version": "2.1.0",
|
| 643 |
+
"resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz",
|
| 644 |
+
"integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==",
|
| 645 |
+
"license": "BSD-2-Clause",
|
| 646 |
+
"dependencies": {
|
| 647 |
+
"boolbase": "^1.0.0",
|
| 648 |
+
"css-select": "^5.1.0",
|
| 649 |
+
"css-what": "^6.1.0",
|
| 650 |
+
"domelementtype": "^2.3.0",
|
| 651 |
+
"domhandler": "^5.0.3",
|
| 652 |
+
"domutils": "^3.0.1"
|
| 653 |
+
},
|
| 654 |
+
"funding": {
|
| 655 |
+
"url": "https://github.com/sponsors/fb55"
|
| 656 |
+
}
|
| 657 |
+
},
|
| 658 |
"node_modules/chokidar": {
|
| 659 |
"version": "3.6.0",
|
| 660 |
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
|
|
|
| 841 |
"url": "https://opencollective.com/express"
|
| 842 |
}
|
| 843 |
},
|
| 844 |
+
"node_modules/css-select": {
|
| 845 |
+
"version": "5.2.2",
|
| 846 |
+
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",
|
| 847 |
+
"integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",
|
| 848 |
+
"license": "BSD-2-Clause",
|
| 849 |
+
"dependencies": {
|
| 850 |
+
"boolbase": "^1.0.0",
|
| 851 |
+
"css-what": "^6.1.0",
|
| 852 |
+
"domhandler": "^5.0.2",
|
| 853 |
+
"domutils": "^3.0.1",
|
| 854 |
+
"nth-check": "^2.0.1"
|
| 855 |
+
},
|
| 856 |
+
"funding": {
|
| 857 |
+
"url": "https://github.com/sponsors/fb55"
|
| 858 |
+
}
|
| 859 |
+
},
|
| 860 |
+
"node_modules/css-what": {
|
| 861 |
+
"version": "6.2.2",
|
| 862 |
+
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",
|
| 863 |
+
"integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",
|
| 864 |
+
"license": "BSD-2-Clause",
|
| 865 |
+
"engines": {
|
| 866 |
+
"node": ">= 6"
|
| 867 |
+
},
|
| 868 |
+
"funding": {
|
| 869 |
+
"url": "https://github.com/sponsors/fb55"
|
| 870 |
+
}
|
| 871 |
+
},
|
| 872 |
"node_modules/debug": {
|
| 873 |
"version": "4.4.3",
|
| 874 |
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
|
|
| 921 |
"node": ">= 0.8"
|
| 922 |
}
|
| 923 |
},
|
| 924 |
+
"node_modules/dom-serializer": {
|
| 925 |
+
"version": "2.0.0",
|
| 926 |
+
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
| 927 |
+
"integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
|
| 928 |
+
"license": "MIT",
|
| 929 |
+
"dependencies": {
|
| 930 |
+
"domelementtype": "^2.3.0",
|
| 931 |
+
"domhandler": "^5.0.2",
|
| 932 |
+
"entities": "^4.2.0"
|
| 933 |
+
},
|
| 934 |
+
"funding": {
|
| 935 |
+
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
|
| 936 |
+
}
|
| 937 |
+
},
|
| 938 |
+
"node_modules/domelementtype": {
|
| 939 |
+
"version": "2.3.0",
|
| 940 |
+
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
| 941 |
+
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
|
| 942 |
+
"funding": [
|
| 943 |
+
{
|
| 944 |
+
"type": "github",
|
| 945 |
+
"url": "https://github.com/sponsors/fb55"
|
| 946 |
+
}
|
| 947 |
+
],
|
| 948 |
+
"license": "BSD-2-Clause"
|
| 949 |
+
},
|
| 950 |
+
"node_modules/domhandler": {
|
| 951 |
+
"version": "5.0.3",
|
| 952 |
+
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
|
| 953 |
+
"integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
|
| 954 |
+
"license": "BSD-2-Clause",
|
| 955 |
+
"dependencies": {
|
| 956 |
+
"domelementtype": "^2.3.0"
|
| 957 |
+
},
|
| 958 |
+
"engines": {
|
| 959 |
+
"node": ">= 4"
|
| 960 |
+
},
|
| 961 |
+
"funding": {
|
| 962 |
+
"url": "https://github.com/fb55/domhandler?sponsor=1"
|
| 963 |
+
}
|
| 964 |
+
},
|
| 965 |
+
"node_modules/domutils": {
|
| 966 |
+
"version": "3.2.2",
|
| 967 |
+
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz",
|
| 968 |
+
"integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==",
|
| 969 |
+
"license": "BSD-2-Clause",
|
| 970 |
+
"dependencies": {
|
| 971 |
+
"dom-serializer": "^2.0.0",
|
| 972 |
+
"domelementtype": "^2.3.0",
|
| 973 |
+
"domhandler": "^5.0.3"
|
| 974 |
+
},
|
| 975 |
+
"funding": {
|
| 976 |
+
"url": "https://github.com/fb55/domutils?sponsor=1"
|
| 977 |
+
}
|
| 978 |
+
},
|
| 979 |
"node_modules/dotenv": {
|
| 980 |
"version": "17.2.3",
|
| 981 |
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
|
|
|
|
| 1033 |
"node": ">= 0.8"
|
| 1034 |
}
|
| 1035 |
},
|
| 1036 |
+
"node_modules/encoding-sniffer": {
|
| 1037 |
+
"version": "0.2.1",
|
| 1038 |
+
"resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz",
|
| 1039 |
+
"integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==",
|
| 1040 |
+
"license": "MIT",
|
| 1041 |
+
"dependencies": {
|
| 1042 |
+
"iconv-lite": "^0.6.3",
|
| 1043 |
+
"whatwg-encoding": "^3.1.1"
|
| 1044 |
+
},
|
| 1045 |
+
"funding": {
|
| 1046 |
+
"url": "https://github.com/fb55/encoding-sniffer?sponsor=1"
|
| 1047 |
+
}
|
| 1048 |
+
},
|
| 1049 |
+
"node_modules/encoding-sniffer/node_modules/iconv-lite": {
|
| 1050 |
+
"version": "0.6.3",
|
| 1051 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
| 1052 |
+
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
| 1053 |
+
"license": "MIT",
|
| 1054 |
+
"dependencies": {
|
| 1055 |
+
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
| 1056 |
+
},
|
| 1057 |
+
"engines": {
|
| 1058 |
+
"node": ">=0.10.0"
|
| 1059 |
+
}
|
| 1060 |
+
},
|
| 1061 |
"node_modules/engine.io": {
|
| 1062 |
"version": "6.6.5",
|
| 1063 |
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.5.tgz",
|
|
|
|
| 1130 |
"node": ">= 0.6"
|
| 1131 |
}
|
| 1132 |
},
|
| 1133 |
+
"node_modules/entities": {
|
| 1134 |
+
"version": "4.5.0",
|
| 1135 |
+
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
| 1136 |
+
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
| 1137 |
+
"license": "BSD-2-Clause",
|
| 1138 |
+
"engines": {
|
| 1139 |
+
"node": ">=0.12"
|
| 1140 |
+
},
|
| 1141 |
+
"funding": {
|
| 1142 |
+
"url": "https://github.com/fb55/entities?sponsor=1"
|
| 1143 |
+
}
|
| 1144 |
+
},
|
| 1145 |
"node_modules/es-define-property": {
|
| 1146 |
"version": "1.0.1",
|
| 1147 |
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
|
|
|
| 1587 |
"node": ">=18.0.0"
|
| 1588 |
}
|
| 1589 |
},
|
| 1590 |
+
"node_modules/htmlparser2": {
|
| 1591 |
+
"version": "10.1.0",
|
| 1592 |
+
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz",
|
| 1593 |
+
"integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==",
|
| 1594 |
+
"funding": [
|
| 1595 |
+
"https://github.com/fb55/htmlparser2?sponsor=1",
|
| 1596 |
+
{
|
| 1597 |
+
"type": "github",
|
| 1598 |
+
"url": "https://github.com/sponsors/fb55"
|
| 1599 |
+
}
|
| 1600 |
+
],
|
| 1601 |
+
"license": "MIT",
|
| 1602 |
+
"dependencies": {
|
| 1603 |
+
"domelementtype": "^2.3.0",
|
| 1604 |
+
"domhandler": "^5.0.3",
|
| 1605 |
+
"domutils": "^3.2.2",
|
| 1606 |
+
"entities": "^7.0.1"
|
| 1607 |
+
}
|
| 1608 |
+
},
|
| 1609 |
+
"node_modules/htmlparser2/node_modules/entities": {
|
| 1610 |
+
"version": "7.0.1",
|
| 1611 |
+
"resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
|
| 1612 |
+
"integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",
|
| 1613 |
+
"license": "BSD-2-Clause",
|
| 1614 |
+
"engines": {
|
| 1615 |
+
"node": ">=0.12"
|
| 1616 |
+
},
|
| 1617 |
+
"funding": {
|
| 1618 |
+
"url": "https://github.com/fb55/entities?sponsor=1"
|
| 1619 |
+
}
|
| 1620 |
+
},
|
| 1621 |
"node_modules/http-errors": {
|
| 1622 |
"version": "2.0.1",
|
| 1623 |
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
|
|
|
| 2339 |
"node": ">=0.10.0"
|
| 2340 |
}
|
| 2341 |
},
|
| 2342 |
+
"node_modules/nth-check": {
|
| 2343 |
+
"version": "2.1.1",
|
| 2344 |
+
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
|
| 2345 |
+
"integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
|
| 2346 |
+
"license": "BSD-2-Clause",
|
| 2347 |
+
"dependencies": {
|
| 2348 |
+
"boolbase": "^1.0.0"
|
| 2349 |
+
},
|
| 2350 |
+
"funding": {
|
| 2351 |
+
"url": "https://github.com/fb55/nth-check?sponsor=1"
|
| 2352 |
+
}
|
| 2353 |
+
},
|
| 2354 |
"node_modules/oauth": {
|
| 2355 |
"version": "0.10.2",
|
| 2356 |
"resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.2.tgz",
|
|
|
|
| 2408 |
"opencollective-postinstall": "index.js"
|
| 2409 |
}
|
| 2410 |
},
|
| 2411 |
+
"node_modules/parse5": {
|
| 2412 |
+
"version": "7.3.0",
|
| 2413 |
+
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
|
| 2414 |
+
"integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
|
| 2415 |
+
"license": "MIT",
|
| 2416 |
+
"dependencies": {
|
| 2417 |
+
"entities": "^6.0.0"
|
| 2418 |
+
},
|
| 2419 |
+
"funding": {
|
| 2420 |
+
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
| 2421 |
+
}
|
| 2422 |
+
},
|
| 2423 |
+
"node_modules/parse5-htmlparser2-tree-adapter": {
|
| 2424 |
+
"version": "7.1.0",
|
| 2425 |
+
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz",
|
| 2426 |
+
"integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==",
|
| 2427 |
+
"license": "MIT",
|
| 2428 |
+
"dependencies": {
|
| 2429 |
+
"domhandler": "^5.0.3",
|
| 2430 |
+
"parse5": "^7.0.0"
|
| 2431 |
+
},
|
| 2432 |
+
"funding": {
|
| 2433 |
+
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
| 2434 |
+
}
|
| 2435 |
+
},
|
| 2436 |
+
"node_modules/parse5-parser-stream": {
|
| 2437 |
+
"version": "7.1.2",
|
| 2438 |
+
"resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz",
|
| 2439 |
+
"integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==",
|
| 2440 |
+
"license": "MIT",
|
| 2441 |
+
"dependencies": {
|
| 2442 |
+
"parse5": "^7.0.0"
|
| 2443 |
+
},
|
| 2444 |
+
"funding": {
|
| 2445 |
+
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
| 2446 |
+
}
|
| 2447 |
+
},
|
| 2448 |
+
"node_modules/parse5/node_modules/entities": {
|
| 2449 |
+
"version": "6.0.1",
|
| 2450 |
+
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
| 2451 |
+
"integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
|
| 2452 |
+
"license": "BSD-2-Clause",
|
| 2453 |
+
"engines": {
|
| 2454 |
+
"node": ">=0.12"
|
| 2455 |
+
},
|
| 2456 |
+
"funding": {
|
| 2457 |
+
"url": "https://github.com/fb55/entities?sponsor=1"
|
| 2458 |
+
}
|
| 2459 |
+
},
|
| 2460 |
"node_modules/parseurl": {
|
| 2461 |
"version": "1.3.3",
|
| 2462 |
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
|
|
| 3243 |
"dev": true,
|
| 3244 |
"license": "MIT"
|
| 3245 |
},
|
| 3246 |
+
"node_modules/undici": {
|
| 3247 |
+
"version": "7.19.2",
|
| 3248 |
+
"resolved": "https://registry.npmjs.org/undici/-/undici-7.19.2.tgz",
|
| 3249 |
+
"integrity": "sha512-4VQSpGEGsWzk0VYxyB/wVX/Q7qf9t5znLRgs0dzszr9w9Fej/8RVNQ+S20vdXSAyra/bJ7ZQfGv6ZMj7UEbzSg==",
|
| 3250 |
+
"license": "MIT",
|
| 3251 |
+
"engines": {
|
| 3252 |
+
"node": ">=20.18.1"
|
| 3253 |
+
}
|
| 3254 |
+
},
|
| 3255 |
"node_modules/undici-types": {
|
| 3256 |
"version": "7.16.0",
|
| 3257 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
|
|
|
| 3328 |
"node": ">=12"
|
| 3329 |
}
|
| 3330 |
},
|
| 3331 |
+
"node_modules/whatwg-encoding": {
|
| 3332 |
+
"version": "3.1.1",
|
| 3333 |
+
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
|
| 3334 |
+
"integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
|
| 3335 |
+
"deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation",
|
| 3336 |
+
"license": "MIT",
|
| 3337 |
+
"dependencies": {
|
| 3338 |
+
"iconv-lite": "0.6.3"
|
| 3339 |
+
},
|
| 3340 |
+
"engines": {
|
| 3341 |
+
"node": ">=18"
|
| 3342 |
+
}
|
| 3343 |
+
},
|
| 3344 |
+
"node_modules/whatwg-encoding/node_modules/iconv-lite": {
|
| 3345 |
+
"version": "0.6.3",
|
| 3346 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
| 3347 |
+
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
| 3348 |
+
"license": "MIT",
|
| 3349 |
+
"dependencies": {
|
| 3350 |
+
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
| 3351 |
+
},
|
| 3352 |
+
"engines": {
|
| 3353 |
+
"node": ">=0.10.0"
|
| 3354 |
+
}
|
| 3355 |
+
},
|
| 3356 |
+
"node_modules/whatwg-mimetype": {
|
| 3357 |
+
"version": "4.0.0",
|
| 3358 |
+
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
|
| 3359 |
+
"integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
|
| 3360 |
+
"license": "MIT",
|
| 3361 |
+
"engines": {
|
| 3362 |
+
"node": ">=18"
|
| 3363 |
+
}
|
| 3364 |
+
},
|
| 3365 |
"node_modules/whatwg-url": {
|
| 3366 |
"version": "14.2.0",
|
| 3367 |
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
|
backend/package.json
CHANGED
|
@@ -17,6 +17,7 @@
|
|
| 17 |
"@seald-io/nedb": "^4.1.2",
|
| 18 |
"axios": "^1.13.2",
|
| 19 |
"bcryptjs": "^3.0.3",
|
|
|
|
| 20 |
"cookie-parser": "^1.4.7",
|
| 21 |
"cors": "^2.8.6",
|
| 22 |
"dotenv": "^17.2.3",
|
|
|
|
| 17 |
"@seald-io/nedb": "^4.1.2",
|
| 18 |
"axios": "^1.13.2",
|
| 19 |
"bcryptjs": "^3.0.3",
|
| 20 |
+
"cheerio": "^1.2.0",
|
| 21 |
"cookie-parser": "^1.4.7",
|
| 22 |
"cors": "^2.8.6",
|
| 23 |
"dotenv": "^17.2.3",
|
backend/utils/webSearch.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
const axios = require('axios');
|
|
|
|
| 2 |
|
| 3 |
/**
|
| 4 |
* FREE_UNLIMITED_SEARCH
|
|
@@ -7,35 +8,56 @@ const axios = require('axios');
|
|
| 7 |
exports.searchWeb = async (query) => {
|
| 8 |
console.log(`[Neural_Search] Deep-scanning web for: ${query}`);
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
try {
|
| 11 |
-
|
| 12 |
-
const response = await axios.get(`https://duckduckgo.com/html/?q=${encodeURIComponent(query)}`, {
|
| 13 |
headers: {
|
| 14 |
-
'User-Agent':
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
});
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
const results = [];
|
| 21 |
-
const resultMatches = html.matchAll(/<a class="result__a" href=\"(.*?)\">(.*?)<\/a>|<p class=\"result__snippet\">(.*?)<\/p>/g);
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
-
|
| 32 |
-
}
|
| 33 |
|
| 34 |
-
if (results.length === 0) return "[SEARCH_OFFLINE]: No immediate data
|
| 35 |
|
| 36 |
return results.map(r => `SOURCE: ${r.url}\nTITLE: ${r.title}\nINFO: ${r.snippet}`).join('\n\n');
|
| 37 |
} catch (err) {
|
| 38 |
console.error("[Search_Failure]", err.message);
|
| 39 |
-
return `[SEARCH_OFFLINE]:
|
| 40 |
}
|
| 41 |
-
};
|
|
|
|
| 1 |
const axios = require('axios');
|
| 2 |
+
const cheerio = require('cheerio');
|
| 3 |
|
| 4 |
/**
|
| 5 |
* FREE_UNLIMITED_SEARCH
|
|
|
|
| 8 |
exports.searchWeb = async (query) => {
|
| 9 |
console.log(`[Neural_Search] Deep-scanning web for: ${query}`);
|
| 10 |
|
| 11 |
+
const userAgents = [
|
| 12 |
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
|
| 13 |
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
|
| 14 |
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
|
| 15 |
+
];
|
| 16 |
+
|
| 17 |
try {
|
| 18 |
+
const response = await axios.get(`https://duckduckgo.com/lite/?q=${encodeURIComponent(query)}`, {
|
|
|
|
| 19 |
headers: {
|
| 20 |
+
'User-Agent': userAgents[Math.floor(Math.random() * userAgents.length)],
|
| 21 |
+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
| 22 |
+
'Accept-Language': 'en-US,en;q=0.5',
|
| 23 |
+
'DNT': '1',
|
| 24 |
+
'Connection': 'keep-alive',
|
| 25 |
+
'Upgrade-Insecure-Requests': '1'
|
| 26 |
+
},
|
| 27 |
+
timeout: 10000
|
| 28 |
});
|
| 29 |
|
| 30 |
+
if (response.data.includes('Unfortunately, bots use DuckDuckGo too')) {
|
| 31 |
+
console.log("[DEBUG] DuckDuckGo hit a captcha challenge.");
|
| 32 |
+
return "[SEARCH_OFFLINE]: The web sector is temporarily shielded by a captcha barrier. Try again in a few moments.";
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
const $ = cheerio.load(response.data);
|
| 36 |
const results = [];
|
|
|
|
| 37 |
|
| 38 |
+
// DuckDuckGo Lite result structure:
|
| 39 |
+
// <table> contains result rows
|
| 40 |
+
// <a> with class "result-link" is the main link
|
| 41 |
+
$('a.result-link').each((i, el) => {
|
| 42 |
+
if (i >= 5) return false;
|
| 43 |
+
const title = $(el).text().trim();
|
| 44 |
+
let url = $(el).attr('href');
|
| 45 |
+
|
| 46 |
+
if (url && title) {
|
| 47 |
+
if (url.startsWith('//')) url = 'https:' + url;
|
| 48 |
+
results.push({
|
| 49 |
+
url: url,
|
| 50 |
+
title: title,
|
| 51 |
+
snippet: "Data retrieved via Neural Uplink."
|
| 52 |
+
});
|
| 53 |
}
|
| 54 |
+
});
|
|
|
|
| 55 |
|
| 56 |
+
if (results.length === 0) return "[SEARCH_OFFLINE]: No immediate data packets returned from this sector.";
|
| 57 |
|
| 58 |
return results.map(r => `SOURCE: ${r.url}\nTITLE: ${r.title}\nINFO: ${r.snippet}`).join('\n\n');
|
| 59 |
} catch (err) {
|
| 60 |
console.error("[Search_Failure]", err.message);
|
| 61 |
+
return `[SEARCH_OFFLINE]: Connection timeout in the web sector.`;
|
| 62 |
}
|
| 63 |
+
};
|