Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesfrost/gnip-rule-parser
Parse Twitter (GNIP) PowerTrack/Search rules into an abstract syntax tree.
https://github.com/jamesfrost/gnip-rule-parser
gnip gnip-powertrack twitter twitter-api twitter-streaming-api
Last synced: about 2 months ago
JSON representation
Parse Twitter (GNIP) PowerTrack/Search rules into an abstract syntax tree.
- Host: GitHub
- URL: https://github.com/jamesfrost/gnip-rule-parser
- Owner: JamesFrost
- License: mit
- Created: 2017-07-26T12:41:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T10:57:12.000Z (over 6 years ago)
- Last Synced: 2024-11-07T17:17:24.844Z (2 months ago)
- Topics: gnip, gnip-powertrack, twitter, twitter-api, twitter-streaming-api
- Language: JavaScript
- Homepage: http://jamesfrost.me/gnip-rule-parser/
- Size: 398 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gnip-rule-parser [![Build Status](https://travis-ci.org/JamesFrost/gnip-rule-parser.svg?branch=master)](https://travis-ci.org/JamesFrost/gnip-rule-parser)
Parse [GNIP PowerTrack/Search rules](https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview) into an abstract syntax tree.[Try the online demo here](http://jamesfrost.me/gnip-rule-parser/).
*If you want to validate rules, I strongly suggest you use the [validation API endpoint](https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/powertrack-stream#get-validation).*
## Getting Started
### Installation
```bash
npm install --save gnip-rule-parser
```
### Running The Tests
```bash
mocha
```
### Usage
```js
var parser = require( 'gnip-rule-parser' );try
{
var ast = parser.parse( 'happy OR party' );console.log( ast );
}
catch( err )
{
// Rule isn't valid
}
```
#### Output
```bash
[
{
name: 'boolean',
value: 'OR',
leftBranch:
{
name: 'keyword',
value: 'happy'
},
rightBranch:
{
name: 'keyword',
value: 'party'
}
}
]
```
## License
MIT