n8n-nodes-google-scholar-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -0
- package/README.md +107 -0
- package/dist/credentials/ApifyApi.credentials.d.ts +10 -0
- package/dist/credentials/ApifyApi.credentials.js +36 -0
- package/dist/credentials/ApifyApi.credentials.js.map +1 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.d.ts +9 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.js +66 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.d.ts +13 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.js +82 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.js.map +1 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.json +33 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.properties.d.ts +3 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.properties.js +189 -0
- package/dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.properties.js.map +1 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/executeActor.d.ts +5 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/executeActor.js +93 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/executeActor.js.map +1 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/genericFunctions.d.ts +10 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/genericFunctions.js +91 -0
- package/dist/nodes/ApifyGoogleScholar/helpers/genericFunctions.js.map +1 -0
- package/dist/nodes/ApifyGoogleScholar/logo.svg +10 -0
- package/dist/package.json +74 -0
- package/package.json +74 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2026 John Cole
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# n8n-nodes-google-scholar-api
|
|
2
|
+
|
|
3
|
+
An [n8n](https://n8n.io/) community node that searches Google Scholar and returns structured academic papers: title, publication info, snippet, and link. It is backed by the [Google Scholar API](https://apify.com/johnvc/google-scholar-api?fpr=9n7kx3) on [Apify](https://apify.com?fpr=9n7kx3) and bills per result, so there are no subscriptions and no minimums.
|
|
4
|
+
|
|
5
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Output](#output) · [Example workflows](#example-workflows) · [Pricing](#pricing) · [Resources](#resources)
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
Give the node a query, and it returns one item per paper with the title, publication info, snippet, link, and result identifier. It also works as an **AI Agent tool**, so an agent can run literature searches on demand.
|
|
10
|
+
|
|
11
|
+
- Search scholarly papers by query
|
|
12
|
+
- Filter by publication year range
|
|
13
|
+
- Page through results and control how many to return
|
|
14
|
+
- Choose how much data to return per paper: Simplified, Raw, or Selected Fields
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Follow the n8n [community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/):
|
|
19
|
+
|
|
20
|
+
1. In n8n, open **Settings > Community Nodes**.
|
|
21
|
+
2. Select **Install**.
|
|
22
|
+
3. Enter `n8n-nodes-google-scholar-api` as the npm package name.
|
|
23
|
+
4. Agree to the risks of using community nodes, then select **Install**.
|
|
24
|
+
|
|
25
|
+
After it installs, the **Google Scholar** node appears in the nodes panel.
|
|
26
|
+
|
|
27
|
+
> n8n Cloud only allows verified community nodes. Until this node is verified, install it on a self-hosted n8n instance.
|
|
28
|
+
|
|
29
|
+
## Credentials
|
|
30
|
+
|
|
31
|
+
You need a free [Apify account](https://apify.com?fpr=9n7kx3) and an API token.
|
|
32
|
+
|
|
33
|
+
1. Sign in to the [Apify Console](https://console.apify.com?fpr=9n7kx3).
|
|
34
|
+
2. Open **Settings > Integrations** and copy your **Personal API token**.
|
|
35
|
+
3. In n8n, create a new **Apify API** credential and paste the token.
|
|
36
|
+
4. Use the credential's **Test** button to confirm it works.
|
|
37
|
+
|
|
38
|
+
The node also supports **Apify OAuth2** if you prefer to connect that way.
|
|
39
|
+
|
|
40
|
+
## Operations
|
|
41
|
+
|
|
42
|
+
**Paper > Search** returns scholarly papers that match a query.
|
|
43
|
+
|
|
44
|
+
| Parameter | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Search Query | The query to search papers for. Required. |
|
|
47
|
+
| Language Code | Two-letter language code for the results. Defaults to `en`. |
|
|
48
|
+
| Year From / Year To | Restrict by publication year. `0` for no limit. |
|
|
49
|
+
| Number of Results | Results per page. `0` for the Actor default. |
|
|
50
|
+
| Maximum Pages | How many result pages to fetch. |
|
|
51
|
+
| Output | How much data to return: Simplified, Raw, or Selected Fields. |
|
|
52
|
+
|
|
53
|
+
## Output
|
|
54
|
+
|
|
55
|
+
Each paper is returned as its own n8n item. The **Output** parameter lets you choose how much to return:
|
|
56
|
+
|
|
57
|
+
- **Simplified** (default): a compact object with `title`, `link`, `snippet`, `publicationInfo`, `resultId`, and `position`. This mode is also used automatically when the node runs as an AI Agent tool, to keep responses small.
|
|
58
|
+
- **Raw**: every field the API returns for each paper, using the original field names below.
|
|
59
|
+
- **Selected Fields**: pick exactly which fields to include.
|
|
60
|
+
|
|
61
|
+
### Fields (Raw and Selected Fields)
|
|
62
|
+
|
|
63
|
+
| Field | Type | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `position` | integer | Rank in the results |
|
|
66
|
+
| `result_id` | string | Google Scholar result identifier |
|
|
67
|
+
| `paper_title` | string | Paper title |
|
|
68
|
+
| `link` | string | Link to the paper |
|
|
69
|
+
| `snippet` | string | Snippet from the paper |
|
|
70
|
+
| `publication_info` | object | Authors, venue, and year |
|
|
71
|
+
| `resources` | array | PDF and other resource links |
|
|
72
|
+
| `inline_links` | object | Cited-by, versions, and related links |
|
|
73
|
+
|
|
74
|
+
## Example workflows
|
|
75
|
+
|
|
76
|
+
### 1. Literature review into a sheet
|
|
77
|
+
|
|
78
|
+
1. **Manual Trigger**.
|
|
79
|
+
2. **Google Scholar**: Search Query your topic, Year From a recent year, Output `Simplified`.
|
|
80
|
+
3. **Google Sheets**: append each paper's `title`, `publicationInfo`, and `link`.
|
|
81
|
+
|
|
82
|
+
### 2. Track new papers on a topic
|
|
83
|
+
|
|
84
|
+
1. **Schedule Trigger**: run weekly.
|
|
85
|
+
2. **Google Scholar**: your topic, Year From the current year.
|
|
86
|
+
3. **Remove Duplicates** then **Slack**: alert on new papers.
|
|
87
|
+
|
|
88
|
+
### 3. Let an AI Agent do literature search
|
|
89
|
+
|
|
90
|
+
1. **AI Agent** node.
|
|
91
|
+
2. Attach **Google Scholar** as a tool.
|
|
92
|
+
3. Ask "Find recent papers on retrieval-augmented generation." The agent calls the node (in Simplified mode) and answers with matching papers.
|
|
93
|
+
|
|
94
|
+
## Pricing
|
|
95
|
+
|
|
96
|
+
This node calls the [Google Scholar API](https://apify.com/johnvc/google-scholar-api?fpr=9n7kx3) on Apify, which is billed **pay-per-result**, with no subscription and no minimums. Apify also includes a free monthly usage tier that covers typical volumes. See the [Actor page](https://apify.com/johnvc/google-scholar-api?fpr=9n7kx3) for current rates.
|
|
97
|
+
|
|
98
|
+
## Resources
|
|
99
|
+
|
|
100
|
+
- [Google Scholar API on Apify](https://apify.com/johnvc/google-scholar-api?fpr=9n7kx3)
|
|
101
|
+
- [npm package](https://www.npmjs.com/package/n8n-nodes-google-scholar-api)
|
|
102
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
103
|
+
- [Apify n8n integration guide](https://docs.apify.com/platform/integrations/n8n)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ApifyApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyApi = void 0;
|
|
4
|
+
class ApifyApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'apifyApi';
|
|
7
|
+
this.displayName = 'Apify API';
|
|
8
|
+
this.documentationUrl = 'https://docs.apify.com/platform/integrations/api#api-token';
|
|
9
|
+
this.icon = "file:../nodes/ApifyGoogleScholar/logo.svg";
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
this.authenticate = {
|
|
20
|
+
type: 'generic',
|
|
21
|
+
properties: {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
this.test = {
|
|
28
|
+
request: {
|
|
29
|
+
method: 'GET',
|
|
30
|
+
url: 'https://api.apify.com/v2/me',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ApifyApi = ApifyApi;
|
|
36
|
+
//# sourceMappingURL=ApifyApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyApi.credentials.js","sourceRoot":"","sources":["../../credentials/ApifyApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IAArB;QACC,SAAI,GAAG,UAAU,CAAC;QAElB,gBAAW,GAAG,WAAW,CAAC;QAE1B,qBAAgB,GAAG,4DAA4D,CAAC;QAEhF,SAAI,GAAS,2CAA2C,CAAA;QAExD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAKF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,6BAA6B;aAClC;SACD,CAAC;IACH,CAAC;CAAA;AArCD,4BAqCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ApifyOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string[];
|
|
5
|
+
displayName: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
documentationUrl: string;
|
|
8
|
+
properties: INodeProperties[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyOAuth2Api = void 0;
|
|
4
|
+
const scopes = ['profile', 'full_api_access'];
|
|
5
|
+
class ApifyOAuth2Api {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.name = 'apifyOAuth2Api';
|
|
8
|
+
this.extends = ['oAuth2Api'];
|
|
9
|
+
this.displayName = 'Apify OAuth2 API';
|
|
10
|
+
this.icon = "file:../nodes/ApifyGoogleScholar/logo.svg";
|
|
11
|
+
this.documentationUrl = 'https://docs.apify.com/api/v2';
|
|
12
|
+
this.properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Grant Type',
|
|
15
|
+
name: 'grantType',
|
|
16
|
+
type: 'hidden',
|
|
17
|
+
default: 'pkce',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Authorization URL',
|
|
21
|
+
name: 'authUrl',
|
|
22
|
+
type: 'hidden',
|
|
23
|
+
default: 'https://console.apify.com/authorize/oauth',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Access Token URL',
|
|
27
|
+
name: 'accessTokenUrl',
|
|
28
|
+
type: 'hidden',
|
|
29
|
+
default: 'https://console-backend.apify.com/oauth/apps/token',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Scope',
|
|
33
|
+
name: 'scope',
|
|
34
|
+
type: 'hidden',
|
|
35
|
+
default: `${scopes.join(' ')}`,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Auth URI Query Parameters',
|
|
39
|
+
name: 'authQueryParameters',
|
|
40
|
+
type: 'hidden',
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Authentication',
|
|
45
|
+
name: 'authentication',
|
|
46
|
+
type: 'hidden',
|
|
47
|
+
default: 'header',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Client ID',
|
|
51
|
+
name: 'clientId',
|
|
52
|
+
type: 'hidden',
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Client Secret',
|
|
57
|
+
name: 'clientSecret',
|
|
58
|
+
type: 'hidden',
|
|
59
|
+
default: '',
|
|
60
|
+
typeOptions: { password: true },
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ApifyOAuth2Api = ApifyOAuth2Api;
|
|
66
|
+
//# sourceMappingURL=ApifyOAuth2Api.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/ApifyOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE9C,MAAa,cAAc;IAA3B;QACC,SAAI,GAAG,gBAAgB,CAAC;QAExB,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,SAAI,GAAS,2CAA2C,CAAA;QAGxD,qBAAgB,GAAG,+BAA+B,CAAC;QAEnD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2CAA2C;aACpD;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oDAAoD;aAC7D;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;aAC9B;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;aACjB;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC/B;SACD,CAAC;IACH,CAAC;CAAA;AA/DD,wCA+DC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare const ACTOR_ID: string;
|
|
3
|
+
export declare const PACKAGE_NAME: string;
|
|
4
|
+
export declare const CLASS_NAME: string;
|
|
5
|
+
export declare const ClassNameCamel: string;
|
|
6
|
+
export declare const X_PLATFORM_HEADER_ID: string;
|
|
7
|
+
export declare const X_PLATFORM_APP_HEADER_ID: string;
|
|
8
|
+
export declare const DISPLAY_NAME: string;
|
|
9
|
+
export declare const DESCRIPTION: string;
|
|
10
|
+
export declare class ApifyGoogleScholar implements INodeType {
|
|
11
|
+
description: INodeTypeDescription;
|
|
12
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyGoogleScholar = exports.DESCRIPTION = exports.DISPLAY_NAME = exports.X_PLATFORM_APP_HEADER_ID = exports.X_PLATFORM_HEADER_ID = exports.ClassNameCamel = exports.CLASS_NAME = exports.PACKAGE_NAME = exports.ACTOR_ID = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const ApifyGoogleScholar_properties_1 = require("./ApifyGoogleScholar.properties");
|
|
6
|
+
const executeActor_1 = require("./helpers/executeActor");
|
|
7
|
+
exports.ACTOR_ID = 'm22qEjpnfxa4H1ijE';
|
|
8
|
+
exports.PACKAGE_NAME = 'n8n-nodes-google-scholar-api';
|
|
9
|
+
exports.CLASS_NAME = 'ApifyGoogleScholar';
|
|
10
|
+
exports.ClassNameCamel = exports.CLASS_NAME.charAt(0).toLowerCase() + exports.CLASS_NAME.slice(1);
|
|
11
|
+
exports.X_PLATFORM_HEADER_ID = 'n8n';
|
|
12
|
+
exports.X_PLATFORM_APP_HEADER_ID = 'google-scholar-app';
|
|
13
|
+
exports.DISPLAY_NAME = 'Google Scholar';
|
|
14
|
+
exports.DESCRIPTION = 'Search Google Scholar and return academic papers with titles, publication info, and links';
|
|
15
|
+
class ApifyGoogleScholar {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.description = {
|
|
18
|
+
displayName: exports.DISPLAY_NAME,
|
|
19
|
+
name: exports.ClassNameCamel,
|
|
20
|
+
icon: 'file:logo.svg',
|
|
21
|
+
group: ['transform'],
|
|
22
|
+
version: [1],
|
|
23
|
+
defaultVersion: 1,
|
|
24
|
+
subtitle: 'Search Papers',
|
|
25
|
+
description: exports.DESCRIPTION,
|
|
26
|
+
defaults: {
|
|
27
|
+
name: exports.DISPLAY_NAME,
|
|
28
|
+
},
|
|
29
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
30
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
31
|
+
usableAsTool: true,
|
|
32
|
+
credentials: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Apify API key connection',
|
|
35
|
+
name: 'apifyApi',
|
|
36
|
+
required: false,
|
|
37
|
+
displayOptions: {
|
|
38
|
+
show: {
|
|
39
|
+
authentication: ['apifyApi'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Apify OAuth2 connection',
|
|
45
|
+
name: 'apifyOAuth2Api',
|
|
46
|
+
required: false,
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
authentication: ['apifyOAuth2Api'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
properties: ApifyGoogleScholar_properties_1.properties,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async execute() {
|
|
58
|
+
const items = this.getInputData();
|
|
59
|
+
const returnData = [];
|
|
60
|
+
for (let i = 0; i < items.length; i++) {
|
|
61
|
+
try {
|
|
62
|
+
const data = await executeActor_1.runActor.call(this, i);
|
|
63
|
+
for (const item of data) {
|
|
64
|
+
returnData.push({ ...item, pairedItem: { item: i } });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (this.continueOnFail()) {
|
|
69
|
+
returnData.push({
|
|
70
|
+
json: { error: error.message },
|
|
71
|
+
pairedItem: { item: i },
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [returnData];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ApifyGoogleScholar = ApifyGoogleScholar;
|
|
82
|
+
//# sourceMappingURL=ApifyGoogleScholar.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyGoogleScholar.node.js","sourceRoot":"","sources":["../../../nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AACtB,mFAA6D;AAC7D,yDAAkD;AAGrC,QAAA,QAAQ,GAAG,mBAA6B,CAAC;AAEzC,QAAA,YAAY,GAAG,8BAAwC,CAAC;AACxD,QAAA,UAAU,GAAG,oBAA8B,CAAC;AAC5C,QAAA,cAAc,GAAG,kBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,kBAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1E,QAAA,oBAAoB,GAAG,KAAe,CAAC;AACvC,QAAA,wBAAwB,GAAG,oBAA8B,CAAC;AAE1D,QAAA,YAAY,GAAG,gBAA0B,CAAC;AAC1C,QAAA,WAAW,GACvB,2FAAqG,CAAC;AAEvG,MAAa,kBAAkB;IAA/B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,oBAAY;YACzB,IAAI,EAAE,sBAAc;YAGpB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,WAAW,CAAC;YAEpB,OAAO,EAAE,CAAC,CAAC,CAAC;YACZ,cAAc,EAAE,CAAC;YAGjB,QAAQ,EAAE,eAAe;YAGzB,WAAW,EAAE,mBAAW;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wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YAC/E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAzED,gDAyEC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-google-scholar-api",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": [
|
|
6
|
+
"Data & Storage",
|
|
7
|
+
"Analytics"
|
|
8
|
+
],
|
|
9
|
+
"resources": {
|
|
10
|
+
"credentialDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://docs.apify.com/platform/integrations/n8n"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"primaryDocumentation": [
|
|
16
|
+
{
|
|
17
|
+
"url": "https://apify.com/johnvc/google-scholar-api?fpr=9n7kx3"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"alias": [
|
|
22
|
+
"google scholar",
|
|
23
|
+
"scholar",
|
|
24
|
+
"academic papers",
|
|
25
|
+
"research papers",
|
|
26
|
+
"citations",
|
|
27
|
+
"academic search",
|
|
28
|
+
"scholarly",
|
|
29
|
+
"literature",
|
|
30
|
+
"papers",
|
|
31
|
+
"apify"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.properties = void 0;
|
|
4
|
+
exports.buildActorInput = buildActorInput;
|
|
5
|
+
function buildActorInput(context, itemIndex, defaultInput) {
|
|
6
|
+
const input = {
|
|
7
|
+
...defaultInput,
|
|
8
|
+
mode: 'search',
|
|
9
|
+
q: context.getNodeParameter('q', itemIndex),
|
|
10
|
+
hl: context.getNodeParameter('hl', itemIndex),
|
|
11
|
+
max_pages: context.getNodeParameter('max_pages', itemIndex),
|
|
12
|
+
};
|
|
13
|
+
const yearFrom = context.getNodeParameter('as_ylo', itemIndex, 0);
|
|
14
|
+
const yearTo = context.getNodeParameter('as_yhi', itemIndex, 0);
|
|
15
|
+
const num = context.getNodeParameter('num', itemIndex, 0);
|
|
16
|
+
if (yearFrom > 0)
|
|
17
|
+
input.as_ylo = yearFrom;
|
|
18
|
+
if (yearTo > 0)
|
|
19
|
+
input.as_yhi = yearTo;
|
|
20
|
+
if (num > 0)
|
|
21
|
+
input.num = num;
|
|
22
|
+
return input;
|
|
23
|
+
}
|
|
24
|
+
const resourceProperties = [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Resource',
|
|
27
|
+
name: 'resource',
|
|
28
|
+
type: 'options',
|
|
29
|
+
noDataExpression: true,
|
|
30
|
+
options: [
|
|
31
|
+
{
|
|
32
|
+
name: 'Paper',
|
|
33
|
+
value: 'paper',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
default: 'paper',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Operation',
|
|
40
|
+
name: 'operation',
|
|
41
|
+
type: 'options',
|
|
42
|
+
noDataExpression: true,
|
|
43
|
+
displayOptions: {
|
|
44
|
+
show: {
|
|
45
|
+
resource: ['paper'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Search',
|
|
51
|
+
value: 'search',
|
|
52
|
+
action: 'Search papers',
|
|
53
|
+
description: 'Search scholarly papers and return one item per result',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'search',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
const actorProperties = [
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Search Query',
|
|
62
|
+
name: 'q',
|
|
63
|
+
type: 'string',
|
|
64
|
+
required: true,
|
|
65
|
+
default: '',
|
|
66
|
+
placeholder: 'e.g. transformer neural networks',
|
|
67
|
+
description: 'The query to search scholarly papers for',
|
|
68
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Language Code',
|
|
72
|
+
name: 'hl',
|
|
73
|
+
type: 'string',
|
|
74
|
+
default: 'en',
|
|
75
|
+
placeholder: 'e.g. en',
|
|
76
|
+
description: 'Two-letter language code for the results',
|
|
77
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Year From',
|
|
81
|
+
name: 'as_ylo',
|
|
82
|
+
type: 'number',
|
|
83
|
+
default: 0,
|
|
84
|
+
typeOptions: { minValue: 0 },
|
|
85
|
+
description: 'Only include papers published on or after this year. Use 0 for no limit.',
|
|
86
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Year To',
|
|
90
|
+
name: 'as_yhi',
|
|
91
|
+
type: 'number',
|
|
92
|
+
default: 0,
|
|
93
|
+
typeOptions: { minValue: 0 },
|
|
94
|
+
description: 'Only include papers published on or before this year. Use 0 for no limit.',
|
|
95
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Number of Results',
|
|
99
|
+
name: 'num',
|
|
100
|
+
type: 'number',
|
|
101
|
+
default: 0,
|
|
102
|
+
typeOptions: { minValue: 0 },
|
|
103
|
+
description: 'How many results to request per page. Use 0 for the Actor default.',
|
|
104
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Maximum Pages',
|
|
108
|
+
name: 'max_pages',
|
|
109
|
+
type: 'number',
|
|
110
|
+
default: 1,
|
|
111
|
+
typeOptions: { minValue: 1 },
|
|
112
|
+
description: 'How many result pages to fetch',
|
|
113
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
const outputProperties = [
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Output',
|
|
119
|
+
name: 'output',
|
|
120
|
+
type: 'options',
|
|
121
|
+
noDataExpression: true,
|
|
122
|
+
displayOptions: { show: { resource: ['paper'], operation: ['search'] } },
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
name: 'Raw',
|
|
126
|
+
value: 'raw',
|
|
127
|
+
description: 'Return every field the API produces for each paper',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'Selected Fields',
|
|
131
|
+
value: 'selected',
|
|
132
|
+
description: 'Choose exactly which fields to return',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'Simplified',
|
|
136
|
+
value: 'simplified',
|
|
137
|
+
description: 'Return a compact set of the most useful paper fields',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
default: 'simplified',
|
|
141
|
+
description: 'How much data to return for each paper',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
displayName: 'Fields to Include',
|
|
145
|
+
name: 'fields',
|
|
146
|
+
type: 'multiOptions',
|
|
147
|
+
displayOptions: {
|
|
148
|
+
show: { resource: ['paper'], operation: ['search'], output: ['selected'] },
|
|
149
|
+
},
|
|
150
|
+
options: [
|
|
151
|
+
{ name: 'Inline Links', value: 'inline_links' },
|
|
152
|
+
{ name: 'Link', value: 'link' },
|
|
153
|
+
{ name: 'Paper Title', value: 'paper_title' },
|
|
154
|
+
{ name: 'Position', value: 'position' },
|
|
155
|
+
{ name: 'Publication Info', value: 'publication_info' },
|
|
156
|
+
{ name: 'Resources', value: 'resources' },
|
|
157
|
+
{ name: 'Result ID', value: 'result_id' },
|
|
158
|
+
{ name: 'Snippet', value: 'snippet' },
|
|
159
|
+
],
|
|
160
|
+
default: ['paper_title', 'link', 'snippet', 'publication_info'],
|
|
161
|
+
description: 'Which fields to return when Output is set to Selected Fields',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
const authenticationProperties = [
|
|
165
|
+
{
|
|
166
|
+
displayName: 'Authentication',
|
|
167
|
+
name: 'authentication',
|
|
168
|
+
type: 'options',
|
|
169
|
+
options: [
|
|
170
|
+
{
|
|
171
|
+
name: 'API Key',
|
|
172
|
+
value: 'apifyApi',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'OAuth2',
|
|
176
|
+
value: 'apifyOAuth2Api',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
default: 'apifyApi',
|
|
180
|
+
description: 'Choose which authentication method to use',
|
|
181
|
+
},
|
|
182
|
+
];
|
|
183
|
+
exports.properties = [
|
|
184
|
+
...resourceProperties,
|
|
185
|
+
...actorProperties,
|
|
186
|
+
...outputProperties,
|
|
187
|
+
...authenticationProperties,
|
|
188
|
+
];
|
|
189
|
+
//# sourceMappingURL=ApifyGoogleScholar.properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyGoogleScholar.properties.js","sourceRoot":"","sources":["../../../nodes/ApifyGoogleScholar/ApifyGoogleScholar.properties.ts"],"names":[],"mappings":";;;AAQA,0CAsBC;AAtBD,SAAgB,eAAe,CAC9B,OAA0B,EAC1B,SAAiB,EACjB,YAAiC;IAEjC,MAAM,KAAK,GAAwB;QAClC,GAAG,YAAY;QACf,IAAI,EAAE,QAAQ;QACd,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC;QAC3C,EAAE,EAAE,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;Q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gBAAgB;IACnB,GAAG,wBAAwB;CAC3B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function getDefaultBuild(this: IExecuteFunctions, actorId: string): Promise<any>;
|
|
3
|
+
export declare function getDefaultInputsFromBuild(build: any): Record<string, any>;
|
|
4
|
+
export declare function runActorApi(this: IExecuteFunctions, actorId: string, mergedInput: Record<string, any>, qs: Record<string, any>): Promise<any>;
|
|
5
|
+
export declare function runActor(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultBuild = getDefaultBuild;
|
|
4
|
+
exports.getDefaultInputsFromBuild = getDefaultInputsFromBuild;
|
|
5
|
+
exports.runActorApi = runActorApi;
|
|
6
|
+
exports.runActor = runActor;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const genericFunctions_1 = require("./genericFunctions");
|
|
9
|
+
const ApifyGoogleScholar_node_1 = require("../ApifyGoogleScholar.node");
|
|
10
|
+
const ApifyGoogleScholar_properties_1 = require("../ApifyGoogleScholar.properties");
|
|
11
|
+
async function getDefaultBuild(actorId) {
|
|
12
|
+
const defaultBuildResp = await genericFunctions_1.apiRequest.call(this, {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
uri: `/v2/acts/${actorId}/builds/default`,
|
|
15
|
+
});
|
|
16
|
+
if (!(defaultBuildResp === null || defaultBuildResp === void 0 ? void 0 : defaultBuildResp.data)) {
|
|
17
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
18
|
+
message: `Could not fetch default build for Actor ${actorId}`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return defaultBuildResp.data;
|
|
22
|
+
}
|
|
23
|
+
function getDefaultInputsFromBuild(build) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const buildInputProperties = (_b = (_a = build === null || build === void 0 ? void 0 : build.actorDefinition) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.properties;
|
|
26
|
+
const defaultInput = {};
|
|
27
|
+
if (buildInputProperties && typeof buildInputProperties === 'object') {
|
|
28
|
+
for (const [key, property] of Object.entries(buildInputProperties)) {
|
|
29
|
+
if (property &&
|
|
30
|
+
typeof property === 'object' &&
|
|
31
|
+
'prefill' in property &&
|
|
32
|
+
property.prefill !== undefined &&
|
|
33
|
+
property.prefill !== null) {
|
|
34
|
+
defaultInput[key] = property.prefill;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return defaultInput;
|
|
39
|
+
}
|
|
40
|
+
async function runActorApi(actorId, mergedInput, qs) {
|
|
41
|
+
return await genericFunctions_1.apiRequest.call(this, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
uri: `/v2/acts/${actorId}/runs`,
|
|
44
|
+
body: mergedInput,
|
|
45
|
+
qs,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function shapeItem(item, mode, fields) {
|
|
49
|
+
if (mode === 'raw') {
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
if (mode === 'selected') {
|
|
53
|
+
const picked = {};
|
|
54
|
+
for (const field of fields) {
|
|
55
|
+
if (field in item) {
|
|
56
|
+
picked[field] = item[field];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return picked;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
title: item.paper_title,
|
|
63
|
+
link: item.link,
|
|
64
|
+
snippet: item.snippet,
|
|
65
|
+
publicationInfo: item.publication_info,
|
|
66
|
+
resultId: item.result_id,
|
|
67
|
+
position: item.position,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function runActor(i) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const build = await getDefaultBuild.call(this, ApifyGoogleScholar_node_1.ACTOR_ID);
|
|
73
|
+
const defaultInput = getDefaultInputsFromBuild(build);
|
|
74
|
+
const mergedInput = (0, ApifyGoogleScholar_properties_1.buildActorInput)(this, i, defaultInput);
|
|
75
|
+
const run = await runActorApi.call(this, ApifyGoogleScholar_node_1.ACTOR_ID, mergedInput, { waitForFinish: 0 });
|
|
76
|
+
if (!((_a = run === null || run === void 0 ? void 0 : run.data) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
77
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
78
|
+
message: 'Run ID not found after starting the Actor',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const runId = run.data.id;
|
|
82
|
+
const datasetId = run.data.defaultDatasetId;
|
|
83
|
+
await genericFunctions_1.pollRunStatus.call(this, runId);
|
|
84
|
+
const items = await genericFunctions_1.getResults.call(this, datasetId);
|
|
85
|
+
let mode = this.getNodeParameter('output', i, 'simplified');
|
|
86
|
+
if ((0, genericFunctions_1.isUsedAsAiTool)(this.getNode().type)) {
|
|
87
|
+
mode = 'simplified';
|
|
88
|
+
}
|
|
89
|
+
const fields = (_b = this.getNodeParameter('fields', i, [])) !== null && _b !== void 0 ? _b : [];
|
|
90
|
+
const shaped = items.map((item) => shapeItem(item, mode, fields));
|
|
91
|
+
return this.helpers.returnJsonArray(shaped);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=executeActor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeActor.js","sourceRoot":"","sources":["../../../../nodes/ApifyGoogleScholar/helpers/executeActor.ts"],"names":[],"mappings":";;AAKA,0CAWC;AAED,8DAiBC;AAED,kCAYC;AAoCD,4BAyBC;AA9GD,+CAAmF;AACnF,yDAA2F;AAC3F,wEAAsD;AACtD,oFAAmE;AAE5D,KAAK,UAAU,eAAe,CAA0B,OAAe;IAC7E,MAAM,gBAAgB,GAAG,MAAM,6BAAU,CAAC,IAAI,CAAC,IAAI,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AM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE;YACtC,OAAO,EAAE,2CAA2C;SACpD,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC5C,MAAM,gCAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,6BAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAErD,IAAI,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,CAAW,CAAC;IACtE,IAAI,IAAA,iCAAc,EAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,IAAI,GAAG,YAAY,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,MAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAc,mCAAI,EAAE,CAAC;IAE1E,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type IHookFunctions, type ILoadOptionsFunctions, type IHttpRequestOptions } from 'n8n-workflow';
|
|
2
|
+
type IApiRequestOptions = Omit<IHttpRequestOptions, 'url'> & {
|
|
3
|
+
uri?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, requestOptions: IApiRequestOptions): Promise<any>;
|
|
7
|
+
export declare function isUsedAsAiTool(nodeType: string): boolean;
|
|
8
|
+
export declare function pollRunStatus(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, runId: string): Promise<any>;
|
|
9
|
+
export declare function getResults(this: IExecuteFunctions, datasetId: string): Promise<any[]>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiRequest = apiRequest;
|
|
4
|
+
exports.isUsedAsAiTool = isUsedAsAiTool;
|
|
5
|
+
exports.pollRunStatus = pollRunStatus;
|
|
6
|
+
exports.getResults = getResults;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const ApifyGoogleScholar_node_1 = require("../ApifyGoogleScholar.node");
|
|
9
|
+
async function apiRequest(requestOptions) {
|
|
10
|
+
var _a;
|
|
11
|
+
const { method = 'GET', qs, uri, ...rest } = requestOptions;
|
|
12
|
+
const query = qs || {};
|
|
13
|
+
const endpoint = `https://api.apify.com${uri !== null && uri !== void 0 ? uri : ''}`;
|
|
14
|
+
const headers = {
|
|
15
|
+
'x-apify-integration-platform': ApifyGoogleScholar_node_1.X_PLATFORM_HEADER_ID,
|
|
16
|
+
...(ApifyGoogleScholar_node_1.X_PLATFORM_APP_HEADER_ID && { 'x-apify-integration-app-id': ApifyGoogleScholar_node_1.X_PLATFORM_APP_HEADER_ID }),
|
|
17
|
+
};
|
|
18
|
+
if (isUsedAsAiTool(this.getNode().type)) {
|
|
19
|
+
headers['x-apify-integration-ai-tool'] = 'true';
|
|
20
|
+
}
|
|
21
|
+
const options = {
|
|
22
|
+
...rest,
|
|
23
|
+
method,
|
|
24
|
+
qs: query,
|
|
25
|
+
url: endpoint,
|
|
26
|
+
headers,
|
|
27
|
+
json: true,
|
|
28
|
+
};
|
|
29
|
+
if (method === 'GET' && 'body' in options) {
|
|
30
|
+
delete options.body;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
|
34
|
+
try {
|
|
35
|
+
await this.getCredentials(authenticationMethod);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No valid credentials found for ${authenticationMethod}. Please configure them first.`);
|
|
39
|
+
}
|
|
40
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, authenticationMethod, options);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const apiError = error;
|
|
44
|
+
const body = (_a = apiError.response) === null || _a === void 0 ? void 0 : _a.body;
|
|
45
|
+
if (body) {
|
|
46
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), apiError, {
|
|
47
|
+
message: typeof body === 'string' ? body : JSON.stringify(body),
|
|
48
|
+
description: apiError.message,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), apiError);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function isUsedAsAiTool(nodeType) {
|
|
55
|
+
const parts = nodeType.split('.');
|
|
56
|
+
return parts[parts.length - 1] === `${ApifyGoogleScholar_node_1.ClassNameCamel}Tool`;
|
|
57
|
+
}
|
|
58
|
+
async function pollRunStatus(runId) {
|
|
59
|
+
var _a;
|
|
60
|
+
let lastRunData;
|
|
61
|
+
while (true) {
|
|
62
|
+
try {
|
|
63
|
+
const pollResult = await apiRequest.call(this, {
|
|
64
|
+
method: 'GET',
|
|
65
|
+
uri: `/v2/actor-runs/${runId}`,
|
|
66
|
+
});
|
|
67
|
+
const status = (_a = pollResult === null || pollResult === void 0 ? void 0 : pollResult.data) === null || _a === void 0 ? void 0 : _a.status;
|
|
68
|
+
lastRunData = pollResult === null || pollResult === void 0 ? void 0 : pollResult.data;
|
|
69
|
+
if (['SUCCEEDED', 'FAILED', 'TIMED-OUT', 'ABORTED'].includes(status))
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
74
|
+
message: `Error polling run status: ${err}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
await (0, n8n_workflow_1.sleep)(1000);
|
|
78
|
+
}
|
|
79
|
+
return lastRunData;
|
|
80
|
+
}
|
|
81
|
+
async function getResults(datasetId) {
|
|
82
|
+
const results = await apiRequest.call(this, {
|
|
83
|
+
method: 'GET',
|
|
84
|
+
uri: `/v2/datasets/${datasetId}/items`,
|
|
85
|
+
});
|
|
86
|
+
if (Array.isArray(results)) {
|
|
87
|
+
return results;
|
|
88
|
+
}
|
|
89
|
+
return results ? [results] : [];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=genericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genericFunctions.js","sourceRoot":"","sources":["../../../../nodes/ApifyGoogleScholar/helpers/genericFunctions.ts"],"names":[],"mappings":";;AAuBA,gCAiEC;AAKD,wCAGC;AAKD,sCAuBC;AAMD,gCAUC;AA5ID,+CASsB;AACtB,wEAA4G;AAarG,KAAK,UAAU,UAAU,CAE/B,cAAkC;;IAElC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,CAAC;IAE5D,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,wBAAwB,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,EAAE,CAAC;IAErD,MAAM,OAAO,GAA2B;QACvC,8BAA8B,EAAE,8CAAoB;QACpD,GAAG,CAAC,kDAAwB,IAAI,EAAE,4BAA4B,EAAE,kDAAwB,EAAE,CAAC;KAC3F,CAAC;IAEF,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CA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gB,SAAS,QAAQ;KACtC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IAChB,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
|
|
2
|
+
<!-- badge -->
|
|
3
|
+
<rect x="4" y="4" width="56" height="56" rx="14" fill="#1D4ED8"/>
|
|
4
|
+
<!-- graduation cap -->
|
|
5
|
+
<path d="M32 18 L52 26 L32 34 L12 26 Z" fill="#DBEAFE"/>
|
|
6
|
+
<path d="M22 30 V40 C22 43 41 43 41 40 V30" fill="none" stroke="#DBEAFE" stroke-width="3"/>
|
|
7
|
+
<!-- tassel -->
|
|
8
|
+
<line x1="52" y1="26" x2="52" y2="38" stroke="#DBEAFE" stroke-width="2.5"/>
|
|
9
|
+
<circle cx="52" cy="40" r="2.5" fill="#FBBF24"/>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-google-scholar-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Search Google Scholar and return academic papers with titles, publication info, and links. Apify-backed n8n community node, pay-per-result, and usable as an AI agent tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n-nodes",
|
|
8
|
+
"n8n",
|
|
9
|
+
"google-scholar",
|
|
10
|
+
"scholar",
|
|
11
|
+
"academic-papers",
|
|
12
|
+
"research-papers",
|
|
13
|
+
"citations",
|
|
14
|
+
"scholarly",
|
|
15
|
+
"apify",
|
|
16
|
+
"ai-tool"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "John Cole",
|
|
21
|
+
"email": "tirade.charge_4v@icloud.com"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/johnisanerd/n8n-nodes-google-scholar-api.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/johnisanerd/n8n-nodes-google-scholar-api#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/johnisanerd/n8n-nodes-google-scholar-api/issues"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.10"
|
|
33
|
+
},
|
|
34
|
+
"packageManager": "npm@10.8.2",
|
|
35
|
+
"main": "index.js",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "n8n-node build",
|
|
38
|
+
"dev": "n8n-node dev",
|
|
39
|
+
"lint": "n8n-node lint",
|
|
40
|
+
"lint:fix": "n8n-node lint --fix"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"n8n": {
|
|
46
|
+
"n8nNodesApiVersion": 1,
|
|
47
|
+
"credentials": [
|
|
48
|
+
"dist/credentials/ApifyApi.credentials.js",
|
|
49
|
+
"dist/credentials/ApifyOAuth2Api.credentials.js"
|
|
50
|
+
],
|
|
51
|
+
"nodes": [
|
|
52
|
+
"dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.js"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"n8n-workflow": "*"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@n8n/node-cli": "0.32.1",
|
|
60
|
+
"@types/jest": "^29.5.14",
|
|
61
|
+
"@types/node": "^24.0.1",
|
|
62
|
+
"apify-client": "^2.16.0",
|
|
63
|
+
"chalk": "^5.6.0",
|
|
64
|
+
"eslint": "9.29.0",
|
|
65
|
+
"glob": "^11.0.3",
|
|
66
|
+
"gulp": "^4.0.2",
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"nock": "^14.0.5",
|
|
69
|
+
"prettier": "^3.6.2",
|
|
70
|
+
"sharp": "^0.34.2",
|
|
71
|
+
"ts-jest": "^29.3.2",
|
|
72
|
+
"typescript": "5.9.2"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-google-scholar-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Search Google Scholar and return academic papers with titles, publication info, and links. Apify-backed n8n community node, pay-per-result, and usable as an AI agent tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n-nodes",
|
|
8
|
+
"n8n",
|
|
9
|
+
"google-scholar",
|
|
10
|
+
"scholar",
|
|
11
|
+
"academic-papers",
|
|
12
|
+
"research-papers",
|
|
13
|
+
"citations",
|
|
14
|
+
"scholarly",
|
|
15
|
+
"apify",
|
|
16
|
+
"ai-tool"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "John Cole",
|
|
21
|
+
"email": "tirade.charge_4v@icloud.com"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/johnisanerd/n8n-nodes-google-scholar-api.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/johnisanerd/n8n-nodes-google-scholar-api#readme",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/johnisanerd/n8n-nodes-google-scholar-api/issues"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.10"
|
|
33
|
+
},
|
|
34
|
+
"packageManager": "npm@10.8.2",
|
|
35
|
+
"main": "index.js",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "n8n-node build",
|
|
38
|
+
"dev": "n8n-node dev",
|
|
39
|
+
"lint": "n8n-node lint",
|
|
40
|
+
"lint:fix": "n8n-node lint --fix"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"n8n": {
|
|
46
|
+
"n8nNodesApiVersion": 1,
|
|
47
|
+
"credentials": [
|
|
48
|
+
"dist/credentials/ApifyApi.credentials.js",
|
|
49
|
+
"dist/credentials/ApifyOAuth2Api.credentials.js"
|
|
50
|
+
],
|
|
51
|
+
"nodes": [
|
|
52
|
+
"dist/nodes/ApifyGoogleScholar/ApifyGoogleScholar.node.js"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"n8n-workflow": "*"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@n8n/node-cli": "0.32.1",
|
|
60
|
+
"@types/jest": "^29.5.14",
|
|
61
|
+
"@types/node": "^24.0.1",
|
|
62
|
+
"apify-client": "^2.16.0",
|
|
63
|
+
"chalk": "^5.6.0",
|
|
64
|
+
"eslint": "9.29.0",
|
|
65
|
+
"glob": "^11.0.3",
|
|
66
|
+
"gulp": "^4.0.2",
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"nock": "^14.0.5",
|
|
69
|
+
"prettier": "^3.6.2",
|
|
70
|
+
"sharp": "^0.34.2",
|
|
71
|
+
"ts-jest": "^29.3.2",
|
|
72
|
+
"typescript": "5.9.2"
|
|
73
|
+
}
|
|
74
|
+
}
|