Skip to content

Commit 90ac774

Browse files
committed
add base n8n-nodes-scrapfly package
1 parent 4151319 commit 90ac774

29 files changed

+13859
-7
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = tab
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[package.json]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[*.yml]
19+
indent_style = space
20+
indent_size = 2

.eslintrc.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* @type {import('@types/eslint').ESLint.ConfigData}
3+
*/
4+
module.exports = {
5+
root: true,
6+
7+
env: {
8+
browser: true,
9+
es6: true,
10+
node: true,
11+
},
12+
13+
parser: '@typescript-eslint/parser',
14+
15+
parserOptions: {
16+
project: ['./tsconfig.json'],
17+
sourceType: 'module',
18+
extraFileExtensions: ['.json'],
19+
},
20+
21+
ignorePatterns: ['.eslintrc.js', '**/*.js', '**/node_modules/**', '**/dist/**'],
22+
23+
overrides: [
24+
{
25+
files: ['package.json'],
26+
plugins: ['eslint-plugin-n8n-nodes-base'],
27+
extends: ['plugin:n8n-nodes-base/community'],
28+
rules: {
29+
'n8n-nodes-base/community-package-json-name-still-default': 'off',
30+
},
31+
},
32+
{
33+
files: ['./credentials/**/*.ts'],
34+
plugins: ['eslint-plugin-n8n-nodes-base'],
35+
extends: ['plugin:n8n-nodes-base/credentials'],
36+
rules: {
37+
'n8n-nodes-base/cred-class-field-documentation-url-missing': 'off',
38+
'n8n-nodes-base/cred-class-field-documentation-url-miscased': 'off',
39+
},
40+
},
41+
{
42+
files: ['./nodes/**/*.ts'],
43+
plugins: ['eslint-plugin-n8n-nodes-base'],
44+
extends: ['plugin:n8n-nodes-base/nodes'],
45+
rules: {
46+
'n8n-nodes-base/node-execute-block-missing-continue-on-fail': 'off',
47+
'n8n-nodes-base/node-resource-description-filename-against-convention': 'off',
48+
'n8n-nodes-base/node-param-fixed-collection-type-unsorted-items': 'off',
49+
},
50+
},
51+
],
52+
};

.eslintrc.prepublish.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @type {import('@types/eslint').ESLint.ConfigData}
3+
*/
4+
module.exports = {
5+
extends: "./.eslintrc.js",
6+
7+
overrides: [
8+
{
9+
files: ['package.json'],
10+
plugins: ['eslint-plugin-n8n-nodes-base'],
11+
rules: {
12+
'n8n-nodes-base/community-package-json-name-still-default': 'error',
13+
},
14+
},
15+
],
16+
};

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
.DS_Store
3+
.tmp
4+
tmp
5+
dist
6+
npm-debug.log*
7+
yarn.lock
8+
.vscode/launch.json

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
*.tsbuildinfo

.prettierrc.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = {
2+
/**
3+
* https://prettier.io/docs/en/options.html#semicolons
4+
*/
5+
semi: true,
6+
7+
/**
8+
* https://prettier.io/docs/en/options.html#trailing-commas
9+
*/
10+
trailingComma: 'all',
11+
12+
/**
13+
* https://prettier.io/docs/en/options.html#bracket-spacing
14+
*/
15+
bracketSpacing: true,
16+
17+
/**
18+
* https://prettier.io/docs/en/options.html#tabs
19+
*/
20+
useTabs: true,
21+
22+
/**
23+
* https://prettier.io/docs/en/options.html#tab-width
24+
*/
25+
tabWidth: 2,
26+
27+
/**
28+
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
29+
*/
30+
arrowParens: 'always',
31+
32+
/**
33+
* https://prettier.io/docs/en/options.html#quotes
34+
*/
35+
singleQuote: true,
36+
37+
/**
38+
* https://prettier.io/docs/en/options.html#quote-props
39+
*/
40+
quoteProps: 'as-needed',
41+
42+
/**
43+
* https://prettier.io/docs/en/options.html#end-of-line
44+
*/
45+
endOfLine: 'lf',
46+
47+
/**
48+
* https://prettier.io/docs/en/options.html#print-width
49+
*/
50+
printWidth: 100,
51+
};

