forked from charu25/scp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassert1.js
More file actions
40 lines (34 loc) · 881 Bytes
/
assert1.js
File metadata and controls
40 lines (34 loc) · 881 Bytes
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
var read=require("./read");
var title,price,status;
var dell;
var pr={};
pr["www.snapdeal.com"]="span#selling-price-id";
pr["www.flipkart.com"]="span.fk-font-verybig.pprice.fk-bold";
pr["www.amazon.in"]="b.priceLarge";
var st={};
st["www.snapdeal.com"]="span#inventory-attr-msg.inventory-text";
st["www.flipkart.com"]="div#fk-stock-info-id.stock-status.instock";
st["www.amazon.in"]="span.availGreen";
function check($,content,i){
if (content) {
$("h1").each(function(i, e) {
title=$(e).text();
});
$(pr[i]).each(function(i, e) {
price=$(e).text();
});
$(st[i]).each(function(i, e) {
status=$(e).text();
});
dell={
"title":title.trim(),
"price":price.trim(),
"status":status.trim(),};
console.log("done");
console.log(dell);
return dell;
}
else console.log("error");
}
this.check=check;
//read.ch(dell)