Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 components/serphouse/actions/perform-search/perform-search.mjs
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;
},
};
5 changes: 4 additions & 1 deletion components/serphouse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/serphouse",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream SERPhouse Components",
"main": "serphouse.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
Loading
Loading