HTML Body Extraction
The HTML Body Extraction operator parses HTML content to automatically extract the article title and main body. It also strips HTML tags such as <h1> to <h6>, <p>, <a>, <img>, <ul>, <li>, <div>, <span>, and <br>.
Prerequisites
You must purchase the unstructured data processing feature for the current instance to use the workflow feature.
You have created a workflow. For more information, see Create and Manage Workflows.
Permissions
Project administrators, developers, analysts, and custom project roles with the Dataset - Use permission in a Basic project can use all datasets within that project as the operator's input and output.
Supported file formats
The HTML Body Extraction operator can process files in the following formats: .txt, .md, .csv, .json, .xml, and .html.
Procedure
On the Dataphin homepage, choose R&D > Data Development from the top navigation bar.
On the Develop page, select a project from the top navigation bar.
In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list, click the target workflow to open its canvas. From the Operator Library on the left, drag the HTML Body Extraction operator to the canvas. In the HTML Body Extraction panel on the right, configure the following parameters.
Parameter
Description
Step name
Enter a name for the operator. The name can contain any characters and must not exceed 256 characters.
Input configuration
Dataset
Select the dataset to process. You can select a hybrid dataset or a table dataset. After you select a dataset, you must also select its Version. By default, the earliest version of the dataset is selected.
If this operator is connected to an upstream operator, its input dataset is typically the output dataset from the upstream operator.
Input field
Select a field from the input dataset's metadata table. The system processes the field's content based on its type:
For URL type fields, the system fetches the resource at the URL and parses its structured or semi-structured content. Supported file formats include .txt, .md, .csv, .json, .xml, and .html.
For non-URL type fields, the system treats the field's value as plain text and performs no additional parsing.
Filter condition (Optional)
Use SQL syntax. Enter only the condition that follows the
WHEREclause. You can use global system variables, such as${bizdate}for the business date.Output configuration
Dataset
You can select Source Dataset or Other Dataset. If the metadata table of the source dataset does not have a primary key, the output dataset defaults to Other Dataset.
If you select Other Dataset, you must also specify a Dataset and its Version for the output. By default, the earliest version is selected.
If the input field is of the URL type (which generates a file), the output dataset must be a hybrid dataset.
If the input field is not of the URL type (which does not generate a file), the output dataset can be either a hybrid dataset or a table dataset.
If you select Source Dataset, the operator writes the output metadata to the metadata table of the source dataset's corresponding version.
File output path (Optional)
This parameter is available only when the input field is of the URL type.
File output name
This parameter appears only when the input field is of the URL type. The output filename uses the format
${OriginalFileName}_HTMLBodyExtraction.mdand cannot be changed.Load policy
If the metadata table of the selected output dataset contains a primary key, the default option is to update on primary key conflict. If no primary key exists, the default option is to append data.
Append data: Appends new data to the target table. An error occurs if a primary key or constraint conflict exists.
Update on primary key conflict: If a primary key or constraint conflict occurs, the system deletes the existing row with the conflicting primary key and then inserts the new data.
Overwrite: Deletes all existing data in the target table before writing the new data.
NoteWhen you select Source Dataset as the output dataset, Update on primary key conflict is the only available load policy.
Field mapping
If the input field is of the URL type, the operator outputs only the
markdown_urlfield, which contains the storage URL of the output file.If the input field is not of the URL type, the operator outputs only the
processed_textfield, which contains the extracted body content.
By default, the operator's output fields are mapped to identically named fields in the output dataset. You can also manually map fields or map pass-through fields from the source to the target dataset. Manage field mappings with the following options:
Add output field: Adds a new, empty row for field mapping. This option is available only when Other Dataset is selected as the output dataset.
Batch mapping: Lets you perform batch manual mapping, map by name, or map by row index. This option is available only when Other Dataset is selected as the output dataset.
Delete mapping: Click the Delete icon to remove the corresponding field mapping. You cannot delete the mapping for the operator's fixed output fields.
After you complete the configuration, click Save on the canvas toolbar.
After configuring a single operator, you can continue to build the workflow by adding upstream or downstream operators.