-
Notifications
You must be signed in to change notification settings - Fork 0
/
osmosis.js
45 lines (31 loc) · 930 Bytes
/
osmosis.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
var osmosis = require('osmosis');
const cheerio = require("cheerio");
const $ = require('cheerio');
osmosis
.get('https://standupstore.ru')
//.set({'related': ['.infiniti-contant']})
.paginate('.inf-next-link > a', 20)
.find('.js-product')
.set({'id': ['comment()[1]'],
'href': ['a[href]@href'],
'seats' : ['a[href]@data-seats'],
'cost' : ['a[href]@data-cost'],
'img': ['.t-bgimg@style']})
.data(function(listing) {
// do something with listing data
// console.log(listing.id);
$(listing.id[0],'.order').each(function() {
var data = {};
data.id=$(this).attr('data-id');
data.date=$(this).attr('data-date');
data.seats=$(this).attr('data-seats');
data.cost=$(this).attr('data-cost');
data.img=listing.img;
data.href=listing.href;
console.log(data);
//console.log('lol');
});
})
.log(console.log)
.error(console.log)
.debug(console.log)