mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update the search engines
This commit is contained in:
parent
d3743e206c
commit
8bb0f68049
23
lib/http.js
23
lib/http.js
|
@ -8,6 +8,7 @@ var SHELL = require("lib/shell");
|
||||||
var RAND = require("lib/rand");
|
var RAND = require("lib/rand");
|
||||||
var BASE64 = require("lib/base64");
|
var BASE64 = require("lib/base64");
|
||||||
var PipeIPC = require("lib/pipe-ipc");
|
var PipeIPC = require("lib/pipe-ipc");
|
||||||
|
var JsonRpc2 = require("lib/jsonrpc2");
|
||||||
|
|
||||||
var OS_NAME = SYS.getOS();
|
var OS_NAME = SYS.getOS();
|
||||||
var OS_ARCH = SYS.getArch();
|
var OS_ARCH = SYS.getArch();
|
||||||
|
@ -38,19 +39,19 @@ var AVAILABLE_PROXIES = [
|
||||||
{
|
{
|
||||||
"type": "serp",
|
"type": "serp",
|
||||||
"provider": "librey",
|
"provider": "librey",
|
||||||
"url": "https://serp.catswords.net/api.php?q={q}&p=1&t=0",
|
"url": "https://farside.link/librex/api.php?q={q}&p=1&t=0",
|
||||||
"documentation": "https://github.com/Ahwxorg/LibreY"
|
"documentation": "https://github.com/Ahwxorg/LibreY"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "serp",
|
"type": "serp",
|
||||||
"provider": "invidious",
|
"provider": "invidious",
|
||||||
"url": "https://invidious.example.org/api/v1/search?q={q}",
|
"url": "https://farside.link/invidious/api/v1/search?q={q}",
|
||||||
"documentation": "https://docs.invidious.io/"
|
"documentation": "https://docs.invidious.io/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "stateless-jsonrpc2",
|
"type": "stateless-jsonrpc2",
|
||||||
"provider": "gnh1201/caterpillar",
|
"provider": "gnh1201/caterpillar",
|
||||||
"url": "http://localhost:5555",
|
"url": "http://localhost:8080",
|
||||||
"documentation": "https://github.com/gnh1201/caterpillar"
|
"documentation": "https://github.com/gnh1201/caterpillar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -511,20 +512,22 @@ var HTTPObject = function(engine) {
|
||||||
|
|
||||||
this.parseSerpUrl = function(url) {
|
this.parseSerpUrl = function(url) {
|
||||||
var getEngine = function(url) {
|
var getEngine = function(url) {
|
||||||
var match = url.match(/(?:https?:\/\/)?(?:www\.)?(google|youtube|bing|baidu|amazon|naver|daum)\.\w+/), result;
|
var match = url.match(/(?:https?:\/\/)?(?:www\.)?(google|youtube|bing|baidu|amazon|duckduckgo|naver|daum|aliexpress|temu|coupang)|\.\w+/), engine;
|
||||||
if (match) {
|
if (match) {
|
||||||
result = match[1];
|
engine = match[1];
|
||||||
if (result == "naver" || result == "daum") {
|
if (["naver", "daum"].indexOf(engine) > -1) {
|
||||||
result = "google";
|
engine = "google";
|
||||||
|
} else if (["aliexpress", "temu", "coupang"].indexOf(engine) > -1) {
|
||||||
|
engine = "google_shopping";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = "google";
|
engine = "google";
|
||||||
}
|
}
|
||||||
return result;
|
return engine;
|
||||||
};
|
};
|
||||||
|
|
||||||
var getKeyword = function(url) {
|
var getKeyword = function(url) {
|
||||||
var regex = /[?&](q|wd|query|search_query|k)=([^&]*)/g;
|
var regex = /[?&](q|wd|query|search_query|k|SearchText|search_key)=([^&]*)/g;
|
||||||
var match, keywords = [];
|
var match, keywords = [];
|
||||||
while ((match = regex.exec(url)) !== null) {
|
while ((match = regex.exec(url)) !== null) {
|
||||||
keywords.push(match[2]);
|
keywords.push(match[2]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user