-
Notifications
You must be signed in to change notification settings - Fork 9
/
searcher-landmarkonthenet.js
43 lines (33 loc) · 1.23 KB
/
searcher-landmarkonthenet.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
var Searcher = require('./searcher');
var searcher = new Searcher({
merchantName: 'Landmark On The Net',
merchantUrl: 'http://www.landmarkonthenet.com'
});
module.exports = searcher;
searcher.getSearchUrl = function(query) {
return this.merchantUrl + "/product/SearchPaging.aspx" + '?type=0&num=0&code=' + query;
}
searcher.parseHTML = function(window) {
var self = this;
window.$('.searc_box').each(function() {
var item = window.$(this);
var price = item.find('span[id$="_lblListPrice"]').text();
var shipping = item.find('span[id$="_lblShippingPeriod"]').text().trim().replace(/\n/g, "");
var stock = item.find('span[id$="_lblofs"]').text().trim().replace(/\n/g, "");
var publisher = item.find('span[id$="_lablpblisher"]').text().trim().replace(/\n/g, "");
var isbn = item.find('span[id$="_lablisbn"]').text().trim().replace(/\n/g, "");
var author = item.find('a[id$="_authrlnk"]').html().trim().replace(/\n/g, "");
var title = item.find('a[id$="_lnkttl"]').html().trim().replace(/\n/g, "");
var link = item.find('a[id$="_authrlnk"]').attr('href');
self.onItem({
price: price,
shipping: shipping,
stock: stock,
publisher: publisher,
isbn: isbn,
author: author,
title: title,
link: link
});
});
}