W3cubDocs

/Nushell

query web for network

execute selector query on html/web

Signature

> query web --query --as-html --attribute --as-table --inspect

Parameters

  • --query {string}: selector query
  • --as-html (-m): return the query output as html
  • --attribute {string}: downselect based on the given attribute
  • --as-table {table}: find table based on column header list
  • --inspect (-i): run in inspect mode to provide more information for determining column headers

Input/output types:

input output
any any

Examples

Retrieve all <header> elements from phoronix.com website

>http gethttps://phoronix.com|query web-q'header'

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

>http gethttps://en.wikipedia.org/wiki/List_of_cities_in_India_by_population
|query web-t [RankCity'Population(2011)[3]''Population(2001)[3][a]''State or union territory']

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

>http gethttps://www.nushell.sh|query web-q'h2, h2 + p'|group2|each {rotate--ccwtaglinedescription} |flatten

Retrieve a specific html attribute instead of the default text

>http gethttps://example.org|query web--querya--attributehref

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