Skip to content

Commit 983c801

Browse files
committed
continue with the first lesson
1 parent 5c4a69b commit 983c801

1 file changed

Lines changed: 58 additions & 13 deletions

File tree

sources/academy/platform/building_actors_with_ai/01_chatting.md

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ slug: /building-actors-with-ai/chatting
55
unlisted: true
66
---
77

8+
import Tabs from '@theme/Tabs';
9+
import TabItem from '@theme/TabItem';
10+
811
**In this lesson we'll use ChatGPT and a few commands to create an application for watching prices on an e-commerce website.**
912

1013
---
@@ -62,23 +65,65 @@ You are ready if it prints something like the following:
6265
apify-cli/0.0.0 (1a2b3c4) running on ... with node-0.0.0, installed via ...
6366
```
6467

65-
## Setting up an Actor template
68+
## Creating an Actor
6669

67-
<!--
68-
TODO Now let's setup the Actor… Find a suitable folder and run `apify create`
69-
-->
70+
Now let's use the Apify CLI to help us kick off a new Actor:
7071

71-
:::note Course under construction
72-
This section hasn't been written yet. Come later, please!
73-
:::
72+
```text
73+
apify create warehouse-scraper
74+
```
7475

75-
## Scraping products
76+
It starts a wizard where you can choose from various options. For each option, only repeatedly use the <kbd>↵</kbd> key to confirm whatever is set as the first or default:
7677

77-
:::note Course under construction
78-
This section hasn't been written yet. Come later, please!
79-
:::
78+
```text
79+
✔ Choose the programming language of your new Actor: JavaScript
80+
✔ Choose a template for your new Actor. You can check more information at https://apify.com/templates. Crawlee + Cheerio
81+
✔ Almost done! Last step is to install dependencies. Install dependencies
82+
83+
...
8084
81-
## Running code
85+
Success: ✅ Actor 'warehouse-scraper' created successfully!
86+
87+
Next steps:
88+
89+
cd "warehouse-scraper"
90+
apify run
91+
92+
💡 Tip: Use 'apify push' to deploy your Actor to the Apify platform
93+
📖 Docs: https://docs.apify.com/platform/actors/development
94+
🌱 Git repository initialized in 'warehouse-scraper'. You can now commit and push your Actor to Git.
95+
```
96+
97+
Now that's a lot of output, but no worries, the important part is that we've successfully used a template to set up a new Actor project.
98+
99+
A new directory `warehouse-scraper` has been created for us, with a variety of files and directories inside. The output instructs us to go to this new project directory, so let's do it:
100+
101+
```
102+
cd "warehouse-scraper"
103+
```
104+
105+
Now we can run commands which control this new project. We didn't change the template in any way though, so it won't scrape the Warehouse store for us yet.
106+
107+
Out of the box, the template implements a sample Actor which walks through the [crawlee.dev](https://crawlee.dev/) website and downloads all of its pages. Such thing is called _crawling_, and Crawlee is a popular tool for crawling which this Actor internally uses. Let's see if it works for us:
108+
109+
```
110+
apify run
111+
```
112+
113+
If you see a flood of output mentioning something called `CheerioCrawler`, it means the template works and we can move on to editing its files so that it does what we want.
114+
115+
```text
116+
...
117+
INFO CheerioCrawler: Starting the crawler.
118+
INFO CheerioCrawler: enqueueing new URLs
119+
INFO CheerioCrawler: Crawlee · Build reliable crawlers. Fast. {"url":"https://crawlee.dev/"}
120+
...
121+
INFO CheerioCrawler: Finished! Total 107 requests: 107 succeeded, 0 failed. {"terminal":true}
122+
```
123+
124+
If you struggle to use the template wizard or to run the sample Actor, share this tutorial with [ChatGPT](https://chatgpt.com/), add any errors you've encountered, and see if it can help you debug the issue.
125+
126+
## Scraping products
82127

83128
<!--
84129
Save it to the template, setup Node/npm environment, run it, get results. If the student gets stuck setting up Node/npm, they ask ChatGPT. Roughly explaining what the program does, establishing basic terms.
@@ -88,7 +133,7 @@ Save it to the template, setup Node/npm environment, run it, get results. If the
88133
This section hasn't been written yet. Come later, please!
89134
:::
90135

91-
#### Scraping stock units
136+
## Scraping stock units
92137

93138
<!--
94139
Prompt ChatGPT to modify the program so that it scrapes stock units. Technically, modifying the program like this proves to be cumbersome, but doable. Run the program again, get better results.

0 commit comments

Comments
 (0)