{"id":13961809,"url":"https://github.com/feichao93/temme","last_synced_at":"2025-04-07T06:11:19.206Z","repository":{"id":40633369,"uuid":"94353926","full_name":"feichao93/temme","owner":"feichao93","description":"📄 Concise selector to extract JSON from HTML.","archived":false,"fork":false,"pushed_at":"2024-07-06T01:31:14.000Z","size":8873,"stargazers_count":273,"open_issues_count":3,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T04:08:01.175Z","etag":null,"topics":["css-selector","data-transformation","html","json","temme-selector"],"latest_commit_sha":null,"homepage":"https://temme.js.org","language":"TypeScript","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/feichao93.png","metadata":{"files":{"readme":"readme-en.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-14T16:58:10.000Z","updated_at":"2025-03-14T07:52:45.000Z","dependencies_parsed_at":"2024-11-24T02:15:26.175Z","dependency_job_id":null,"html_url":"https://github.com/feichao93/temme","commit_stats":null,"previous_names":["shinima/temme"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feichao93%2Ftemme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feichao93%2Ftemme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feichao93%2Ftemme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feichao93%2Ftemme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feichao93","download_url":"https://codeload.github.com/feichao93/temme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":["css-selector","data-transformation","html","json","temme-selector"],"created_at":"2024-08-08T17:01:28.237Z","updated_at":"2025-04-07T06:11:19.178Z","avatar_url":"https://github.com/feichao93.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"[![Build Status](https://img.shields.io/travis/shinima/temme/master.svg?style=flat-square)](https://travis-ci.org/shinima/temme) [![Coverage Status](https://img.shields.io/coveralls/shinima/temme/master.svg?style=flat-square)](https://coveralls.io/github/shinima/temme?branch=master) [![NPM Package](https://img.shields.io/npm/v/temme.svg?style=flat-square)](https://www.npmjs.org/package/temme) ![Node Version Requirement](https://img.shields.io/badge/node-%3E=6-f37c43.svg?style=flat-square) [![VSCode Extension](https://img.shields.io/badge/vscode-extension-green.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=shinima.vscode-temme) [![Example StackOverflow](https://img.shields.io/badge/Example-StackOverflow-2196F3.svg?style=flat-square)](/examples/stackoverflow/readme.md)\n\n# temme\n\nTemme is a concise and convenient selector to extract JSON from HTML documents.\n\n## Links\n\n👉 [documentation](#documentation)\n\n👉 [playground](https://temme.js.org)\n\n👉 [VSCode extension](https://marketplace.visualstudio.com/items?itemName=shinima.vscode-temme)\n\n👉 [BUG report](https://github.com/shinima/temme/issues)\n\n## Examples\n\n```html\n\u003c!-- html used below --\u003e\n\u003cul\u003e\n  \u003cli data-fruit-id=\"1\"\u003e\n    \u003cspan data-color=\"red\"\u003eapple\u003c/span\u003e\n  \u003c/li\u003e\n  \u003cli data-fruit-id=\"2\"\u003e\n    \u003cspan data-color=\"white\"\u003epear\u003c/span\u003e\n  \u003c/li\u003e\n  \u003cli data-fruit-id=\"3\"\u003e\n    \u003cspan data-color=\"purple\"\u003egrape\u003c/span\u003e\n  \u003c/li\u003e\n\u003c/ul\u003e\n```\n\nWe could the following temme selector to extract _an array of fruit color and name_ against the above html. （[Online Version](https://temme.js.org/?example=basic-array-capture)）\n\n```javascript\nimport temme from 'temme'\n// Note the `.default` if you are using commonjs\n// const temme = require('temme').default\n\nconst selector = `li@fruits {\n  span[data-color=$color]{$name};\n}`\ntemme(html, selector)\n//=\u003e\n// {\n//   \"fruits\": [\n//     { \"color\": \"red\", \"name\": \"apple\" },\n//     { \"color\": \"white\", \"name\": \"pear\"  },\n//     { \"color\": \"purple\", \"name\": \"grape\" }\n//   ]\n// }\n```\n\nIf you are not familiar with temme, you could start with this [stackoverflow example](/examples/stackoverflow/readme.md). There are some short examples in the online playground. [This example](https://temme.js.org?example=github-commits) extracts commits information from GitHub commits page, including time, author, commit message and links. [This example](https://temme.js.org?example=github-issues) extract issues information from GitHub issues page, including title, assignee and number of comments.\n\n## Documentation\n\n- [01-introduction](/docs/en/01-introduction.md)\n- [02-value-capture](/docs/en/02-value-capture.md)\n- [03-array-capture](/docs/en/03-array-capture.md)\n- [04-multiple-selector](/docs/en/04-multiple-selector.md)\n- [05-assignments](/docs/en/05-assignments.md)\n- [06-javascript](/docs/en/06-javascript.md)\n- [07-filters](/docs/en/07-filters.md)\n- [08-modifiers](/docs/en/08-modifiers.md)\n- [09-procedures](/docs/en/09-procedures.md)\n- [10-snippets](/docs/en/10-snippets.md)\n\n## Upgrade from 0.7 to 0.8\n\n0.8 introduces some breaking changes, mainly for introducing the _modifier_ feature, and replacing _content_ to _procedure_. And, class `CaptureResult` gets a lot of simplification, please see the documentation of [CaptureResult](/docs/zh-cn/08-modifiers.md#类-captureresult).\n\nIf you still need the old version documentation, you can find it [here](https://github.com/shinima/temme/blob/v0.7.0/readme.md).\n\n### 1. content/procedure supports only single part\n\ncontent/procedure does not supports multiple parts any more. You need to write the selector multiple times:\n\n```javascript\nconst prev = `div{ $text; find('foo', $bar); }`\nconst current = `\n  div{ $text };\n  div{ find('foo', $bar) };\n`\n```\n\n#### 2. special filters are removed\n\nIn _procedure_, temme does not provide the special filters. But temme providers some built-in procedure to do the similiar task:\n\n```javascript\nconst prev = `\n  div{ $t|text };\n  div{ $h|html };\n  div{ $n|node };\n  div{ $o|outerHTML };\n`\nconst current = `\n  div{ text($t) };\n  div{ html($h) };\n  div{ node($n) };\n  // 暂无 outerHTML procedure\n`\n```\n\nNote: because `outerHTML` API itself is [kind of special](https://github.com/cheeriojs/cheerio/issues/54), temme does not provide the outerHTML procedure for now. If you need this, please use JavaScript API manually.\n\n### 3. filter nth is removed\n\nPlease use filter `get` instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeichao93%2Ftemme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeichao93%2Ftemme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeichao93%2Ftemme/lists"}