Merge pull request #284 from gnh1201/dev

Replace the default SERP provider to SerpApi
This commit is contained in:
Namhyeon Go 2025-07-10 14:00:50 +09:00 committed by GitHub
commit 0df87cda96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 32 additions and 26 deletions

View File

@ -27,11 +27,12 @@ WelsonJS = ***W***indows + ***El***ectr***on***-like + ***Javascript(JS)*** + :h
## Sponsors ## Sponsors
* :octocat: [GitHub Sponsors](https://github.com/sponsors/gnh1201), :coffee: [Buy me a coffee](https://buymeacoffee.com/catswords) * :octocat: [GitHub Sponsors](https://github.com/sponsors/gnh1201), :coffee: [Buy me a coffee](https://buymeacoffee.com/catswords)
* <img src="https://ics.catswords.net/serpapi_logo_32.png" height="32" alt=""/> [SerpApi](https://serpapi.com/?utm_source=welsonjs) - Scrape search engines results with simple API.
* <img src="https://ics.catswords.net/logo_oss.gif" height="32" alt=""/> [Open SW Portal](https://oss.kr), NIPA National IT Industry Promotion Agency<sup>(정보통신산업진흥원)</sup> * <img src="https://ics.catswords.net/logo_oss.gif" height="32" alt=""/> [Open SW Portal](https://oss.kr), NIPA National IT Industry Promotion Agency<sup>(정보통신산업진흥원)</sup>
* <img src="https://ics.catswords.net/signpath_logo.png" height="32" alt=""/> Free code signing provided by [SignPath.io](https://signpath.io), certificate by [SignPath Foundation](https://signpath.org/) * <img src="https://ics.catswords.net/signpath_logo.png" height="32" alt=""/> Free code signing provided by [SignPath.io](https://signpath.io), certificate by [SignPath Foundation](https://signpath.org/)
* <img src="https://ics.catswords.net/f1security_logo.png" height="32" alt=""/> [F1Security<sup>(에프원시큐리티)</sup>](https://f1security.co.kr/) provides [industry-leading](https://www.ksecurity.or.kr/kisis/subIndex/469.do) web security services. * <img src="https://ics.catswords.net/f1security_logo.png" height="32" alt=""/> [F1Security<sup>(에프원시큐리티)</sup>](https://f1security.co.kr/) provides [industry-leading](https://www.ksecurity.or.kr/kisis/subIndex/469.do) web security services.
* <img src="https://ics.catswords.net/microsoft_logo.png" height="32" alt=""/> [Microsoft ISV Success Program](https://www.microsoft.com/en-us/isv/isv-success), Grow your business with powerful tools. * <img src="https://ics.catswords.net/microsoft_logo.png" height="32" alt=""/> [Microsoft ISV Success Program](https://www.microsoft.com/en-us/isv/isv-success), Grow your business with powerful tools.
* :zap: [Integrations](https://catswords-oss.rdbl.io/5719744820/8278298336) ([ScrapeOps](https://scrapeops.io?fpr=namhyeon75), [SearchApi](https://www.searchapi.io/?via=namhyeon), [AviationStack](https://aviationstack.com?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=namhyeon71), [Coupang](https://link.coupang.com/a/b7HV3V)...) * :zap: [Integrations](https://catswords-oss.rdbl.io/5719744820/8278298336) ([ScrapeOps](https://scrapeops.io?fpr=namhyeon75), [AviationStack](https://aviationstack.com?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=namhyeon71), [Coupang](https://link.coupang.com/a/b7HV3V)...)
## System Requirements ## System Requirements
* **Operating Systems**: Windows XP SP3 or later (Currently, Windows 11 24H2) * **Operating Systems**: Windows XP SP3 or later (Currently, Windows 11 24H2)

View File

@ -10,7 +10,7 @@
"clovastudio": "file:data/clovastudio_apikey.txt", "clovastudio": "file:data/clovastudio_apikey.txt",
"catswords-ai": "file:data/catswords_ai_apikey.txt", "catswords-ai": "file:data/catswords_ai_apikey.txt",
"scrapeops": "file:data/scrapeops_apikey.txt", "scrapeops": "file:data/scrapeops_apikey.txt",
"searchapi": "file:data/searchapi_apikey.txt", "serpapi": "file:data/serpapi_apikey.txt",
"aviationstack": "file:data/aviationstack_apikey.txt", "aviationstack": "file:data/aviationstack_apikey.txt",
"abuseipdb": "file:data/abuseipdb_apikey.txt" "abuseipdb": "file:data/abuseipdb_apikey.txt"
} }

View File

@ -13,9 +13,9 @@
}, },
{ {
"type": "serp", "type": "serp",
"provider": "searchapi", "provider": "serpapi",
"url": "https://www.searchapi.io/api/v1/search?api_key={api_key}&engine={engine}&q={q}", "url": "https://serpapi.com/search.json?api_key={api_key}&engine={engine}&q={q}",
"documentation": "https://www.searchapi.io/?via=namhyeon" "documentation": "https://serpapi.com/?utm_source=welsonjs"
}, },
{ {
"type": "serp", "type": "serp",

View File

@ -4,13 +4,16 @@
// https://github.com/gnh1201/welsonjs // https://github.com/gnh1201/welsonjs
// //
// SECURITY NOTICE // SECURITY NOTICE
// AviationStack, SearchApi requires an internet connection, and data may be transmitted externally. Please check the terms of use and privacy policy. // AviationStack, SerpApi requires an internet connection, and data may be transmitted externally. Please check the terms of use and privacy policy.
// https://aviationstack.com/?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=namhyeon71 // https://aviationstack.com/?utm_source=FirstPromoter&utm_medium=Affiliate&fpr=namhyeon71
// https://www.searchapi.io/?via=namhyeon // https://serpapi.com/security?utm_source=welsonjs
// //
var HTTP = require("lib/http"); var HTTP = require("lib/http");
var CRED = require("lib/credentials"); var CRED = require("lib/credentials");
var DEFAULT_CURRENCY = "USD";
var DEFAULT_LANGUAGE_CODE = "en";
function getData(type, params, limit, offset) { function getData(type, params, limit, offset) {
var params = params || {}; var params = params || {};
var limit = (function(n) { var limit = (function(n) {
@ -71,15 +74,16 @@ function getFlightsFuture(params, limit, offset) {
function getRoundTrip(arrival_id, departure_id, outbound_date, return_date) { function getRoundTrip(arrival_id, departure_id, outbound_date, return_date) {
var response = HTTP.create() var response = HTTP.create()
.setParameters({ .setParameters({
"api_key": CRED.get("apikey", "searchapi"), engine: "google_flights",
"arrival_id": arrival_id, departure_id: departure_id,
"departure_id": departure_id, arrival_id: arrival_id,
"engine": "google_flights", outbound_date: outbound_date,
"flight_type": "round_trip", return_date: return_date,
"outbound_date": outbound_date, currency: DEFAULT_CURRENCY,
"return_date": return_date hl: DEFAULT_LANGUAGE_CODE,
api_key: CRED.get("apikey", "serpapi")
}) })
.open("GET", "https://www.searchapi.io/api/v1/search") .open("GET", "https://serpapi.com/search.json")
.send(); .send();
return response.responseBody; return response.responseBody;
@ -88,14 +92,15 @@ function getRoundTrip(arrival_id, departure_id, outbound_date, return_date) {
function getOneWay(arrival_id, departure_id, outbound_date) { function getOneWay(arrival_id, departure_id, outbound_date) {
var response = HTTP.create() var response = HTTP.create()
.setParameters({ .setParameters({
"api_key": CRED.get("apikey", "searchapi"), engine: "google_flights",
"arrival_id": arrival_id, departure_id: departure_id,
"departure_id": departure_id, arrival_id: arrival_id,
"engine": "google_flights", outbound_date: outbound_date,
"flight_type": "one_way", currency: DEFAULT_CURRENCY,
"outbound_date": outbound_date hl: DEFAULT_LANGUAGE_CODE,
api_key: CRED.get("apikey", "serpapi")
}) })
.open("GET", "https://www.searchapi.io/api/v1/search") .open("GET", "https://serpapi.com/search.json")
.send(); .send();
return response.responseBody; return response.responseBody;
@ -114,7 +119,7 @@ exports.getFlightsFuture = getFlightsFuture;
exports.getRoundTrip = getRoundTrip; exports.getRoundTrip = getRoundTrip;
exports.getOneWay = getOneWay; exports.getOneWay = getOneWay;
exports.VERSIONINFO = "Aviation Data Integration (aviation.js) version 0.1.3"; exports.VERSIONINFO = "Aviation Data Integration (aviation.js) version 0.1.4";
exports.AUTHOR = "gnh1201@catswords.re.kr"; exports.AUTHOR = "gnh1201@catswords.re.kr";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;

View File

@ -1029,18 +1029,18 @@ var test_implements = {
console.log("responseBody:", response.responseBody); console.log("responseBody:", response.responseBody);
}, },
// https://catswords-oss.rdbl.io/5719744820/8278298336 // How to use: https://catswords-oss.rdbl.io/5719744820/8278298336
"proxy_serp": function() { "proxy_serp": function() {
var HTTP = require("lib/http"); var HTTP = require("lib/http");
var CRED = require("lib/credentials"); var CRED = require("lib/credentials");
var response = HTTP.create() var response = HTTP.create()
.setVariables({ .setVariables({
"api_key": CRED.get("apikey", "searchapi") "api_key": CRED.get("apikey", "serpapi")
}) })
.setProxy({ .setProxy({
"enabled": true, "enabled": true,
"provider": "searchapi", "provider": "serpapi",
"type": "serp" "type": "serp"
}) })
.open("GET", "https://www.google.com/search?q=test") .open("GET", "https://www.google.com/search?q=test")