summaryrefslogtreecommitdiff
path: root/docs/using-flyscrape/development-mode.md
blob: b2da076ad56c4c80c5fb43376747167a0cc39844 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Development Mode

Development Mode in flyscrape allows you to streamline the process of creating and fine-tuning your scraping scripts. With the `flyscrape dev` command, you can watch your scraping script for changes and see the results in real-time, making it easier to iterate and perfect your data extraction process during development.

## The `flyscrape dev` Command

The `flyscrape dev` command is a powerful tool that enhances your development workflow by automating the execution of your scraping script when changes are detected. This feature is incredibly useful for several reasons:

1. **Immediate Feedback**: With Development Mode, you can make changes to your scraping script and instantly see the impact of those changes. There's no need to manually run the script after each modification.

2. **Efficiency**: It eliminates the need to repeatedly run the `flyscrape run` command while you fine-tune your scraping logic. This boosts your efficiency and accelerates development.

3. **Real-time Debugging**: If you encounter issues or unexpected behavior in your scraping script, you can quickly identify and fix problems with real-time feedback.

## Using the `flyscrape dev` Command

To activate Development Mode, use the `flyscrape dev` command followed by the name of your scraping script. For example:

```bash
flyscrape dev my_scraping_script.js
```

This command will start watching your scraping script file (`my_scraping_script.js` in this case) for changes. Whenever you save changes to the script, flyscrape will automatically re-run it, allowing you to view the updated results in your terminal.

## Tips for Development Mode

Here are some tips to make the most of Development Mode:

1. **Keep Your Editor Open**: Keep your code editor open and edit your scraping script as needed. When you save the changes, flyscrape will automatically pick them up.

2. **Console Output**: Use `console.log()` statements within your scraping script to output debugging information to the console. This can be helpful for diagnosing issues.

3. **Iterate and Experiment**: Take advantage of Development Mode to experiment with different data extraction queries and strategies. The rapid feedback loop makes it easy to iterate and find the right approach.

## Example Workflow

Here's an example of how a typical workflow might look in Development Mode:

1. Create a new scraping script using `flyscrape new`.

2. Use `flyscrape dev` to start watching the script.

3. Edit the script, add data extraction logic, and save the changes.

4. Observe the results in real-time in the terminal.

5. If needed, make further changes and continue iterating until you achieve the desired data extraction results.

Development Mode is an invaluable tool for scraping script development, enabling you to build and refine your scripts efficiently and effectively.

---

This concludes the "Development Mode" section, which demonstrates how to use the `flyscrape dev` command to streamline your scraping script development process. Next, you can explore how to initiate scraping with the "Start scraping" section to gather data from websites.