Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linzap/node-g-search
google search crawler
https://github.com/linzap/node-g-search
Last synced: 25 days ago
JSON representation
google search crawler
- Host: GitHub
- URL: https://github.com/linzap/node-g-search
- Owner: LinZap
- Created: 2015-11-11T03:39:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-29T11:43:27.000Z (almost 7 years ago)
- Last Synced: 2024-12-29T22:15:27.710Z (about 1 month ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 4
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Google Search Crawler
[![Join the chat at https://gitter.im/LinZap/node-g-search](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LinZap/node-g-search?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Node Google Search Crawler
## Introduction
```js
var g = require('node-g-search');g.search("bon jovi")
.then(function(d){
if(d.data)
for (var i = 0; i < d.data.length; i++) {
console.log(d.data[i].title);
console.log(d.data[i].href);
console.log(d.data[i].des);
}
})```
## Installation
npm install --save node-g-search
## Search API
### g.search(q[,page[,retry]])
### g.searchAll(q[,retry])
### g.pg()
## Connect to PostgreSQL
[node-postgres](https://github.com/brianc/node-postgres) built-in
and complete access layer to node-postgres via Promises/A+.```js
var g = require('node-g-search'),
db = g.pg();var p = db.connect({
user:'user',
password: 'pwd',
host: 'localhost',
dbname: 'dbname'
}).then(function(client){
return db.query('select ?::int+?::int as ans',[10,20])
.then(function(res){
console.log(res.rows[0].ans);
return res.rows[0].ans;
},function(err){
console.log('%s',err);
})
})```
## Pg Client API### db.connect(option)
```js
{
user:'user',
password: 'pwd',
host: 'localhost',
dbname: 'dbname'
}
```
### db.query(sql [,params])
use [Prepared Statements](https://github.com/brianc/node-postgres/wiki/Prepared-Statements)
`$1`,`$2`or`?`
return Promise<[result](https://github.com/brianc/node-postgres/wiki/Query#result-object)> object
```sql
select * from table where id=?
```
### db.queryIgnore(sql [,params [,retry]])
### db.close()
## License BSD