Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/get-view-state
Extract the view state value from an html page parsed with [cheerio](https://github.com/MatthewMueller/cheerio)
https://github.com/nisaacson/get-view-state
Last synced: about 1 month ago
JSON representation
Extract the view state value from an html page parsed with [cheerio](https://github.com/MatthewMueller/cheerio)
- Host: GitHub
- URL: https://github.com/nisaacson/get-view-state
- Owner: nisaacson
- Created: 2013-04-18T18:54:47.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-18T19:08:46.000Z (over 11 years ago)
- Last Synced: 2024-09-13T02:55:21.837Z (2 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Get View State
Extract the view state value from an html page parsed with [cheerio](https://github.com/MatthewMueller/cheerio)
[![Build Status](https://travis-ci.org/nisaacson/get-view-state.png)](https://travis-ci.org/nisaacson/get-view-state)
# Installation```bash
npm install -S get-view-state
```# Usage
```js
var inspect = require('eyespect').inspector();
var cheerio = require('cheerio')
var getViewState = require('get-view-state')// file path to a webpage with a view state element in the html
var filePath = path.join(__dirname, 'data/yesViewState.html')
var html = fs.readFileSync(filePath, 'utf8')
var $ = cheerio.load(html)// extract the value attribute from the view state element
var viewState = getViewState($)
inspect(viewState, 'extracted view state')
```