https://github.com/prolificinteractive/glenlivet-html-to-json
A simple wrapper around html-to-json for glenlivet
https://github.com/prolificinteractive/glenlivet-html-to-json
Last synced: over 1 year ago
JSON representation
A simple wrapper around html-to-json for glenlivet
- Host: GitHub
- URL: https://github.com/prolificinteractive/glenlivet-html-to-json
- Owner: prolificinteractive
- Created: 2014-12-15T23:27:27.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-15T23:31:49.000Z (over 11 years ago)
- Last Synced: 2025-02-22T23:19:00.702Z (over 1 year ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# glenlivet-html-to-json
A simple wrapper around html-to-json for glenlivet.
## Installation
`npm install glenlivet-html-to-json`
## Usage
```javascript
prolific.bottle('getPageLinks', {
request: {
method: 'GET',
pathname: function (data) {
return data.page || '/';
}
},
htmlToJson: ['a[href]', {
'href': function ($a) {
return $a.attr('href');
},
'text': function ($a) {
return $a.text().split("\n").shift().trim();
}
}]
});
prolific
.getPageLinks({
page: '/about'
})
.get('json')
.done(function (links) {
console.log(links);
});
```