hubcap tables

Extract structured table data from the current page.

When to use

Use tables to get the headers and row data for every <table> element on the page. Returns structured arrays that are easy to process with jq or pipe into other tools.

Usage

hubcap tables

Arguments

None.

Flags

None.

Output

FieldTypeDescription
tablesarrayArray of table objects
tables[].idstringThe table’s id attribute (omitted if none)
tables[].headersarrayArray of header cell strings
tables[].rowsarrayArray of row arrays, each containing cell strings
{
  "tables": [
    {
      "id": "results",
      "headers": ["Name", "Score"],
      "rows": [
        ["Alice", "95"],
        ["Bob", "87"]
      ]
    }
  ]
}

Errors

ConditionExit codeStderr
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Extract all tables:

hubcap tables

Get the first table’s data as CSV:

hubcap tables | jq -r '.tables[0] | (.headers | @csv), (.rows[] | @csv)'

Navigate to a page and extract a specific table by ID:

hubcap goto "https://example.com/data" && hubcap tables | jq '.tables[] | select(.id == "results")'

See also

  • forms - list all forms and their input fields
  • links - extract all links from the page