-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetails.js
More file actions
89 lines (79 loc) · 3.22 KB
/
details.js
File metadata and controls
89 lines (79 loc) · 3.22 KB
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
89
//page.settings.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7';
//page.settings.XSSAuditingEnabled = false;
var log = ''
var page = new WebPage({
onConsoleMessage: function (msg) {
// console.log(msg);
if (msg.indexOf("LOG") == 0) console.log(msg.replace("LOG",""));
},
settings: {
loadPlugins: false,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7'
},
viewportSize: { width: 1080, height: 800 }
});
var id = phantom.args[0];
var url = "https://chrome.google.com/webstore/detail/"+id;
page.open(url, function (status) {
if (status !== "success") {
console.log("Unable to access network");
} else {
}
});
var h = true;
function is_ready()
{
var _ready = page.evaluate(function() {
if (!document.getElementsByClassName("rsw-stars inline")[0]){
return false;
} else {
return true;
}
});
return _ready;
}
page.onLoadFinished = function (status) {
setInterval(function(){
if (is_ready()){
if (!h) return;
h = false;
page.evaluate(function() {
//phantomjs details.js gjndloejlcbpkholmagjbddfkjmmploh
var name = document.getElementsByClassName("detail-dialog-title")[0].innerText;
var icon = document.getElementsByClassName("detail-dialog-icon")[1].src;
var rating = document.getElementsByClassName("rsw-stars inline")[0].attributes[4].value;
var category = document.getElementsByClassName("detail-dialog-link")[0].innerText;
var usercount = document.getElementsByClassName("detail-dialog-users")[0].innerText.replace("0+", "0").split(" users")[0];
var description = document.getElementsByClassName("overview-tab-right-bar-summary")[0].innerText;
var version = document.getElementsByClassName("details-tab-right-version-info-label")[0].nextSibling.nodeValue.substring(1);
var updated = document.getElementsByClassName("details-tab-right-version-info-label")[1].nextSibling.nodeValue.substring(1);
var language = document.getElementsByClassName("details-tab-right-version-info-label")[2].nextSibling.nodeValue.substring(1);
aw = 2;
if (document.getElementsByClassName("details-tab-right-info-permissions-list").length > 0)
{
if(document.getElementsByClassName("details-tab-right-info-permissions-list")[0].innerHTML.indexOf("all websites") == -1)
{
aw = 2;
} else {
aw = 1;
}
}
var jsod = {
"name":name,
"icon":icon,
"rating":rating,
"category":category,
"usercount":usercount,
"description":description,
"version":version,
"updated":updated,
"language":language,
"aw":aw
};
console.log("LOG"+JSON.stringify(jsod));
//console.log('LOG"'+name+'","'+usercount+'","'+icon+'","'+category+'","'+description+'","'+version+'","'+updated+'","'+rating+'","'+language+'","'+aw+'"');
});
phantom.exit();
}
},50);
};