An open API service indexing awesome lists of open source software.

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

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);
});
```