This repository has been archived by the owner on Mar 14, 2022. It is now read-only.
forked from urgeiolabs/node-buscape-lookup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bin.js
executable file
·88 lines (84 loc) · 1.63 KB
/
bin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env node
/**
* Dependencies
*/
var buscape = require('./')
, prettyjson = require('prettyjson')
, nomnom = require('nomnom');
var options = {
indent: 2
};
var opts = nomnom
.script('buscape')
.nocolors()
.option('id', {
abbr: 'i',
required: true,
help: 'Lomadee api key'
})
.option('api', {
abbr: 'a',
help: 'Method name for API (findProductList, findOffersList)'
})
.option('price', {
abbr: 'p',
help: 'Price range in the form <min>..<max>'
})
.option('source', {
help: 'Set source id'
})
.option('country', {
abbr: 'c',
help: 'Country to query in'
})
.option('keywords', {
abbr: 'k',
required: true,
help: 'Keywords to search'
})
.option('test', {
abbr: 't',
flag: true,
help: 'Test mode'
})
.option('limit', {
abbr: 'l',
help: 'Limit number of returned products'
})
.option('one', {
abbr: '1',
help: 'Return only one product',
flag: true,
default: false
})
.option('client', {
help: 'Set client ip'
})
.option('page', {
help: 'Set page',
abbr: 'p'
})
.option('category', {
help: 'Set category id',
abbr: 'cat'
})
.option('topProducts', {
help: 'Set flag for top products',
abbr: 'top'
})
.parse();
buscape({keywords: opts.keywords, results: 20})
.id(opts.id)
.country(opts.country)
.test(opts.test)
.one(opts.one)
.limit(opts.limit)
.source(opts.source)
.client(opts.client)
.topProducts(opts.topProducts)
.api(opts.api)
.page(opts.page)
.categoryId(opts.category)
.done(function (err, res) {
console.log(prettyjson.render(res, options));
});