ParseHTMLTables

Find tables inside HTML and extract the contents into objects using the following logic: - 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 · Filters And Transformers

Details

IDParseHTMLTables
Languagepython
From Version6.5.0
Docker Imagedemisto/bs4-py3:1.0.0.10120494
Tagstransformer general

README

Find tables inside HTML and extract the contents into objects using the following logic:

  • 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…

Script Data


Name Description
Script Type python3
Tags transformer, general

Inputs


Argument Name Description
value The HTML to extract tables from
title The title for tables
filter_indexes Extract only the tables with given indexes - 0 based
filter_titles Extract only the tables with given titles

Outputs


There are no outputs for this script.

commonfields:
  id: ParseHTMLTables
  version: -1
contentitemexportablefields:
  contentitemfields:
    fromServerVersion: ""
name: ParseHTMLTables
script: ''
type: python
tags:
- transformer
- general
comment: |-
  Find tables inside HTML and extract the contents into objects using the following logic:

  - 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: value
  description: The HTML to extract tables from.
- name: title
  description: The title for tables.
- name: filter_indexes
  description: Extract only the tables with given indexes - 0 based.
- name: filter_titles
  description: Extract only the tables with given titles.
- name: default_header_line
  auto: PREDEFINED
  predefined:
  - none
  - first_row
  - first_column
  description: The default table line to consider as a header if no headers are in the table.
  defaultValue: none
scripttarget: 0
isllm: false
subtype: python3
dockerimage: demisto/bs4-py3:1.0.0.10120494
runas: DBotWeakRole
fromversion: 6.5.0
tests:
- No tests (auto formatted)