[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5566":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},5566,"htmlq","mgdm\u002Fhtmlq","mgdm","Like jq, but for HTML.",null,"Rust",7543,129,32,37,0,1,5,18,37.34,"MIT License",false,"master",true,[],"2026-06-12 02:01:12","# htmlq\nLike [`jq`](https:\u002F\u002Fstedolan.github.io\u002Fjq\u002F), but for HTML. Uses [CSS selectors](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FLearn\u002FCSS\u002FIntroduction_to_CSS\u002FSelectors) to extract bits of content from HTML files.\n\n## Installation\n\n### [Cargo](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fhtmlq)\n\n```sh\ncargo install htmlq\n```\n\n### [FreeBSD pkg](https:\u002F\u002Fwww.freshports.org\u002Ftextproc\u002Fhtmlq)\n\n```sh\npkg install htmlq\n```\n\n### [Homebrew](https:\u002F\u002Fformulae.brew.sh\u002Fformula\u002Fhtmlq)\n\n```sh\nbrew install htmlq\n```\n\n### [Scoop](https:\u002F\u002Fscoop.sh\u002F)\n\n```sh\nscoop install htmlq\n```\n\n## Usage\n\n```console\n$ htmlq -h\nhtmlq 0.4.0\nMichael Maclean \u003Cmichael@mgdm.net>\nRuns CSS selectors on HTML\n\nUSAGE:\n    htmlq [FLAGS] [OPTIONS] [--] [selector]...\n\nFLAGS:\n    -B, --detect-base          Try to detect the base URL from the \u003Cbase> tag in the document. If not found, default to\n                               the value of --base, if supplied\n    -h, --help                 Prints help information\n    -w, --ignore-whitespace    When printing text nodes, ignore those that consist entirely of whitespace\n    -p, --pretty               Pretty-print the serialised output\n    -t, --text                 Output only the contents of text nodes inside selected elements\n    -V, --version              Prints version information\n\nOPTIONS:\n    -a, --attribute \u003Cattribute>         Only return this attribute (if present) from selected elements\n    -b, --base \u003Cbase>                   Use this URL as the base for links\n    -f, --filename \u003CFILE>               The input file. Defaults to stdin\n    -o, --output \u003CFILE>                 The output file. Defaults to stdout\n    -r, --remove-nodes \u003CSELECTOR>...    Remove nodes matching this expression before output. May be specified multiple\n                                        times\n\nARGS:\n    \u003Cselector>...    The CSS expression to select [default: html]\n$\n```\n\n## Examples\n\n### Using with cURL to find part of a page by ID\n\n```console\n$ curl --silent https:\u002F\u002Fwww.rust-lang.org\u002F | htmlq '#get-help'\n\u003Cdiv class=\"four columns mt3 mt0-l\" id=\"get-help\">\n        \u003Ch4>Get help!\u003C\u002Fh4>\n        \u003Cul>\n          \u003Cli>\u003Ca href=\"https:\u002F\u002Fdoc.rust-lang.org\">Documentation\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"https:\u002F\u002Fusers.rust-lang.org\">Ask a Question on the Users Forum\u003C\u002Fa>\u003C\u002Fli>\n          \u003Cli>\u003Ca href=\"http:\u002F\u002Fping.rust-lang.org\">Check Website Status\u003C\u002Fa>\u003C\u002Fli>\n        \u003C\u002Ful>\n        \u003Cdiv class=\"languages\">\n            \u003Clabel class=\"hidden\" for=\"language-footer\">Language\u003C\u002Flabel>\n            \u003Cselect id=\"language-footer\">\n                \u003Coption title=\"English (US)\" value=\"en-US\">English (en-US)\u003C\u002Foption>\n\u003Coption title=\"French\" value=\"fr\">Français (fr)\u003C\u002Foption>\n\u003Coption title=\"German\" value=\"de\">Deutsch (de)\u003C\u002Foption>\n\n            \u003C\u002Fselect>\n        \u003C\u002Fdiv>\n      \u003C\u002Fdiv>\n```\n\n### Find all the links in a page\n\n```console\n$ curl --silent https:\u002F\u002Fwww.rust-lang.org\u002F | htmlq --attribute href a\n\u002F\n\u002Ftools\u002Finstall\n\u002Flearn\n\u002Ftools\n\u002Fgovernance\n\u002Fcommunity\nhttps:\u002F\u002Fblog.rust-lang.org\u002F\n\u002Flearn\u002Fget-started\nhttps:\u002F\u002Fblog.rust-lang.org\u002F2019\u002F04\u002F25\u002FRust-1.34.1.html\nhttps:\u002F\u002Fblog.rust-lang.org\u002F2018\u002F12\u002F06\u002FRust-1.31-and-rust-2018.html\n[...]\n```\n\n### Get the text content of a post\n\n```console\n$ curl --silent https:\u002F\u002Fnixos.org\u002Fnixos\u002Fabout.html | htmlq  --text .main\n\n          About NixOS\n\nNixOS is a GNU\u002FLinux distribution that aims to\nimprove the state of the art in system configuration management.  In\nexisting distributions, actions such as upgrades are dangerous:\nupgrading a package can cause other packages to break, upgrading an\nentire system is much less reliable than reinstalling from scratch,\nyou can’t safely test what the results of a configuration change will\nbe, you cannot easily undo changes to the system, and so on.  We want\nto change that.  NixOS has many innovative features:\n\n[...]\n```\n\n### Remove a node before output\n\nThere's a big SVG image in this page that I don't need, so here's how to remove it.\n\n```console\n$ curl --silent https:\u002F\u002Fnixos.org\u002F | .\u002Ftarget\u002Fdebug\u002Fhtmlq '.whynix' --remove-nodes svg\n\u003Cul class=\"whynix\">\n      \u003Cli>\n\n        \u003Ch2>Reproducible\u003C\u002Fh2>\n        \u003Cp>\n          Nix builds packages in isolation from each other. This ensures that they\n          are reproducible and don't have undeclared dependencies, so \u003Cstrong>if a\n            package works on one machine, it will also work on another\u003C\u002Fstrong>.\n        \u003C\u002Fp>\n      \u003C\u002Fli>\n      \u003Cli>\n\n        \u003Ch2>Declarative\u003C\u002Fh2>\n        \u003Cp>\n          Nix makes it \u003Cstrong>trivial to share development and build\n            environments\u003C\u002Fstrong> for your projects, regardless of what programming\n          languages and tools you’re using.\n        \u003C\u002Fp>\n      \u003C\u002Fli>\n      \u003Cli>\n\n        \u003Ch2>Reliable\u003C\u002Fh2>\n        \u003Cp>\n          Nix ensures that installing or upgrading one package \u003Cstrong>cannot\n            break other packages\u003C\u002Fstrong>. It allows you to \u003Cstrong>roll back to\n            previous versions\u003C\u002Fstrong>, and ensures that no package is in an\n          inconsistent state during an upgrade.\n        \u003C\u002Fp>\n      \u003C\u002Fli>\n    \u003C\u002Ful>\n```\n\n### Pretty print HTML\n\n(This is a bit of a work in progress)\n\n```console\n$ curl --silent https:\u002F\u002Fmgdm.net | htmlq --pretty '#posts'\n\u003Csection id=\"posts\">\n  \u003Ch2>I write about...\n  \u003C\u002Fh2>\n  \u003Cul class=\"post-list\">\n    \u003Cli>\n      \u003Ctime datetime=\"2019-04-29 00:%i:1556496000\" pubdate=\"\">\n        29\u002F04\u002F2019\u003C\u002Ftime>\u003Ca href=\"\u002Fweblog\u002Fnettop\u002F\">\n        \u003Ch3>Debugging network connections on macOS with nettop\n        \u003C\u002Fh3>\u003C\u002Fa>\n      \u003Cp>Using nettop to find out what network connections a program is trying to make.\n      \u003C\u002Fp>\n    \u003C\u002Fli>\n[...]\n```\n\n### Syntax highlighting with [`bat`](https:\u002F\u002Fgithub.com\u002Fsharkdp\u002Fbat)\n\n```console\n$ curl --silent example.com | htmlq 'body' | bat --language html\n```\n\n> \u003Cimg alt=\"Syntax highlighted output\" width=\"700\" src=\"https:\u002F\u002Fuser-images.githubusercontent.com\u002F2346707\u002F132808980-db8991ff-9177-4cb7-a018-39ad94282374.png\" \u002F>\n","htmlq 是一个用于从HTML文件中提取内容的命令行工具，类似于jq对JSON的作用。它支持使用CSS选择器来精准定位和提取HTML中的特定部分。核心功能包括基于CSS选择器的内容提取、属性值获取以及节点移除等，并且提供了多种安装方式如Cargo、Homebrew等，便于不同环境下的快速部署。此外，htmlq还允许用户通过参数自定义输出格式，如忽略空白文本节点或仅输出选定元素内的纯文本内容。适合于需要自动化处理网页数据的场景，例如网页抓取后的信息整理与分析工作。",2,"2026-06-11 03:03:59","top_language"]