All Projects → shinima → Temme

shinima / Temme

Licence: mit
📄 Concise selector to extract JSON from HTML.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Temme

Tq
Perform a lookup by CSS selector on an HTML input
Stars: ✭ 193 (-24.9%)
Mutual labels:  json, css-selector
Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (+30.35%)
Mutual labels:  json, css-selector
Lowdb
Simple to use local JSON database (supports Node, Electron and the browser)
Stars: ✭ 16,886 (+6470.43%)
Mutual labels:  json
Cloud Reports
Scans your AWS cloud resources and generates reports. Check out free hosted version:
Stars: ✭ 255 (-0.78%)
Mutual labels:  json
Landing-Page-Animation
Landing page animation made using CSS
Stars: ✭ 45 (-82.49%)
Mutual labels:  css-selector
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+20542.8%)
Mutual labels:  json
ElementFinder
Fetch data from HTML and XML via xpath/css and prepare it with regexp
Stars: ✭ 29 (-88.72%)
Mutual labels:  css-selector
Oj
Optimized JSON
Stars: ✭ 2,824 (+998.83%)
Mutual labels:  json
Rz Go
Ripzap - Fast and 0 allocs leveled JSON logger for Go ⚡️. Dependency free.
Stars: ✭ 256 (-0.39%)
Mutual labels:  json
CDom
Simple HTML/XML/BBCode DOM component for PHP.
Stars: ✭ 26 (-89.88%)
Mutual labels:  css-selector
Lazer Database
PHP flat file database to store data with JSON
Stars: ✭ 254 (-1.17%)
Mutual labels:  json
GQ
CSS Selector Engine for Gumbo Parser
Stars: ✭ 25 (-90.27%)
Mutual labels:  css-selector
visdom
A library use jQuery like API for html parsing & node selecting & node mutation, suitable for web scraping and html confusion.
Stars: ✭ 80 (-68.87%)
Mutual labels:  css-selector
selective
Statically find HTML anti patterns using CSS Selectors
Stars: ✭ 15 (-94.16%)
Mutual labels:  css-selector
Cli
A simple, fast, and fun package for building command line apps in Go
Stars: ✭ 16,995 (+6512.84%)
Mutual labels:  json
Rinno
How to install local shiny apps
Stars: ✭ 255 (-0.78%)
Mutual labels:  json
Editor.js
A block-styled editor with clean JSON output
Stars: ✭ 17,061 (+6538.52%)
Mutual labels:  json
CustomWebCheckbox
An example of a make checkbox design on the web.
Stars: ✭ 12 (-95.33%)
Mutual labels:  css-selector
Dom
Modern DOM API.
Stars: ✭ 88 (-65.76%)
Mutual labels:  css-selector
Safrs
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI
Stars: ✭ 255 (-0.78%)
Mutual labels:  json

Build Status Coverage Status NPM Package Node Version Requirement VSCode Extension Example Fangwen Example Douban Movie

English Version

temme

temme 是一个类 jQuery 的选择器,用于简洁优雅地从 HTML 文档中提取所需的 JSON 数据。

例子

<!-- 下面用到的 html 的内容 -->
<ul>
  <li data-fruit-id="1">
    <span data-color="red">apple</span>
  </li>
  <li data-fruit-id="2">
    <span data-color="white">pear</span>
  </li>
  <li data-fruit-id="3">
    <span data-color="purple">grape</span>
  </li>
</ul>

对于上面的 html,我们可以使用下面的 temme 选择器来提取「水果颜色和名称的列表」。(在线版本链接

import temme from 'temme'
// 使用 commonjs 导入时需要加上 .default
// const temme = require('temme').default

const selector = `[email protected] {
  span[data-color=$color]{$name};
}`
temme(html, selector)
//=>
// {
//   "fruits": [
//     { "color": "red", "name": "apple" },
//     { "color": "white", "name": "pear"  },
//     { "color": "purple", "name": "grape" }
//   ]
// }

如果你对 temme 还不熟悉,那么可以从 豆瓣电影的例子 开始。在线版本中也包含了一些其他较短的例子。比如这个例子从豆瓣电影页面中抓取了电影的基本信息和评分信息。这个例子从天猫的商品详情页面中抓取了评论列表,包括用户的基本信息,初次评价和追加评价, 以及晒的照片的链接.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].