google-news-rss
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -53,7 +53,9 @@ const assert = require('assert'); | ||
search(terms) { | ||
search(terms, num = 10) { | ||
assert(typeof terms === 'string', true, 'expected terms to be string'); | ||
assert(typeof num === 'number', true, 'expected num to be number'); | ||
return this._request({ | ||
q: terms | ||
q: terms, | ||
num | ||
}); | ||
@@ -64,2 +66,3 @@ } | ||
const options = this._buildOptions(query); | ||
return popsicle.request(options) | ||
@@ -66,0 +69,0 @@ .then(resp => resp.body) |
{ | ||
"name": "google-news-rss", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A node module that searches Google News RSS Feed and returns a usable JSON response", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -21,4 +21,4 @@ # google-news-rss [![Travis branch](https://img.shields.io/travis/brh55/google-news-rss/master.svg?style=flat-square)](https://travis-ci.org/brh55/google-news-rss) [![Coveralls branch](https://img.shields.io/coveralls/brh55/google-news-rss/master.svg?style=flat-square)](https://coveralls.io/github/brh55/google-news-rss) | ||
``` | ||
## Install | ||
@@ -40,6 +40,6 @@ | ||
.then(resp => console.log(resp)); | ||
// | ||
// [ | ||
// { | ||
// [ | ||
// { | ||
// title: 'Why don\'t unicorns exist? You asked Google – here\'s the answer ... - The Guardian', | ||
@@ -64,3 +64,5 @@ // link: 'http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNGNR4Qg8LGbjszT1yt2s2lMXvvufQ&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52779522121279&ei=VQU7WYjiFoLEhQHIs4HQCQ&url=https://www.theguardian.com/commentisfree/2017/jun/07/why-dont-unicorns-exist-google', | ||
## Instance Methods | ||
### .search(terms) | ||
### .search(terms[, num]) | ||
**Returns:** `Promise` that resolves `n` formatted articles | ||
#### terms | ||
@@ -70,3 +72,9 @@ **Type:** `string`<br> | ||
Search terms to search for within Google news. `IE: ethereum,btc` | ||
### num | ||
**Type:** `int`<br> | ||
**Default:** 10 | ||
Number of results to be returned [1...30]. | ||
**Returns:** `Promise` that resolves 10 formatted articles | ||
@@ -81,3 +89,3 @@ | ||
| description | Short description of article | Why don't unicorns exist? You asked Google - here's the answer ... | | ||
| thumbnailUrl | Thumbnail Url | //t2.gstatic.com/images?q=tbn:ANd9GcRa2NGl3_alXByd3kpnDDImMJFGeskk4Mf_AWZc-ohe_O8iEtmBs7hMxieldT_--jQWuDr4gQc | | ||
| thumbnailUrl | Thumbnail Url. **Omitted when not available.** | //t2.gstatic.com/images?q=tbn:ANd9GcRa2NGl3_alXByd3kpnDDImMJFGeskk4Mf_AWZc-ohe_O8iEtmBs7hMxieldT_--jQWuDr4gQc | | ||
| publisher | Publisher of article | The Guardian | | ||
@@ -84,0 +92,0 @@ |
9803
64
91