My Actor avatar

My Actor

Deprecated
View all Actors
This Actor is deprecated

This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?

See alternative Actors
My Actor

My Actor

xylonic_lavender/my-actor

for a ChatGPT-created chatbot

.actor/Dockerfile

1# Specify the base Docker image. You can read more about
2# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3# You can also use any other image from Docker Hub.
4FROM apify/actor-node:20
5
6# Copy just package.json and package-lock.json
7# to speed up the build using Docker layer cache.
8COPY 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
13RUN 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    && rm -r ~/.npm
22
23# Next, copy the remaining files and directories with the source code.
24# Since we do this after NPM install, quick build will be really fast
25# for most source file changes.
26COPY . ./
27
28
29# Run the image.
30CMD npm start --silent

.actor/actor.json

1{
2    "actorSpecification": 1,
3    "name": "my-actor",
4    "title": "Scrape single page in JavaScript",
5    "description": "Scrape data from single page with provided URL.",
6    "version": "0.0",
7    "meta": {
8        "templateId": "js-start"
9    },
10    "input": "./input_schema.json",
11    "dockerfile": "./Dockerfile"
12}

.actor/input_schema.json

1{
2    "title": "Scrape data from a web page",
3    "type": "object",
4    "schemaVersion": 1,
5    "properties": {
6        "url": {
7            "title": "URL of the page",
8            "type": "string",
9            "description": "The URL of website you want to get the data from.",
10            "editor": "textfield",
11            "prefill": "https://www.apify.com/"
12        }
13    },
14    "required": ["url"]
15}

src/main.js

1import puppeteer from 'puppeteer';
2
3export const main = async (input) => {
4    const { loginUrl, chatbotUrl, username, password, url } = input;
5
6    if (!url) {
7        throw new Error('URL is required in the input.');
8    } else {
9        url = 'https://chatgpt.com/g/g-27hjeHzWx-motion-ai-chatbot-assistant'
10    }
11
12    const browser = await puppeteer.launch({ headless: true });
13    const page = await browser.newPage();
14    await page.goto(loginUrl, { waitUntil: 'networkidle0' });
15    await page.type('input[name="email"]', username);
16    await page.type('input[name="password"]', password);
17    await page.click('button[type="submit"]');
18    await page.waitForNavigation({ waitUntil: 'networkidle0' });
19    await page.goto(chatbotUrl, { waitUntil: 'networkidle0' });
20    const content = await page.content();
21    await browser.close();
22    return { content };
23};

.dockerignore

1# configurations
2.idea
3
4# crawlee and apify storage folders
5apify_storage
6crawlee_storage
7storage
8
9# installed files
10node_modules
11
12# git folder
13.git

.gitignore

1# This file tells Git which files shouldn't be added to source control
2.DS_Store
3.idea
4dist
5node_modules
6apify_storage
7storage/*
8!storage/key_value_stores
9storage/key_value_stores/*
10!storage/key_value_stores/default
11storage/key_value_stores/default/*
12!storage/key_value_stores/default/INPUT.json

package.json

1{
2  "name": "my-actor",
3  "version": "1.0.0",
4  "description": "My custom actor",
5  "main": "src/main.js",
6  "scripts": {
7    "start": "node src/main.js"
8  },
9  "dependencies": {
10    "puppeteer": "^19.0.0"
11  },
12  "type": "module"
13}
Developer
Maintained by Community
Categories