-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf0573d
commit 9a7d8f5
Showing
23 changed files
with
1,431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Lint and Format | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
statuses: write | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18.x" | ||
cache: "npm" | ||
env: | ||
CI: false | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run ESLint | ||
run: npx eslint . | ||
|
||
- name: Run Prettier Check | ||
run: npx prettier --check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: run-tests | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "16" | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run tests | ||
run: npm test | ||
env: | ||
API_KEY: ${{ vars.API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules/ | ||
package-lock.json | ||
|
||
# Avoid environment variables file | ||
# .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,312 @@ | ||
# serphouse-nodejs | ||
|
||
High Volume SERP API for SEO professionals and data scientist. We built reliable, accurate and cost efficient solution, We take cares of resolving captcha, managing proxy to ensure you get reliable Structured JSON data. | ||
|
||
This API supported Serphouse's standard REST API that accepts/returns JSON requests. Here is the [API reference](https://docs.serphouse.com/) | ||
|
||
##### It does supports EcmaScript 5, EcmaScript 6, EcmaScript 8, TypeScript, async-await, Promises, Callback!!! | ||
|
||
##### It supports pure JSON response. | ||
|
||
##### All methods support Promise and Callback both. | ||
|
||
##### Please Feel free to create issue for any help! | ||
|
||
##### Please make sure Test Cases be passed. | ||
|
||
## Get started | ||
|
||
Using the Serphouse API wrapper for Node.js is really simple. | ||
Given that you already have a Node.js project with an NPM setup just follow these steps: | ||
|
||
## Documentation | ||
|
||
Documentation of Serphouse's API and their usage is available at [https://docs.serphouse.com/](https://docs.serphouse.com/) | ||
|
||
## Prerequisites | ||
|
||
Node version up to 14.21.3 to 20.9.0 for use | ||
You need have node version between 14.21.3 to 20.9.0 for use package. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install serphouse-nodejs --save | ||
``` | ||
|
||
## Pull Request | ||
|
||
- Contributors can send their Pull Request to `develop` branch. | ||
- Kindly validate test cases before opening new PR. | ||
|
||
## Get API Key From Using Below Link and Overview Details | ||
|
||
[https://app.serphouse.com/register](https://app.serphouse.com/register) | ||
|
||
## Configuration Using JavaScript | ||
|
||
```bash | ||
export SERPHOUSE_API_TOKEN=API_KEY | ||
|
||
var serphouse = require("serphouse-nodejs")("YOUR_API_KEY"); | ||
|
||
OR | ||
|
||
var SerphouseAPI = require("serphouse-nodejs"); | ||
var serphouse = new SerphouseAPI("YOUR_API_KEY"); | ||
|
||
OR | ||
|
||
var SerphouseAPI = require("serphouse-nodejs"); | ||
var serphouse = new SerphouseAPI(); | ||
serphouse.setApiToken("YOUR_API_KEY"); | ||
``` | ||
|
||
## Configuration Using TypeScript | ||
|
||
```js | ||
import * as SerphouseAPI from "serphouse-nodejs"; | ||
var serphouse = new SerphouseAPI(); | ||
serphouse.setApiToken("YOUR_API_KEY"); | ||
``` | ||
|
||
## Examples | ||
|
||
1. [SERP_API](#serp_api) | ||
|
||
2. [DOMAINS](#domains) | ||
|
||
3. [LANGUAGE](#language) | ||
|
||
4. [LOCATIONS](#location) | ||
|
||
5. [ACCOUNT](#account) | ||
|
||
6. [TRENDS](#trends) | ||
|
||
--- | ||
|
||
> ### [SERP_API](#examples) | ||
```js | ||
/** Performing a realtime search */ | ||
var payload = { | ||
data: { | ||
q: "Coffee", | ||
domain: "google.com", | ||
lang: "en", | ||
device: "desktop", | ||
serp_type: "web", | ||
loc: "Alba,Texas,United States", | ||
verbatim: 0, | ||
postback_url: "https://webhook.site/8f885f1f-c38a-4a10-8506-335441213208", | ||
page: 1, | ||
num_result: 10, | ||
}, | ||
path: { responseType: "json" }, | ||
}; | ||
|
||
try { | ||
var response = await serphouse.SerpApi.live(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Create a new schedule */ | ||
var payload = { | ||
data: [ | ||
{ | ||
q: "Coffee", | ||
domain: "google.com", | ||
lang: "en", | ||
device: "desktop", | ||
serp_type: "web", | ||
loc: "Alba,Texas,United States", | ||
verbatim: 0, | ||
postback_url: "https://webhook.site/8f885f1f-c38a-4a10-8506-335441213208", | ||
page: 1, | ||
num_result: 10, | ||
}, | ||
], | ||
}; | ||
|
||
try { | ||
var response = await serphouse.SerpApi.schedule(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** You will get a status of your serp task */ | ||
var payload = { query: { id: 127105618 } }; | ||
try { | ||
var response = await serphouse.SerpApi.check(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** you will receive an json array containing a result of your serp query */ | ||
var payload = { | ||
query: { id: 127673427 }, | ||
path: { responseType: "html" }, // path is optional default get json | ||
}; | ||
try { | ||
var response = await serphouse.SerpApi.get(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
--- | ||
|
||
> ### [DOMAINS](#examples) | ||
```js | ||
/** Get domains list */ | ||
try { | ||
var response = await serphouse.Domains.list(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
--- | ||
|
||
> ### [LANGUAGE](#examples) | ||
```js | ||
/** Get list of languages by Google, Bing and Yahoo */ | ||
try { | ||
const payload = { path: { type: "google" } }; // type can be google,bing,yahoo | ||
var response = await serphouse.Languages.list(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
--- | ||
|
||
> ### [LOCATIONS](#examples) | ||
```js | ||
/** Get locations available for our SERP API */ | ||
try { | ||
const payload = { | ||
query: { | ||
q: "india", | ||
type: "google", | ||
}, | ||
}; | ||
var response = await serphouse.Location.search(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
--- | ||
|
||
> ### [ACCOUNT](#examples) | ||
```js | ||
/** Get your account information */ | ||
try { | ||
var response = await serphouse.Account.fetch(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
> ### [TRENDS](#examples) | ||
```js | ||
/** Performing a realtime google trends search */ | ||
try { | ||
var payload = { | ||
time_zone_offset: -330, | ||
keywords: "google,youtube", | ||
time: "now 1-d", | ||
}; | ||
var response = await serphouse.Trends.search(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Create trend schedule */ | ||
try { | ||
var payload = { | ||
data: [ | ||
{ | ||
time_zone_offset: -330, | ||
keywords: "google,youtube", | ||
time: "now 1-d", | ||
}, | ||
], | ||
}; | ||
var response = await serphouse.Trends.schedule(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Retrieve full list of timezone and its offset value */ | ||
try { | ||
var response = await serphouse.Trends.timeZoneList(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Retrieve full list of categories and sub category */ | ||
try { | ||
var response = await serphouse.Trends.categoryList(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Retrieve full list of country and state */ | ||
try { | ||
var response = await serphouse.Trends.countryStateList(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Retrieve full list of language. */ | ||
try { | ||
var response = await serphouse.Trends.languageList(); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Get result of your trend search query. */ | ||
try { | ||
var payload = { query: { id: 127105618 } }; | ||
var response = await serphouse.Trends.get(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` | ||
|
||
```js | ||
/** Check search status. */ | ||
try { | ||
var payload = { query: { id: 127105618 } }; | ||
var response = await serphouse.Trends.check(payload); | ||
} catch (error) { | ||
return; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
testTimeout: 20000, | ||
}; |
Oops, something went wrong.