@crawlee/templates 3.0.5-beta.8 → 3.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/index.d.ts +13 -4
- package/index.d.ts.map +1 -1
- package/index.js +18 -2
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/manifest.json +0 -36
- package/templates/cheerio-js/.dockerignore +0 -10
- package/templates/cheerio-js/Dockerfile +0 -29
- package/templates/cheerio-js/README.md +0 -27
- package/templates/cheerio-js/package.json +0 -15
- package/templates/cheerio-js/src/main.js +0 -12
- package/templates/cheerio-js/src/routes.js +0 -21
- package/templates/cheerio-ts/.dockerignore +0 -10
- package/templates/cheerio-ts/Dockerfile +0 -50
- package/templates/cheerio-ts/README.md +0 -27
- package/templates/cheerio-ts/package.json +0 -23
- package/templates/cheerio-ts/src/main.ts +0 -12
- package/templates/cheerio-ts/src/routes.ts +0 -21
- package/templates/cheerio-ts/tsconfig.json +0 -13
- package/templates/getting-started-js/.dockerignore +0 -10
- package/templates/getting-started-js/Dockerfile +0 -29
- package/templates/getting-started-js/README.md +0 -9
- package/templates/getting-started-js/package.json +0 -16
- package/templates/getting-started-js/src/main.js +0 -24
- package/templates/getting-started-ts/.dockerignore +0 -10
- package/templates/getting-started-ts/Dockerfile +0 -51
- package/templates/getting-started-ts/README.md +0 -9
- package/templates/getting-started-ts/package.json +0 -24
- package/templates/getting-started-ts/src/main.ts +0 -24
- package/templates/getting-started-ts/tsconfig.json +0 -13
- package/templates/playwright-js/.dockerignore +0 -10
- package/templates/playwright-js/Dockerfile +0 -29
- package/templates/playwright-js/README.md +0 -8
- package/templates/playwright-js/package.json +0 -16
- package/templates/playwright-js/src/main.js +0 -12
- package/templates/playwright-js/src/routes.js +0 -21
- package/templates/playwright-ts/.dockerignore +0 -10
- package/templates/playwright-ts/Dockerfile +0 -51
- package/templates/playwright-ts/README.md +0 -8
- package/templates/playwright-ts/package.json +0 -24
- package/templates/playwright-ts/src/main.ts +0 -12
- package/templates/playwright-ts/src/routes.ts +0 -21
- package/templates/playwright-ts/tsconfig.json +0 -13
- package/templates/puppeteer-js/.dockerignore +0 -10
- package/templates/puppeteer-js/Dockerfile +0 -29
- package/templates/puppeteer-js/README.md +0 -8
- package/templates/puppeteer-js/package.json +0 -16
- package/templates/puppeteer-js/src/main.js +0 -12
- package/templates/puppeteer-js/src/routes.js +0 -21
- package/templates/puppeteer-ts/.dockerignore +0 -10
- package/templates/puppeteer-ts/Dockerfile +0 -51
- package/templates/puppeteer-ts/README.md +0 -8
- package/templates/puppeteer-ts/package.json +0 -24
- package/templates/puppeteer-ts/src/main.ts +0 -12
- package/templates/puppeteer-ts/src/routes.ts +0 -21
- package/templates/puppeteer-ts/tsconfig.json +0 -13
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Dataset, createPlaywrightRouter } from 'crawlee';
|
|
2
|
-
|
|
3
|
-
export const router = createPlaywrightRouter();
|
|
4
|
-
|
|
5
|
-
router.addDefaultHandler(async ({ enqueueLinks, log }) => {
|
|
6
|
-
log.info(`enqueueing new URLs`);
|
|
7
|
-
await enqueueLinks({
|
|
8
|
-
globs: ['https://crawlee.dev/**'],
|
|
9
|
-
label: 'detail',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
router.addHandler('detail', async ({ request, page, log }) => {
|
|
14
|
-
const title = await page.title();
|
|
15
|
-
log.info(`${title}`, { url: request.loadedUrl });
|
|
16
|
-
|
|
17
|
-
await Dataset.pushData({
|
|
18
|
-
url: request.loadedUrl,
|
|
19
|
-
title,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Specify the base Docker image. You can read more about
|
|
2
|
-
# the available images at https://crawlee.dev/docs/guides/docker-images
|
|
3
|
-
# You can also use any other image from Docker Hub.
|
|
4
|
-
FROM apify/actor-node-playwright-chrome:16 AS builder
|
|
5
|
-
|
|
6
|
-
# Copy just package.json and package-lock.json
|
|
7
|
-
# to speed up the build using Docker layer cache.
|
|
8
|
-
COPY --chown=myuser package*.json ./
|
|
9
|
-
|
|
10
|
-
# Install all dependencies. Don't audit to speed up the installation.
|
|
11
|
-
RUN npm install --include=dev --audit=false
|
|
12
|
-
|
|
13
|
-
# Next, copy the source files using the user set
|
|
14
|
-
# in the base image.
|
|
15
|
-
COPY --chown=myuser . ./
|
|
16
|
-
|
|
17
|
-
# Install all dependencies and build the project.
|
|
18
|
-
# Don't audit to speed up the installation.
|
|
19
|
-
RUN npm run build
|
|
20
|
-
|
|
21
|
-
# Create final image
|
|
22
|
-
FROM apify/actor-node-playwright-chrome:16
|
|
23
|
-
|
|
24
|
-
# Copy only built JS files from builder image
|
|
25
|
-
COPY --from=builder --chown=myuser /home/myuser/dist ./dist
|
|
26
|
-
|
|
27
|
-
# Copy just package.json and package-lock.json
|
|
28
|
-
# to speed up the build using Docker layer cache.
|
|
29
|
-
COPY --chown=myuser package*.json ./
|
|
30
|
-
|
|
31
|
-
# Install NPM packages, skip optional and development dependencies to
|
|
32
|
-
# keep the image small. Avoid logging too much and print the dependency
|
|
33
|
-
# tree for debugging
|
|
34
|
-
RUN npm --quiet set progress=false \
|
|
35
|
-
&& npm install --omit=dev --omit=optional \
|
|
36
|
-
&& echo "Installed NPM packages:" \
|
|
37
|
-
&& (npm list --omit=dev --all || true) \
|
|
38
|
-
&& echo "Node.js version:" \
|
|
39
|
-
&& node --version \
|
|
40
|
-
&& echo "NPM version:" \
|
|
41
|
-
&& npm --version
|
|
42
|
-
|
|
43
|
-
# Next, copy the remaining files and directories with the source code.
|
|
44
|
-
# Since we do this after NPM install, quick build will be really fast
|
|
45
|
-
# for most source file changes.
|
|
46
|
-
COPY --chown=myuser . ./
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Run the image. If you know you won't need headful browsers,
|
|
50
|
-
# you can remove the XVFB start script for a micro perf gain.
|
|
51
|
-
CMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Crawlee + PlaywrightCrawler + TypeScript project
|
|
2
|
-
|
|
3
|
-
This template is a production ready boilerplate for developing with `PlaywrightCrawler`. Use this to bootstrap your projects using the most up-to-date code.
|
|
4
|
-
|
|
5
|
-
If you're looking for examples or want to learn more visit:
|
|
6
|
-
|
|
7
|
-
- [Documentation](https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler)
|
|
8
|
-
- [Examples](https://crawlee.dev/docs/examples/playwright-crawler)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "crawlee-playwright-ts",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "This is an example of a Crawlee project.",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"crawlee": "^3.0.0",
|
|
8
|
-
"playwright": "*"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@apify/tsconfig": "^0.1.0",
|
|
12
|
-
"ts-node": "^10.8.0",
|
|
13
|
-
"typescript": "^4.7.4"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"start": "npm run start:dev",
|
|
17
|
-
"start:prod": "node dist/main.js",
|
|
18
|
-
"start:dev": "ts-node-esm -T src/main.ts",
|
|
19
|
-
"build": "tsc",
|
|
20
|
-
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
|
|
21
|
-
},
|
|
22
|
-
"author": "It's not you it's me",
|
|
23
|
-
"license": "ISC"
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// For more information, see https://crawlee.dev/
|
|
2
|
-
import { PlaywrightCrawler, ProxyConfiguration } from 'crawlee';
|
|
3
|
-
import { router } from './routes.js';
|
|
4
|
-
|
|
5
|
-
const startUrls = ['https://crawlee.dev'];
|
|
6
|
-
|
|
7
|
-
const crawler = new PlaywrightCrawler({
|
|
8
|
-
// proxyConfiguration: new ProxyConfiguration({ proxyUrls: ['...'] }),
|
|
9
|
-
requestHandler: router,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
await crawler.run(startUrls);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Dataset, createPlaywrightRouter } from 'crawlee';
|
|
2
|
-
|
|
3
|
-
export const router = createPlaywrightRouter();
|
|
4
|
-
|
|
5
|
-
router.addDefaultHandler(async ({ enqueueLinks, log }) => {
|
|
6
|
-
log.info(`enqueueing new URLs`);
|
|
7
|
-
await enqueueLinks({
|
|
8
|
-
globs: ['https://crawlee.dev/**'],
|
|
9
|
-
label: 'detail',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
router.addHandler('detail', async ({ request, page, log }) => {
|
|
14
|
-
const title = await page.title();
|
|
15
|
-
log.info(`${title}`, { url: request.loadedUrl });
|
|
16
|
-
|
|
17
|
-
await Dataset.pushData({
|
|
18
|
-
url: request.loadedUrl,
|
|
19
|
-
title,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Specify the base Docker image. You can read more about
|
|
2
|
-
# the available images at https://crawlee.dev/docs/guides/docker-images
|
|
3
|
-
# You can also use any other image from Docker Hub.
|
|
4
|
-
FROM apify/actor-node-puppeteer-chrome:16
|
|
5
|
-
|
|
6
|
-
# Copy just package.json and package-lock.json
|
|
7
|
-
# to speed up the build using Docker layer cache.
|
|
8
|
-
COPY --chown=myuser package*.json ./
|
|
9
|
-
|
|
10
|
-
# Install NPM packages, skip optional and development dependencies to
|
|
11
|
-
# keep the image small. Avoid logging too much and print the dependency
|
|
12
|
-
# tree for debugging
|
|
13
|
-
RUN npm --quiet set progress=false \
|
|
14
|
-
&& npm install --omit=dev --omit=optional \
|
|
15
|
-
&& echo "Installed NPM packages:" \
|
|
16
|
-
&& (npm list --omit=dev --all || true) \
|
|
17
|
-
&& echo "Node.js version:" \
|
|
18
|
-
&& node --version \
|
|
19
|
-
&& echo "NPM version:" \
|
|
20
|
-
&& npm --version
|
|
21
|
-
|
|
22
|
-
# Next, copy the remaining files and directories with the source code.
|
|
23
|
-
# Since we do this after NPM install, quick build will be really fast
|
|
24
|
-
# for most source file changes.
|
|
25
|
-
COPY --chown=myuser . ./
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Run the image.
|
|
29
|
-
CMD npm start --silent
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Crawlee + PuppeteerCrawler + JavaScript project
|
|
2
|
-
|
|
3
|
-
This template is a production ready boilerplate for developing with `PuppeteerCrawler`. Use this to bootstrap your projects using the most up-to-date code.
|
|
4
|
-
|
|
5
|
-
If you're looking for examples or want to learn more visit:
|
|
6
|
-
|
|
7
|
-
- [Documentation](https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler)
|
|
8
|
-
- [Examples](https://crawlee.dev/docs/examples/puppeteer-crawler)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "crawlee-puppeteer-js",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "This is an example of a Crawlee project.",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"crawlee": "^3.0.0",
|
|
8
|
-
"puppeteer": "*"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"start": "node src/main.js",
|
|
12
|
-
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
|
|
13
|
-
},
|
|
14
|
-
"author": "It's not you it's me",
|
|
15
|
-
"license": "ISC"
|
|
16
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// For more information, see https://crawlee.dev/
|
|
2
|
-
import { PuppeteerCrawler, ProxyConfiguration } from 'crawlee';
|
|
3
|
-
import { router } from './routes.js';
|
|
4
|
-
|
|
5
|
-
const startUrls = ['https://crawlee.dev'];
|
|
6
|
-
|
|
7
|
-
const crawler = new PuppeteerCrawler({
|
|
8
|
-
// proxyConfiguration: new ProxyConfiguration({ proxyUrls: ['...'] }),
|
|
9
|
-
requestHandler: router,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
await crawler.run(startUrls);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Dataset, createPuppeteerRouter } from 'crawlee';
|
|
2
|
-
|
|
3
|
-
export const router = createPuppeteerRouter();
|
|
4
|
-
|
|
5
|
-
router.addDefaultHandler(async ({ enqueueLinks, log }) => {
|
|
6
|
-
log.info(`enqueueing new URLs`);
|
|
7
|
-
await enqueueLinks({
|
|
8
|
-
globs: ['https://crawlee.dev/**'],
|
|
9
|
-
label: 'detail',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
router.addHandler('detail', async ({ request, page, log }) => {
|
|
14
|
-
const title = await page.title();
|
|
15
|
-
log.info(`${title}`, { url: request.loadedUrl });
|
|
16
|
-
|
|
17
|
-
await Dataset.pushData({
|
|
18
|
-
url: request.loadedUrl,
|
|
19
|
-
title,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Specify the base Docker image. You can read more about
|
|
2
|
-
# the available images at https://crawlee.dev/docs/guides/docker-images
|
|
3
|
-
# You can also use any other image from Docker Hub.
|
|
4
|
-
FROM apify/actor-node-puppeteer-chrome:16 AS builder
|
|
5
|
-
|
|
6
|
-
# Copy just package.json and package-lock.json
|
|
7
|
-
# to speed up the build using Docker layer cache.
|
|
8
|
-
COPY --chown=myuser package*.json ./
|
|
9
|
-
|
|
10
|
-
# Install all dependencies. Don't audit to speed up the installation.
|
|
11
|
-
RUN npm install --include=dev --audit=false
|
|
12
|
-
|
|
13
|
-
# Next, copy the source files using the user set
|
|
14
|
-
# in the base image.
|
|
15
|
-
COPY --chown=myuser . ./
|
|
16
|
-
|
|
17
|
-
# Install all dependencies and build the project.
|
|
18
|
-
# Don't audit to speed up the installation.
|
|
19
|
-
RUN npm run build
|
|
20
|
-
|
|
21
|
-
# Create final image
|
|
22
|
-
FROM apify/actor-node-puppeteer-chrome:16
|
|
23
|
-
|
|
24
|
-
# Copy only built JS files from builder image
|
|
25
|
-
COPY --from=builder --chown=myuser /home/myuser/dist ./dist
|
|
26
|
-
|
|
27
|
-
# Copy just package.json and package-lock.json
|
|
28
|
-
# to speed up the build using Docker layer cache.
|
|
29
|
-
COPY --chown=myuser package*.json ./
|
|
30
|
-
|
|
31
|
-
# Install NPM packages, skip optional and development dependencies to
|
|
32
|
-
# keep the image small. Avoid logging too much and print the dependency
|
|
33
|
-
# tree for debugging
|
|
34
|
-
RUN npm --quiet set progress=false \
|
|
35
|
-
&& npm install --omit=dev --omit=optional \
|
|
36
|
-
&& echo "Installed NPM packages:" \
|
|
37
|
-
&& (npm list --omit=dev --all || true) \
|
|
38
|
-
&& echo "Node.js version:" \
|
|
39
|
-
&& node --version \
|
|
40
|
-
&& echo "NPM version:" \
|
|
41
|
-
&& npm --version
|
|
42
|
-
|
|
43
|
-
# Next, copy the remaining files and directories with the source code.
|
|
44
|
-
# Since we do this after NPM install, quick build will be really fast
|
|
45
|
-
# for most source file changes.
|
|
46
|
-
COPY --chown=myuser . ./
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Run the image. If you know you won't need headful browsers,
|
|
50
|
-
# you can remove the XVFB start script for a micro perf gain.
|
|
51
|
-
CMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Crawlee + PuppeteerCrawler + TypeScript project
|
|
2
|
-
|
|
3
|
-
This template is a production ready boilerplate for developing with `PuppeteerCrawler`. Use this to bootstrap your projects using the most up-to-date code.
|
|
4
|
-
|
|
5
|
-
If you're looking for examples or want to learn more visit:
|
|
6
|
-
|
|
7
|
-
- [Documentation](https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler)
|
|
8
|
-
- [Examples](https://crawlee.dev/docs/examples/puppeteer-crawler)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "crawlee-puppeteer-ts",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "This is an example of a Crawlee project.",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"crawlee": "^3.0.0",
|
|
8
|
-
"puppeteer": "*"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@apify/tsconfig": "^0.1.0",
|
|
12
|
-
"ts-node": "^10.8.0",
|
|
13
|
-
"typescript": "^4.7.4"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"start": "npm run start:dev",
|
|
17
|
-
"start:prod": "node dist/main.js",
|
|
18
|
-
"start:dev": "ts-node-esm -T src/main.ts",
|
|
19
|
-
"build": "tsc",
|
|
20
|
-
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
|
|
21
|
-
},
|
|
22
|
-
"author": "It's not you it's me",
|
|
23
|
-
"license": "ISC"
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// For more information, see https://crawlee.dev/
|
|
2
|
-
import { PuppeteerCrawler, log } from 'crawlee';
|
|
3
|
-
import { router } from './routes.js';
|
|
4
|
-
|
|
5
|
-
const startUrls = ['https://crawlee.dev'];
|
|
6
|
-
|
|
7
|
-
const crawler = new PuppeteerCrawler({
|
|
8
|
-
// proxyConfiguration: new ProxyConfiguration({ proxyUrls: ['...'] }),
|
|
9
|
-
requestHandler: router,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
await crawler.run(startUrls);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Dataset, createPuppeteerRouter } from 'crawlee';
|
|
2
|
-
|
|
3
|
-
export const router = createPuppeteerRouter();
|
|
4
|
-
|
|
5
|
-
router.addDefaultHandler(async ({ enqueueLinks, log }) => {
|
|
6
|
-
log.info(`enqueueing new URLs`);
|
|
7
|
-
await enqueueLinks({
|
|
8
|
-
globs: ['https://crawlee.dev/**'],
|
|
9
|
-
label: 'detail',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
router.addHandler('detail', async ({ request, page, log }) => {
|
|
14
|
-
const title = await page.title();
|
|
15
|
-
log.info(`${title}`, { url: request.loadedUrl });
|
|
16
|
-
|
|
17
|
-
await Dataset.pushData({
|
|
18
|
-
url: request.loadedUrl,
|
|
19
|
-
title,
|
|
20
|
-
});
|
|
21
|
-
});
|