LICENSE

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
BSD 2-Clause License
2+
--------------------
23

3-
Copyright (c) 2024, Scrapfly
4+
Copyright (c) 2013-2016, Scrapfly <https://scrapfly.io> and
5+
individual contributors. All rights reserved.
46

57
Redistribution and use in source and binary forms, with or without
68
modification, are permitted provided that the following conditions are met:
79

8-
1. Redistributions of source code must retain the above copyright notice, this
9-
list of conditions and the following disclaimer.
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
1012

11-
2. Redistributions in binary form must reproduce the above copyright notice,
12-
this list of conditions and the following disclaimer in the documentation
13-
and/or other materials provided with the distribution.
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
1416

1517
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1618
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -21,4 +23,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2123
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2224
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2325
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# n8n-nodes-scrapfly
2+
3+
This is an n8n community node. It lets you use ScrapFly in your n8n workflows. [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
4+
5+
[ScrapFly.io](https://scrapfly.io/) provides data collection APIs for web page scraping, screenshots, and AI data extraction at scale. Integrating ScrapFly within a workflow enables extracting web page sources, parsing for structured data, or taking screenshots as binary files.
6+
7+
## Installation
8+
9+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
10+
11+
## Operations
12+
- __Scrape web page URLs__
13+
Scrapes the HTML source of a given web page URL with the support of headless browsers, proxies, and antibot bypass.
14+
- __Extract Data From an HTML, Text, or Markdown Document Using AI__
15+
Automatically parse HTML, Text, or Markdown documents to extract structurued data using pre-defined templates or LLM prompts.
16+
- __Capture web page screenshot__
17+
Takes a screenshot of a web page as an image file given its URL.
18+
- __Get account info__
19+
Get information about the current account subscription its usage.
20+
21+
## Credentials
22+
23+
ScrapFly API key is used as a credential key. To get your API key, register for free.
24+
25+
## Compatibility
26+
27+
_State the minimum n8n version, as well as which versions you test against. You can also include any known version incompatibility issues._
28+
29+
## Usage
30+
31+
For example usage and predefined workflow tempaltes, refer to [ScrapFly's n8n integration docs](https://scrapfly.io/docs/integration/n8n).
32+
33+
## Resources
34+
35+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
36+
* [ScrapFly documentation](https://scrapfly.io/docs)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {
2+
IAuthenticateGeneric,
3+
ICredentialType,
4+
INodeProperties,
5+
} from 'n8n-workflow';
6+
7+
export class ScrapflyApi implements ICredentialType {
8+
name = 'ScrapflyApi';
9+
displayName = 'ScrapflyApi API';
10+
documentationUrl = 'https://scrapfly.io/dashboard';
11+
properties: INodeProperties[] = [
12+
{
13+
displayName: 'API Key',
14+
name: 'apiKey',
15+
type: 'string',
16+
typeOptions: { password: true },
17+
default: '',
18+
},
19+
];
20+
authenticate: IAuthenticateGeneric = {
21+
type: 'generic',
22+
properties: {
23+
qs: {
24+
key: '={{$credentials.apiKey}}'
25+
},
26+
},
27+
};
28+
}

gulpfile.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const path = require('path');
2+
const { task, src, dest } = require('gulp');
3+
4+
task('build:icons', copyIcons);
5+
6+
function copyIcons() {
7+
const nodeSource = path.resolve('nodes', '**', '*.{png,svg}');
8+
const nodeDestination = path.resolve('dist', 'nodes');
9+
10+
src(nodeSource).pipe(dest(nodeDestination));
11+
12+
const credSource = path.resolve('credentials', '**', '*.{png,svg}');
13+
const credDestination = path.resolve('dist', 'credentials');
14+
15+
return src(credSource).pipe(dest(credDestination));
16+
}

0 commit comments

Comments
 (0)