Actor Readme Generator avatar

Actor Readme Generator

Try for free

No credit card required

View all Actors
Actor Readme Generator

Actor Readme Generator

apify/actor-readme-generator
Try for free

No credit card required

Generates READMEs scrapers using ChatGPT, based on an Apify-approved template.

Do you want to learn more about this Actor?

Get a demo

.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:16
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/input_schema.json

1{
2  "title": "Generate a README for your Actor",
3  "type": "object",
4  "schemaVersion": 1,
5  "properties": {
6    "actorTitle": {
7      "title": "Actor title",
8      "description": "The title of your actor",
9      "type": "string",
10      "editor": "textfield"
11    },
12    "actorDescription": {
13      "title": "Actor description",
14      "type": "string",
15      "description": "What does your actor do? Describe it in a couple of sentences. Give examples if appropriate.",
16      "editor": "textarea"
17    },
18    "targetWebsite": {
19      "title": "Target website",
20      "description": "The website your actor is targeting",
21      "type": "string",
22      "editor": "textfield"
23    },
24    "readmeExamples": {
25      "title": "Example READMEs",
26      "type": "array",
27      "description": "Provide some quality Actor README to base yours on.",
28      "prefill": [
29          "https://apify.com/misceres/indeed-scraper",
30          "https://apify.com/lukaskrivka/google-maps-with-contact-details",
31          "https://apify.com/apify/facebook-events-scraper"
32      ],
33      "editor": "stringList"
34    },
35    "sampleData": {
36      "title": "Sample data",
37      "type": "object",
38      "description": "A sample of your Actor's output in JSON format.",
39      "editor": "json"
40    },
41    "apiKey": {
42      "title": "OpenAI API key",
43      "type": "string",
44      "isSecret": true,
45      "description": "Your OpenAI API key",
46      "editor": "textfield"
47    }
48  },
49  "required": ["actorTitle", "actorDescription", "readmeExamples", "apiKey"]
50}

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 type
7- data item type
8- data item type
9- data item type
10
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 1
16- use case 2
17- use case 3
18- use case 4
19
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## Results
38[example of JSON and/or HTML results]
39
40## Tips for scraping [target website name]
41- Tip 1
42- Tip 2
43
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.7
50});
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

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

package.json

1{
2    "name": "getting-started-node",
3    "version": "0.0.1",
4    "type": "module",
5    "description": "This is an example of an Apify actor.",
6    "dependencies": {
7        "apify": "^3.0.0",
8        "openai": "^3.1.0"
9    },
10    "devDependencies": {},
11    "scripts": {
12        "start": "node src/main.js",
13        "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
14    },
15    "author": "It's not you it's me",
16    "license": "ISC"
17}
Developer
Maintained by Apify

Actor Metrics

  • 2 monthly users

  • 4 stars

  • >99% runs succeeded

  • Created in May 2023

  • Modified 5 months ago