-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - serphouse #18910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - serphouse #18910
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
components/serphouse/actions/google-jobs-search/google-jobs-search.mjs
This file contains hidden or 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,80 @@ | ||
| import serphouse from "../../serphouse.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "serphouse-google-jobs-search", | ||
| name: "Google Jobs Search", | ||
| description: "Performs a Google Jobs search using the Serphouse API. [See the documentation](https://docs.serphouse.com/google-apis/google-jobs-api)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| serphouse, | ||
| query: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "query", | ||
| ], | ||
| }, | ||
| domain: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "domain", | ||
| () => ({ | ||
| type: "google", | ||
| }), | ||
| ], | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "language", | ||
| ({ domain }) => ({ | ||
| domain, | ||
| }), | ||
| ], | ||
| }, | ||
| locationAlert: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "locationAlert", | ||
| ], | ||
| }, | ||
| locationId: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "locationId", | ||
| ({ domain }) => ({ | ||
| domain, | ||
| }), | ||
| ], | ||
| }, | ||
| dateRange: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "dateRange", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.serphouse.googleJobsSearch({ | ||
| $, | ||
| data: { | ||
| data: { | ||
| q: this.query, | ||
| domain: this.domain, | ||
| lang: this.language, | ||
| loc_id: this.locationId, | ||
| date_range: this.dateRange, | ||
| }, | ||
| }, | ||
| }); | ||
| if (response.status === "success") { | ||
| $.export("$summary", `Successfully performed Google Jobs search for "${this.query}".`); | ||
| } | ||
| return response; | ||
| }, | ||
| }; | ||
136 changes: 136 additions & 0 deletions
136
components/serphouse/actions/perform-search/perform-search.mjs
This file contains hidden or 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,136 @@ | ||
| import serphouse from "../../serphouse.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "serphouse-perform-search", | ||
| name: "Perform Search", | ||
| description: "Performs a search using the Serphouse API. [See the documentation](https://docs.serphouse.com/serp-api/live-using-http-get-method)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| serphouse, | ||
| query: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "query", | ||
| ], | ||
| }, | ||
| domain: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "domain", | ||
| ], | ||
| }, | ||
| language: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "language", | ||
| ({ domain }) => ({ | ||
| domain, | ||
| }), | ||
| ], | ||
| }, | ||
| device: { | ||
| type: "string", | ||
| label: "Device", | ||
| description: "The device to use for the search", | ||
| options: [ | ||
| "desktop", | ||
| "tablet", | ||
| "mobile", | ||
| ], | ||
| }, | ||
| serpType: { | ||
| type: "string", | ||
| label: "SERP Type", | ||
| description: "The type of SERP to use for the search", | ||
| options: [ | ||
| "web", | ||
| "news", | ||
| "image", | ||
| ], | ||
| }, | ||
| locationAlert: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "locationAlert", | ||
| ], | ||
| }, | ||
| locationId: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "locationId", | ||
| ({ domain }) => ({ | ||
| domain, | ||
| }), | ||
| ], | ||
| optional: true, | ||
| }, | ||
| verbatim: { | ||
| type: "boolean", | ||
| label: "Verbatim", | ||
| description: "If true, the search will be performed verbatim", | ||
| optional: true, | ||
| }, | ||
| gfilter: { | ||
| type: "boolean", | ||
| label: "GFilter", | ||
| description: "Parameter defines if the filters for 'Similar Results' and 'Omitted Results' are on or off. It can be set to `true` (default) to enable these filters, or `false` to disable these filters.", | ||
| optional: true, | ||
| default: true, | ||
| }, | ||
| page: { | ||
| type: "integer", | ||
| label: "Page", | ||
| description: "Give specific page to get the result of that page number. By default it will get you first page", | ||
| optional: true, | ||
| }, | ||
| numResults: { | ||
| type: "integer", | ||
| label: "Number of Results", | ||
| description: "Define number of result you want to get per page. By default you will get top 100 results.", | ||
| optional: true, | ||
| }, | ||
| dateRange: { | ||
| propDefinition: [ | ||
| serphouse, | ||
| "dateRange", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const type = this.serphouse.getDomainType(this.domain); | ||
| if (!this.locationId && (type === "google" || type === "bing")) { | ||
| throw new ConfigurationError("Location is required for Google and Bing searches"); | ||
| } | ||
| const response = await this.serphouse.performSearch({ | ||
| $, | ||
| params: { | ||
| q: this.query, | ||
| domain: this.domain, | ||
| lang: this.language, | ||
| device: this.device, | ||
| serp_type: this.serpType, | ||
| loc_id: this.locationId, | ||
| verbatim: this.verbatim | ||
| ? "1" | ||
| : "0", | ||
| gfilter: this.gfilter | ||
| ? "1" | ||
| : "0", | ||
| page: this.page, | ||
| num_result: this.numResults, | ||
| date_range: this.dateRange, | ||
| }, | ||
| }); | ||
| if (response.status === "success") { | ||
| $.export("$summary", `Successfully performed search for "${this.query}".`); | ||
| } | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.