Actor Readme Generator
Pricing
Pay per usage
Go to Store
Actor Readme Generator
Generates READMEs scrapers using ChatGPT, based on an Apify-approved template.
4.6 (5)
Pricing
Pay per usage
6
Total users
18
Monthly users
3
Runs succeeded
0%
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:16
# 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/input_schema.json
{ "title": "Generate a README for your Actor", "type": "object", "schemaVersion": 1, "properties": { "actorTitle": { "title": "Actor title", "description": "The title of your actor", "type": "string", "editor": "textfield" }, "actorDescription": { "title": "Actor description", "type": "string", "description": "What does your actor do? Describe it in a couple of sentences. Give examples if appropriate.", "editor": "textarea" }, "targetWebsite": { "title": "Target website", "description": "The website your actor is targeting", "type": "string", "editor": "textfield" }, "readmeExamples": { "title": "Example READMEs", "type": "array", "description": "Provide some quality Actor README to base yours on.", "prefill": [ "https://apify.com/misceres/indeed-scraper", "https://apify.com/lukaskrivka/google-maps-with-contact-details", "https://apify.com/apify/facebook-events-scraper" ], "editor": "stringList" }, "sampleData": { "title": "Sample data", "type": "object", "description": "A sample of your Actor's output in JSON format.", "editor": "json" }, "apiKey": { "title": "OpenAI API key", "type": "string", "isSecret": true, "description": "Your OpenAI API key", "editor": "textfield" } }, "required": ["actorTitle", "actorDescription", "readmeExamples", "apiKey"]}
src/consts.js
1export const template = `2## What does [Actor Name] do?3[Actor Name] will enable you to get more data from [target website name with link] than the official [target website name] API.4
5[Actor Name] can scrape:6- data item type7- data item type8- data item type9- data item type10
11## Why scrape [target website name]?12[target website name] has X number of users and is a great source of data for [industry or use case].13
14Here are just some of the ways you could use that data:15- use case 116- use case 217- use case 318- use case 419
20If you would like more inspiration on how scraping [target website name] could help your business or organization, check out our [industry pages](https://apify.com/industries).21
22## How to scrape [target website name]23It's easy to scrape [target website name with link] with [Actor Name]. Just follow these few steps and you'll get your data in a few minutes.24
251. Click on Try for free.262. Enter the keywords or search terms you want to scrape. Or enter a URL to start scraping.273. Click on Run.284. When [Actor Name] has finished, preview or download your data from the Dataset tab.29
30## How much will it cost to scrape [target website name]?31Apify gives you with $5 free usage credits every month on the [Apify Free plan](https://apify.com/pricing). You can get XXXX results per month from [Actor Name] for that, so those XXXX results will be completely free!32
33But if you need to get more data regularly from [target website name], you should grab an Apify subscription. We recommend our [$49/month Starter plan](https://apify.com/pricing) - you can get up to XXXXXX every month with the $49 monthly plan! 34
35Or get XXXXXXXX results for $499 with the [Scale plan](https://apify.com/pricing) - wow!36
37## Results38[example of JSON and/or HTML results]39
40## Tips for scraping [target website name]41- Tip 142- Tip 243
44## Is it legal to scrape [target website name]?45Note that personal data is protected by GDPR in the European Union and by other regulations around the world.46You should not scrape personal data unless you have a legitimate reason to do so.47If you're unsure whether your reason is legitimate, consult your lawyers.48We also recommend that you read our blog post: [is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)`
src/main.js
1import { Actor } from 'apify';2import { Configuration, OpenAIApi } from "openai";3import {template} from './consts.js'4
5await Actor.init()6
7console.log('Loading input');8const input = await Actor.getInput();9
10const configuration = new Configuration({11 apiKey: input?.apiKey,12});13const openai = new OpenAIApi(configuration);14
15if (!configuration.apiKey) {16 throw new Error("OpenAI API key not configured, please add it in the Input")17}18
19const readmeExamplesList = input?.readmeExamples.map((example, index) => `\n${index + 1}. ${example}`);20
21const prompt = `22Create a README for an Apify Actor with the name "${input?.actorTitle}".23
24The actor ${input?.actorDescription}.25
26${input?.targetWebsite ? `The actor's target website is ${input?.targetWebsite}.` : ''}27
28Use a neutral, informative tone of voice.29
30Use GitHub-flavoured Markdown.31
32Base the README on the following examples of Apify Actors READMES:33${readmeExamplesList}34
35Use this template as a suggested structure, but you can modify it if it helps make the content clearer: ${template}.36
37${input?.sampleData ? `Here is a sample of the data that the Actor produces ${JSON.stringify(input?.sampleData)}` : ''}38`;39
40console.log('\n\n***************\n\n')41console.log('Prompt:\n\n\n', prompt)42console.log('\n\n\n\nEnd of prompt')43console.log('\n\n\n\n************************\n\n\n\n')44
45console.log('Generating the README........')46const response = await openai.createChatCompletion({47 model: "gpt-3.5-turbo",48 messages: [{ role: "user", content: prompt }],49 temperature: 0.750});51
52const readme = response?.data.choices[0].message.content;53
54console.log('\n\n\n\n')55console.log('Saving...')56
57await Actor.pushData({prompt, readme});58await Actor.setValue('README.md', readme);59
60console.log('\n\n\n\n')61await Actor.exit();
.dockerignore
# configurations.idea
# crawlee and apify storage foldersapify_storagecrawlee_storagestorage
# installed filesnode_modules
# git folder.git
package.json
{ "name": "getting-started-node", "version": "0.0.1", "type": "module", "description": "This is an example of an Apify actor.", "dependencies": { "apify": "^3.0.0", "openai": "^3.1.0" }, "devDependencies": {}, "scripts": { "start": "node src/main.js", "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1" }, "author": "It's not you it's me", "license": "ISC"}