-
Notifications
You must be signed in to change notification settings - Fork 0
/
zarbanScraper.js
51 lines (47 loc) · 1.13 KB
/
zarbanScraper.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
const Scraper = require('./scraper')
var replaces = [
{
from: 'تاریخ',
to: 'Date',
exactly: true,
},
{
from: 'نام کالا',
to: 'Currency',
exactly: true,
},
{
from: 'خرید',
to: 'Buy',
exactly: true,
},
{
from: 'فروش',
to: 'Sell',
exactly: true,
},
{
from: 'دلار کانادا - کارتخوان',
to: 'CAD',
exactly: true,
},
{
from: 'دلار آمريکا اسکناس',
to: 'USD',
exactly: false,
maxCharDiff: 1
}
];
const zarbanScraper = new Scraper('http://www.zarban.ca/',0,replaces);
zarbanScraper.getCurrencies().then(console.log).catch(console.error);
// zarbanScraper.getPageContent().then(html => {
// fs.writeFile('zarban.html', html, function(err) {
// if(err) console.error(err);
// })
// })
// fs.readFile('zarban.html', function(err, buf) {
// if(err) console.error(err);
// else if(buf){
// zarbanScraper.getCurrenciesFromHTML(buf).then(console.log).catch(console.error);
// }
// })