My Actor
Deprecated
Pricing
Pay per usage
Go to Store
My Actor
Deprecated
for a ChatGPT-created chatbot
0.0 (0)
Pricing
Pay per usage
0
Total users
1
Monthly users
1
Last modified
a year ago
.actor/Dockerfile
# Specify the base Docker image. You can read more about# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images# You can also use any other image from Docker Hub.FROM apify/actor-node:20
# Copy just package.json and package-lock.json# to speed up the build using Docker layer cache.COPY package*.json ./
# Install NPM packages, skip optional and development dependencies to# keep the image small. Avoid logging too much and print the dependency# tree for debuggingRUN npm --quiet set progress=false \ && npm install --omit=dev --omit=optional \ && echo "Installed NPM packages:" \ && (npm list --omit=dev --all || true) \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version \ && rm -r ~/.npm
# Next, copy the remaining files and directories with the source code.# Since we do this after NPM install, quick build will be really fast# for most source file changes.COPY . ./
# Run the image.CMD npm start --silent
.actor/actor.json
{ "actorSpecification": 1, "name": "my-actor", "title": "Scrape single page in JavaScript", "description": "Scrape data from single page with provided URL.", "version": "0.0", "meta": { "templateId": "js-start" }, "input": "./input_schema.json", "dockerfile": "./Dockerfile"}
.actor/input_schema.json
{ "title": "Scrape data from a web page", "type": "object", "schemaVersion": 1, "properties": { "url": { "title": "URL of the page", "type": "string", "description": "The URL of website you want to get the data from.", "editor": "textfield", "prefill": "https://www.apify.com/" } }, "required": ["url"]}
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
# configurations.idea
# crawlee and apify storage foldersapify_storagecrawlee_storagestorage
# installed filesnode_modules
# git folder.git
.gitignore
# This file tells Git which files shouldn't be added to source control.DS_Store.ideadistnode_modulesapify_storagestorage/*!storage/key_value_storesstorage/key_value_stores/*!storage/key_value_stores/defaultstorage/key_value_stores/default/*!storage/key_value_stores/default/INPUT.json
package.json
{ "name": "my-actor", "version": "1.0.0", "description": "My custom actor", "main": "src/main.js", "scripts": { "start": "node src/main.js" }, "dependencies": { "puppeteer": "^19.0.0" }, "type": "module"}