Spec-Zone.ru › Nushell

query web for network

execute selector query on html/web

Signature

> query web {flags}

Flags

  • --query, -q {string}: Selector query.
  • --as-html, -m: Return the query output as html.
  • --attribute, -a {any}: Downselect based on the given attribute.
  • --as-table, -t {list<string>}: Find table based on column header list.
  • --inspect, -i: Run in inspect mode to provide more information for determining column headers.
  • --document, -d: Parse the input as a full HTML document instead of a fragment

Examples

Retrieve all <header> elements from phoronix.com website

> http get https://phoronix.com | query web --query 'header' | flatten

Retrieve a html table from Wikipedia and parse it into a nushell table using table headers as guides

> http get https://en.wikipedia.org/wiki/List_of_terminal_emulators | query web --as-table ['Name', 'Type', 'Connectivity', 'User Interface', 'Operating System']

Pass multiple css selectors to extract several elements within single query, group the query results together and rotate them to create a table

> http get https://www.nushell.sh | query web --query 'h2, h2 + p' | each {str join} | chunks 2 | each {rotate --ccw tagline description} | flatten

Parse the response as a full document so that the <body> element is preserved

> http get http://example.com | query web --document --query body

Retrieve a specific html attribute instead of the default text

> http get https://example.org | query web --query a --attribute href

Retrieve the OpenGraph properties (<meta property="og:...">) from a web page

> http get https://www.rust-lang.org | query web --query 'meta[property^="og:"]' --attribute [ property content ]

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/query_web.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API