diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 035beca..6337127 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,4 +27,7 @@ jobs: - run: npm ci - run: npm test env: - API_KEY: ${{secrets.API_KEY}} \ No newline at end of file + API_KEY: ${{secrets.API_KEY}} + - run: make oobt + env: + API_KEY: ${{secrets.API_KEY}} \ No newline at end of file diff --git a/.gitignore b/.gitignore index c2658d7..63c4cf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules/ +*.tgz +*.rb diff --git a/Makefile b/Makefile index 1871fdd..0a6a5f9 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: test package: npm pack -oobt: +oobt: package rm -rf /oobt/tmp cp -R oobt /tmp cd /tmp/oobt ; \ diff --git a/README.md b/README.md index e295c76..51abf7d 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,8 @@ make test ``` ## Change log - + * 2.0.1 + * fix classes loading. * 2.0 * Refractor class name: SearchResult -> Search * 1.2 diff --git a/lib/BaiduSearch.js b/lib/BaiduSearch.js index 2203f5a..fb26114 100644 --- a/lib/BaiduSearch.js +++ b/lib/BaiduSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class BaiduSearch extends search.SerpApiSearch { +class BaiduSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "baidu") } } -module.exports.BaiduSearch = BaiduSearch \ No newline at end of file +module.exports = BaiduSearch \ No newline at end of file diff --git a/lib/BingSearch.js b/lib/BingSearch.js index c95ef05..1ca88eb 100644 --- a/lib/BingSearch.js +++ b/lib/BingSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class BingSearch extends search.SerpApiSearch { +class BingSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "bing") } } -module.exports.BingSearch = BingSearch \ No newline at end of file +module.exports = BingSearch \ No newline at end of file diff --git a/lib/EbaySearch.js b/lib/EbaySearch.js index b1a6e5b..6415003 100644 --- a/lib/EbaySearch.js +++ b/lib/EbaySearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class EbaySearch extends search.SerpApiSearch { +class EbaySearch extends SerpApiSearch { constructor(api_key) { super(api_key, "ebay") } } -module.exports.EbaySearch = EbaySearch \ No newline at end of file +module.exports = EbaySearch \ No newline at end of file diff --git a/lib/GoogleSearch.js b/lib/GoogleSearch.js index 074850d..48921f2 100644 --- a/lib/GoogleSearch.js +++ b/lib/GoogleSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class GoogleSearch extends search.SerpApiSearch { +class GoogleSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "google") } } -module.exports.GoogleSearch = GoogleSearch \ No newline at end of file +module.exports = GoogleSearch \ No newline at end of file diff --git a/lib/SerpApiSearch.js b/lib/SerpApiSearch.js index ba58435..a8e123e 100644 --- a/lib/SerpApiSearch.js +++ b/lib/SerpApiSearch.js @@ -69,7 +69,6 @@ class SerpApiSearch { execute(path, parameter, callback, output) { let url = this.buildUrl(path, parameter, output) search.timeout = this.defaultTimeout - console.log(url) search.get(url, (resp) => { let data = '' @@ -169,4 +168,4 @@ class SerpApiSearch { } } -module.exports.SerpApiSearch = SerpApiSearch; +module.exports = SerpApiSearch; diff --git a/lib/WalmartSearch.js b/lib/WalmartSearch.js index 0b7d1bc..0dd47f9 100644 --- a/lib/WalmartSearch.js +++ b/lib/WalmartSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class WalmartSearch extends search.SerpApiSearch { +class WalmartSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "walmart") } } -module.exports.WalmartSearch = WalmartSearch \ No newline at end of file +module.exports = WalmartSearch \ No newline at end of file diff --git a/lib/YahooSearch.js b/lib/YahooSearch.js index e41b48e..ef2a9ab 100644 --- a/lib/YahooSearch.js +++ b/lib/YahooSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class YahooSearch extends search.SerpApiSearch { +class YahooSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "yahoo") } } -module.exports.YahooSearch = YahooSearch \ No newline at end of file +module.exports = YahooSearch \ No newline at end of file diff --git a/lib/YandexSearch.js b/lib/YandexSearch.js index 866b66d..3c8623a 100644 --- a/lib/YandexSearch.js +++ b/lib/YandexSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class YandexSearch extends search.SerpApiSearch { +class YandexSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "yandex") } } -module.exports.YandexSearch = YandexSearch \ No newline at end of file +module.exports = YandexSearch \ No newline at end of file diff --git a/lib/YoutubeSearch.js b/lib/YoutubeSearch.js index d0cfae6..ab70a04 100644 --- a/lib/YoutubeSearch.js +++ b/lib/YoutubeSearch.js @@ -1,10 +1,10 @@ -const search = require('./SerpApiSearch') +const SerpApiSearch = require('./SerpApiSearch') -class YoutubeSearch extends search.SerpApiSearch { +class YoutubeSearch extends SerpApiSearch { constructor(api_key) { super(api_key, "youtube") } } -module.exports.YoutubeSearch = YoutubeSearch +module.exports = YoutubeSearch diff --git a/lib/main.js b/lib/main.js new file mode 100644 index 0000000..468ef15 --- /dev/null +++ b/lib/main.js @@ -0,0 +1,23 @@ +'use strict' + +const BaiduSearch = require('./BaiduSearch') +const BingSearch = require('./BingSearch') +const EbaySearch = require('./EbaySearch') +const GoogleSearch = require('./GoogleSearch') +const SerpApiSearch = require('./SerpApiSearch') +const WalmartSearch = require('./WalmartSearch') +const YahooSearch = require('./YahooSearch') +const YandexSearch = require('./YandexSearch') +const YoutubeSearch = require('./YoutubeSearch') + +module.exports = { + SerpApiSearch, + BaiduSearch, + BingSearch, + EbaySearch, + GoogleSearch, + WalmartSearch, + YahooSearch, + YandexSearch, + YoutubeSearch, +} \ No newline at end of file diff --git a/oobt/google_demo.js b/oobt/google_demo.js index 3bc282a..92b89c6 100644 --- a/oobt/google_demo.js +++ b/oobt/google_demo.js @@ -6,14 +6,16 @@ search.json({ }, (data) => { if (data.search_metadata.status == "Success") { if (data.organic_results.length > 0) { - console.log("ok") + console.log("ok: search executed successfully") process.exit(0) } else { - console.log("oops..") + console.log("oops something went wrong..") + console.log(data) process.exit(1) } } else { - console.log("oops..") + console.log("oops request failed!") + console.log(data) process.exit(1) } }) \ No newline at end of file diff --git a/package.json b/package.json index c789e47..15fd96c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "google-search-results-nodejs", - "version": "2.0.0", + "version": "2.0.1", "description": "Google Search Node JS API via SerpApi.com", "scripts": { "test": "mocha", @@ -47,5 +47,17 @@ "url": "https://github.com/serpapi/google-search-results-nodejs/issues" }, "homepage": "https://github.com/serpapi/google-search-results-nodejs#readme", - "dependencies": {} + "dependencies": {}, + "main": "lib/main.js", + "files": [ + "lib/BaiduSearch.js", + "lib/BingSearch.js", + "lib/EbaySearch.js", + "lib/GoogleSearch.js", + "lib/SerpApiSearch.js", + "lib/WalmartSearch.js", + "lib/YahooSearch.js", + "lib/YandexSearch.js", + "lib/YoutubeSearch.js" + ] } \ No newline at end of file