{"id":41999612,"url":"https://github.com/h12w/html-query","last_synced_at":"2026-01-26T01:14:14.804Z","repository":{"id":13375462,"uuid":"16063307","full_name":"h12w/html-query","owner":"h12w","description":"A fluent and functional approach to querying HTML","archived":false,"fork":false,"pushed_at":"2018-05-05T16:18:47.000Z","size":34,"stargazers_count":50,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-14T18:37:50.764Z","etag":null,"topics":["crawler","dom","go","golang","golang-package","html","parser"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jepsen-io/jepsen","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h12w.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-01-20T06:55:09.000Z","updated_at":"2025-10-03T08:25:36.000Z","dependencies_parsed_at":"2022-09-02T00:22:01.476Z","dependency_job_id":null,"html_url":"https://github.com/h12w/html-query","commit_stats":null,"previous_names":["hailiang/html-query"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/h12w/html-query","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h12w%2Fhtml-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h12w%2Fhtml-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h12w%2Fhtml-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h12w%2Fhtml-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h12w","download_url":"https://codeload.github.com/h12w/html-query/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h12w%2Fhtml-query/sbom","scorecard":{"id":451506,"data":{"date":"2025-08-11","repo":{"name":"github.com/h12w/html-query","commit":"775479db558cdf0a4fc8e3d6e4528e14c9aa9f9d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 2/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T08:18:01.739Z","repository_id":13375462,"created_at":"2025-08-19T08:18:01.739Z","updated_at":"2025-08-19T08:18:01.739Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28763295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T00:37:26.264Z","status":"ssl_error","status_checked_at":"2026-01-26T00:37:25.959Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["crawler","dom","go","golang","golang-package","html","parser"],"created_at":"2026-01-26T01:14:11.760Z","updated_at":"2026-01-26T01:14:14.792Z","avatar_url":"https://github.com/h12w.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"html-query: A fluent and functional approach to querying HTML DOM\n=================================================================\n\n[![GoDoc](https://godoc.org/h12.io/html-query?status.svg)](https://godoc.org/h12.io/html-query)\n\nhtml-query is a Go package that provides a fluent and functional interface for\nquerying HTML DOM. It is based on [golang.org/x/net/html](https://godoc.org/golang.org/x/net/html).\n\nExamples\n========\n\n1. A simple example (under \"examples\" directory)\n```\n    r := get(`http://blog.golang.org/index`)\n    defer r.Close()\n    root, err := query.Parse(r)\n    checkError(err)\n    root.Div(Id(\"content\")).Children(Class(\"blogtitle\")).For(func(item *query.Node) {\n        href := item.Ahref().Href()\n        date := item.Span(Class(\"date\")).Text()\n        tags := item.Span(Class(\"tags\")).Text()\n        // ......\n    })\n```\n\n2. Generator of html-query (under \"gen\" directory)\n\n   A large part of html-query is automatically generated from HTML spec. The\nspec is in HTML format, so the generator parses it using html-query itself.\n\nDesign\n======\n\nHere is a simple explanation of the design of html-query.\n\n### Functional query expressions\n\nAll functional definitions are defined in html-query/expr package.\n\n1. Checker and checker composition\n\n   A checker is a function that accept and conditionally returns a *html.Node.\n```\n    type Checker func(*html.Node) *html.Node\n```\n   Here are some checker examples:\n```\n    Id(\"id1\")\n    Class(\"c1\")\n    Div\n    Abbr\n    H1\n    H2\n```\n   Checkers can be combined as boolean expressions:\n```\n    And(Id(\"id1\"), Class(\"c1\"))\n    Or(Class(\"c1\"), Class(\"c2\"))\n    And(Class(\"c1\"), Not(Class(\"c2\")))\n```\n2. Checker builder\n\n   A checker builder is a function that returns a checker. \"Id\", \"Class\", \"And\",\n   \"Or\", \"Not\" shown above are all checker builders. There are also some checker\n   builder builder (function that returns a checker builder) defined in\n   html-query when needed.\n\n### Fluent interface\n\nFluent interface (http://en.wikipedia.org/wiki/Fluent_interface) are defined in\nhtml-query package.\n\n1. Root node\n\n   Function Parse returns the root node of an html document.\n\n2. Node finder\n\n   Method Node.Find implements a BFS search for a node, e.g.\n```\n    node.Find(Div, Class(\"id1\"))\n```\n   But usually you can write the short form:\n```\n    node.Div(Class(\"id1\"))\n```\n3. Attribute getter\n\n   Method Node.Attr can be used to get the value (or a regular expression\n   submatch of the value) of a node, e.g.\n```\n    node.Attr(\"Id\")\n    node.Attr(\"href\", \"\\(.*)\")\n```\n   But usually you can write the short form:\n```\n    node.Id()\n    node.Href(\"\\(.*)\")\n```\n4. Node iterator\n\n   Method Node.Children and Node.Descendants each returns a node iterator\n   (NodeIter). Method NodeIter.For can be used to loop through these nodes.\n\nAlternative\n===========\nIf you prefer a jquery like DSL rather than functional way, you might want to\ntry goquery: https://github.com/PuerkitoBio/goquery.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh12w%2Fhtml-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh12w%2Fhtml-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh12w%2Fhtml-query/lists"}