{"id":22122869,"url":"https://github.com/andreaspitzer/hypertag","last_synced_at":"2025-07-25T14:31:14.116Z","repository":{"id":56425820,"uuid":"160814162","full_name":"AndreasPizsa/hypertag","owner":"AndreasPizsa","description":"🏎 The fastest HTML tag and attributes parser for JavaScript","archived":false,"fork":false,"pushed_at":"2022-03-17T17:09:37.000Z","size":788,"stargazers_count":30,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-01T02:49:02.606Z","etag":null,"topics":["html-parser","javascript","nodejs","tag-parsing"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndreasPizsa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-07T11:18:58.000Z","updated_at":"2024-03-07T11:30:51.000Z","dependencies_parsed_at":"2022-08-15T18:30:54.760Z","dependency_job_id":null,"html_url":"https://github.com/AndreasPizsa/hypertag","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreasPizsa%2Fhypertag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreasPizsa%2Fhypertag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreasPizsa%2Fhypertag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndreasPizsa%2Fhypertag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndreasPizsa","download_url":"https://codeload.github.com/AndreasPizsa/hypertag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227584693,"owners_count":17789735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-parser","javascript","nodejs","tag-parsing"],"created_at":"2024-12-01T15:28:07.142Z","updated_at":"2025-07-25T14:31:08.789Z","avatar_url":"https://github.com/AndreasPizsa.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003c/​hypertag\u003e [![npm-version-badge][]]() [![npm-license-badge][]]()\n\n\u003e The fastest HTML tag and attributes parser.\n\n**hypertag** is an HTML tag parser built for speed. Use it to find specific HTML tags and their attributes in HTML documents. It’s like a superfast `getElementsByTagName` without the DOM.\n\n## ✨ Features\n  + ✅  **Hyperfast.** 50 × faster than cheerio, 30 × parse5, 10 × htmlparser2.\n  + ✅  **Tiny.** \u003c 500 bytes gzipped.\n  + ✅  **Complete** Zero dependencies.\n  + ✅  **Robust.** 100% Code Coverage. [![coveralls-badge][]]() [![travis-build-badge][]]()\n\n## 💻 Use\n```js\nconst html = `\n  \u003chtml\u003e\u003chead\u003e\n    \u003cmeta name=\"hello\" content=\"world\"\u003e\n    \u003cmeta name=\"hello\" content=\"moon\"\u003e\n  \u003c/head\u003e\u003cbody\u003e\n    \u003cdiv\u003e\u003ch1\u003eHello, world!\u003c/h1\u003e\u003c/div\u003e\n  \u003c/body\u003e\u003c/html\u003e\n`\n\nconst result = parseHtmlTags(html, 'meta')\nconsole.log(result)\n\n[\n  {\n    '\u003c' : 'meta',\n    name: 'hello',\n    content: 'world'\n  },\n  {\n    '\u003c' : 'meta',\n    name: 'hello',\n    content: 'moon'\n  }\n]\n```\n\n### Examples\n\n#### Getting Favicons\n\n```js\nconst result = parseHtmlTags(html, 'link')\n  .filter(({rel}) =\u003e /^(shortcut\\s+)?icon/i.test(rel))\n\n[\n  {\n    '\u003c': 'link',\n    rel: 'icon',\n    href: 'favicon.png',\n    sizes: '16x16'\n    type: 'image/png'\n  }\n]\n```\n\n#### Getting OpenGraph Images\n```js\nconst result = parseHtmlTags(html, 'meta')\n  .filter(({property}) =\u003e property.toLowerCase() === 'og:image')\n\n[\n  {\n    '\u003c': 'meta',\n    property: 'og:image',\n    content: 'http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg'\n  }\n]\n```\n\n# Benchmarks 🍏🍊\nRun benchmarks with\n```sh\n$ ./benchmark.js\n```\n#### Benchmark Design\n\nThe tested packages all do different things and have their strengths in different areas, so the benchmark by design compares apples to oranges.\n\nThe question this benchmark aims to answer is\n\n\u003e How fast can I find tags of interest in an HTML string?\n\nMost of the tested parsers come with many more features and allow you to do more complex queries than hypertag; for example, parse5 and cheerio create a whole DOM, and similarly html-parse-stringify2 creates an AST. html-tag-parser parses tags but not attributes.\n\nOne objection could be that this is an unfair test, since the parsers are just too different. This can be rebutted by the fact that one ought to pick the right tool for the job: a sports car is faster than a truck, but the truck can load more freight. Do you need a fast and simple parser to find a few tags or do you want to manipulate a DOM?\n\nFor this benchmark, we load a pretty \"standard\" web page (specifically, apple.com) and the let each of the parsers parse the HTML.\n\n#### Results\n```sh\nhypertag x 10,248 ops/sec ±0.78% (88 runs sampled)\nfast-html x 980 ops/sec ±1.36% (87 runs sampled)\nparse5 x 323 ops/sec ±1.68% (83 runs sampled)\nhtmlparser2 x 1,079 ops/sec ±0.87% (88 runs sampled)\nhtml-tag-parser x 1,482 ops/sec ±0.71% (91 runs sampled)\ncheerio x 182 ops/sec ±5.20% (70 runs sampled)\nhtml-parse-stringify2 x 499 ops/sec ±1.07% (87 runs sampled)\nFastest is hypertag\n```\n\n[npm-version-badge]:    https://flat.badgen.net/npm/v/hypertag\n[npm-license-badge]:    https://flat.badgen.net/npm/license/hypertag\n[travis-build-badge]:   https://flat.badgen.net/travis/AndreasPizsa/hypertag\n[coveralls-badge]:      https://flat.badgen.net/coveralls/c/github/AndreasPizsa/hypertag\n[bundlepohobia-badge]:  https://flat.badgen.net/bundlepohobia/minzip/hypertag\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaspitzer%2Fhypertag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreaspitzer%2Fhypertag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreaspitzer%2Fhypertag/lists"}