From 5ccba3b1072f63e6030b94f8592bab43cb71806c Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 10 Jul 2025 13:54:53 +0900 Subject: [PATCH 1/3] Replace the default SERP provider to SerpApi Updated all references from the previous default SERP provider to SerpApi, including API keys, proxy configuration, and documentation links. Adjusted aviation.js to use SerpApi endpoints and parameters, and updated testloader.js to reflect the new provider. This change standardizes the search engine scraping integration to use SerpApi. --- README.md | 3 ++- data/apikey.json | 2 +- data/available_proxies.json | 6 +++--- lib/aviation.js | 42 +++++++++++++++++++++---------------- testloader.js | 6 +++--- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index e3070c0..c8978bb 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,12 @@ WelsonJS = ***W***indows + ***El***ectr***on***-like + ***Javascript(JS)*** + :h ## Sponsors * :octocat: [GitHub Sponsors](https://github.com/sponsors/gnh1201), :coffee: [Buy me a coffee](https://buymeacoffee.com/catswords) +* [SerpApi](https://serpapi.com/?utm_source=welsonjs) - Scrape search engines results with simple API. * [Open SW Portal](https://oss.kr), NIPA National IT Industry Promotion Agency(정보통신산업진흥원) * Free code signing provided by [SignPath.io](https://signpath.io), certificate by [SignPath Foundation](https://signpath.org/) * [F1Security(에프원시큐리티)](https://f1security.co.kr/) provides [industry-leading](https://www.ksecurity.or.kr/kisis/subIndex/469.do) web security services. * [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 * **Operating Systems**: Windows XP SP3 or later (Currently, Windows 11 24H2) diff --git a/data/apikey.json b/data/apikey.json index e13fb55..178fc56 100644 --- a/data/apikey.json +++ b/data/apikey.json @@ -10,7 +10,7 @@ "clovastudio": "file:data/clovastudio_apikey.txt", "catswords-ai": "file:data/catswords_ai_apikey.txt", "scrapeops": "file:data/scrapeops_apikey.txt", - "searchapi": "file:data/searchapi_apikey.txt", + "serpapi": "file:data/serp_apikey.txt", "aviationstack": "file:data/aviationstack_apikey.txt", "abuseipdb": "file:data/abuseipdb_apikey.txt" } diff --git a/data/available_proxies.json b/data/available_proxies.json index 4284dee..732cd91 100644 --- a/data/available_proxies.json +++ b/data/available_proxies.json @@ -13,9 +13,9 @@ }, { "type": "serp", - "provider": "searchapi", - "url": "https://www.searchapi.io/api/v1/search?api_key={api_key}&engine={engine}&q={q}", - "documentation": "https://www.searchapi.io/?via=namhyeon" + "provider": "serpapi", + "url": "https://serpapi.com/search.json?api_key={api_key}&engine={engine}&q={q}", + "documentation": "https://serpapi.com/?utm_source=welsonjs" }, { "type": "serp", diff --git a/lib/aviation.js b/lib/aviation.js index 18c00f9..1999cb9 100644 --- a/lib/aviation.js +++ b/lib/aviation.js @@ -4,13 +4,16 @@ // https://github.com/gnh1201/welsonjs // // 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://www.searchapi.io/?via=namhyeon +// https://serpapi.com/security?utm_source=welsonjs // var HTTP = require("lib/http"); var CRED = require("lib/credentials"); +var DEFAULT_CURRENCY = "USD"; +var DEFAULT_LANGUAGE_CODE = "en"; + function getData(type, params, limit, offset) { var params = params || {}; var limit = (function(n) { @@ -71,15 +74,16 @@ function getFlightsFuture(params, limit, offset) { function getRoundTrip(arrival_id, departure_id, outbound_date, return_date) { var response = HTTP.create() .setParameters({ - "api_key": CRED.get("apikey", "searchapi"), - "arrival_id": arrival_id, - "departure_id": departure_id, - "engine": "google_flights", - "flight_type": "round_trip", - "outbound_date": outbound_date, - "return_date": return_date + engine: "google_flights", + departure_id: departure_id, + arrival_id: arrival_id, + outbound_date: outbound_date, + return_date: return_date, + currency: DEFAULT_CURRENCY, + 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(); return response.responseBody; @@ -88,14 +92,16 @@ function getRoundTrip(arrival_id, departure_id, outbound_date, return_date) { function getOneWay(arrival_id, departure_id, outbound_date) { var response = HTTP.create() .setParameters({ - "api_key": CRED.get("apikey", "searchapi"), - "arrival_id": arrival_id, - "departure_id": departure_id, - "engine": "google_flights", - "flight_type": "one_way", - "outbound_date": outbound_date + engine: "google_flights", + departure_id: departure_id, + arrival_id: arrival_id, + outbound_date: outbound_date, + return_date: "", + currency: DEFAULT_CURRENCY, + 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(); return response.responseBody; @@ -114,7 +120,7 @@ exports.getFlightsFuture = getFlightsFuture; exports.getRoundTrip = getRoundTrip; 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.global = global; exports.require = global.require; diff --git a/testloader.js b/testloader.js index 572c2a7..60b5c2d 100644 --- a/testloader.js +++ b/testloader.js @@ -1029,18 +1029,18 @@ var test_implements = { 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() { var HTTP = require("lib/http"); var CRED = require("lib/credentials"); var response = HTTP.create() .setVariables({ - "api_key": CRED.get("apikey", "searchapi") + "api_key": CRED.get("apikey", "serpapi") }) .setProxy({ "enabled": true, - "provider": "searchapi", + "provider": "serpapi", "type": "serp" }) .open("GET", "https://www.google.com/search?q=test") From 01230745ed24bae8a50259d2f5b9f03844fc6cc3 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 10 Jul 2025 13:57:19 +0900 Subject: [PATCH 2/3] Update aviation.js --- lib/aviation.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/aviation.js b/lib/aviation.js index 1999cb9..4098cf4 100644 --- a/lib/aviation.js +++ b/lib/aviation.js @@ -96,7 +96,6 @@ function getOneWay(arrival_id, departure_id, outbound_date) { departure_id: departure_id, arrival_id: arrival_id, outbound_date: outbound_date, - return_date: "", currency: DEFAULT_CURRENCY, hl: DEFAULT_LANGUAGE_CODE, api_key: CRED.get("apikey", "serpapi") From 3f8a301680e902ac77755bc47d5ec4a3566cdf29 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 10 Jul 2025 13:58:23 +0900 Subject: [PATCH 3/3] Update apikey.json --- data/apikey.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/apikey.json b/data/apikey.json index 178fc56..95d661c 100644 --- a/data/apikey.json +++ b/data/apikey.json @@ -10,7 +10,7 @@ "clovastudio": "file:data/clovastudio_apikey.txt", "catswords-ai": "file:data/catswords_ai_apikey.txt", "scrapeops": "file:data/scrapeops_apikey.txt", - "serpapi": "file:data/serp_apikey.txt", + "serpapi": "file:data/serpapi_apikey.txt", "aviationstack": "file:data/aviationstack_apikey.txt", "abuseipdb": "file:data/abuseipdb_apikey.txt" }