ExtractHTMLTables
Find tables inside HTML and extract the contents into objects using the following logic: - If table has a single column, just create an array of strings from the values - If table has 2 columns and has no header row, treat the first column as key and second as value and create a table of key/value - If table has a header row, create a table of objects where attribute names are the headers - If table does not have a header row, create table of objects where attribute names are cell1, cell2, cell3...
python · Common Scripts
Details
| ID | ExtractHTMLTables |
|---|---|
| Language | python |
| From Version | 5.0.0 |
| Docker Image | demisto/bs4-py3:1.0.0.10120494 |
| Tags | Utility |
README
Find tables inside HTML and extract the contents into objects using the following logic:
- If the table has a single column, just create an array of strings from the values.
- If the table has 2 columns and has no header row, treat the first column as the key and the second column as the value and create a table for the key/value.
- If the table has a header row, create a table of objects where the attribute names are the headers.
- If the table does not have a header row, create table of objects where attribute names are cell1, cell2, cell3…
Script Data
| Name | Description |
|---|---|
| Script Type | python |
| Tags | Utility |
Inputs
| Argument Name | Description |
|---|---|
| html | The HTML to extract the tables from. |
| indexes | Extracts only the tables with given indexes. IT will be, 0 based. |
Outputs
| Path | Description | Type |
|---|---|---|
| HTMLTables | The extracted HTML tables. | Unknown |
commonfields: id: ExtractHTMLTables version: -1 name: ExtractHTMLTables script: '' type: python subtype: python3 tags: - Utility comment: |- Find tables inside HTML and extract the contents into objects using the following logic: - If table has a single column, just create an array of strings from the values - If table has 2 columns and has no header row, treat the first column as key and second as value and create a table of key/value - If table has a header row, create a table of objects where attribute names are the headers - If table does not have a header row, create table of objects where attribute names are cell1, cell2, cell3... enabled: true args: - name: html required: true default: true description: The HTML to extract tables from. - name: indexes description: Extract only the tables with given indexes - 0 based. outputs: - contextPath: HTMLTables description: The extracted HTML tables. scripttarget: 0 dockerimage: demisto/bs4-py3:1.0.0.10120494 fromversion: 5.0.0 tests: - TestExtractHTMLTables