What is "Extract data"?
"Extract Data" is a must-have step when you set up your task to get the data you need. All the data fields you need can be found in this step. Under this step, you can clean data, modify XPath, change the sequence of, copy, delete data fields, and so on. Without this step, your task cannot be executed.
How to add "Extract data" to the workflow?
There are two ways to generate an "Extract Data" action.
1. Click on an element on the web page to auto-generate one (The most common one)
If you want to capture data from the page, you just need to click on the element first. Then, click the option of "Extract......" on the Tips panel and an "Extract Data" action would show in the workflow.
The options can be:
"Extract text/URL of the selected element"
"Extract the inner/outer HTML of the selected element"
"Extract data in the loop"
2. Add from the workflow
When you hover over the workflow, you can see an icon showing up. Click the icon to display the drop-down options and choose "Extract Data" to add this step to the workflow.
To adjust more settings related to the data fields, you can click on the Extract Data action on the workflow and find the settings panel at the bottom. You can see there are 3 main features.
In the "General" section, you will find "Extract data in the loop" when the Extract Data action is inside a Loop Item.
In the "Options" section, you will find "Wait before action" as well as "Trigger".
1. Extract data in the loop
This option only shows when the Extract Data is inside a Loop Item. It is normally ticked automatically when you extract data directly from a listing page instead of clicking into the detail page to pull out data.
Here is an example of a listing page.
To learn more about extracting data from a listing result page, check this guide: Extract a list.
The trigger is used when you want to scrape data based on some conditions.
For example, if the Username field is not blank and you want to dump this line of data, you can use Trigger to achieve it. Check out more details about Trigger.
3. Before action is performed (add wait time)
This one will allow you to add a wait time before executing this action. Different websites may have different timeout settings to load the data, so sometimes you need to add some wait time or waiting conditions to give more time for the web page to load.
You can check this guide for different use cases: Wait before action.
4. Define data fields
You can find data field details on the Data Preview part and you can take actions such as renaming (double-click on the field name), deleting, moving, or cleaning your data field(s), and adding field(s) such as extraction time, current page URL, etc from a pre-defined list.
You can also customize the XPath of a certain data field here if it is not located correctly in the output.
To better understand what those icons stand for, check the following details:
: Import data field(s) from a data file [Octoparse extract config (*.oec)]
: Export data field(s) to a data file [Octoparse extract config (*.oec)]
: Horizontal & Vertical views showing different structures of data preview
You can change to Vertical Views to modify the XPath of all the fields easily or do actions to multiple fields by ticking the box before each field.
: Remove Duplicates from the extracted data
: More actions
If you click on and you will see more options that will allow you to make more modifications to your data.
- Customize field: to select what information (text, HTML, an attribute value, or URL) you need to scrape from the page element. To learn more about it, check this guide: Extract element text/URL/image/HTML/attribute.
- Customize XPath (To learn more about XPath, check this guide What is XPath and how to use it in Octoparse)
- Clean data: to clean the data output to your desired one (e.g. add prefix, suffix, transform the time, replace, etc). To learn more about it, check this guide: Re-format data extracted.
- Merge multiple rows of data into one: to combine the same field of data from other loop items. To learn more about it, check this guide: Combine data extracted.
- Delete: to remove the current data field
- Copy: to duplicate a certain data field
If you have any trouble setting up your task, you're welcome to submit a ticket to our Support team.