Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cb(err);
}
// Attempt to grab the website URL.
try {
websiteUrl = xpath.select1("/*[local-name() = 'widget']/*[local-name() = 'author']/@href", configXmlDoc).value;
}
catch (err) {
console.error("Unable to parse href from the author node from the config.xml file.");
cb(err);
}
// Attempt to query and parse the version information from config.xml.
// Default to 0.0.0 if there are any problems.
try {
var versionString = xpath.select1("/*[local-name() = 'widget']/@version", configXmlDoc).value;
var versionParts = versionString.split(".");
majorVersion = parseInt(versionParts[0], 10);
minorVersion = parseInt(versionParts[1], 10);
buildVersion = parseInt(versionParts[2], 10);
}
catch (err) {
console.log("Error parsing version from config.xml; using 0.0.0 instead.", err);
}
// Create the structure of the buildVars variable.
var buildVars = {
applicationName: applicationName,
email: email,
websiteUrl: websiteUrl,
majorVersion: majorVersion,
minorVersion: minorVersion,
this.readAndroidManifest((err, manifest) => {
if (err) return done.rejectWith(this, [new Error('Manifest read error. ' + err.message)]);
done.result.manifest = manifest;
try {
const doc = new dom().parseFromString(manifest);
// extract the package name from the manifest
const pkg_xpath = '/manifest/@package';
done.result.package = xpath.select1(pkg_xpath, doc).value;
const android_select = xpath.useNamespaces({"android": "http://schemas.android.com/apk/res/android"});
// extract a list of all the (named) activities declared in the manifest
const activity_xpath='/manifest/application/activity/@android:name';
var nodes = android_select(activity_xpath, doc);
nodes && (done.result.activities = nodes.map(n => n.value));
// extract the default launcher activity
const launcher_xpath='/manifest/application/activity[intent-filter/action[@android:name="android.intent.action.MAIN"] and intent-filter/category[@android:name="android.intent.category.LAUNCHER"]]/@android:name';
var nodes = android_select(launcher_xpath, doc);
// should we warn if there's more than one?
if (nodes && nodes.length >= 1)
done.result.launcher = nodes[0].value
} catch(err) {
return done.rejectWith(this, [new Error('Manifest parse failed. ' + err.message)]);
}
done.resolveWith(this, [done.result]);
}
}
}).parseFromString(response.data.toString());
var items = xpath.select('//div[@class="grid-view"]/div[@class="item"]', doc);
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("/")) {
next = "https://movie.douban.com" + next;
}
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//li[@class="title"]/a/em)', parser);
var alt = xpath.select1('string(//li[@class="title"]/a/@href)', parser);
var image = xpath.select1('string(//div[@class="item"]/div[@class="pic"]/a/img/@src)', parser).replace('ipst', 'spst');
var tags = xpath.select1('string(//li/span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var date = xpath.select1('string(//li/span[@class="date"])', parser);
date = date ? date : '';
var recommend = xpath.select1('string(//li/span[starts-with(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//li/span[@class="comment"])', parser);
comment = comment ? comment : '';
var info = xpath.select1('string(//li[@class="intro"])', parser);
info = info ? info : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="info"]/h2/a/@title)', parser);
var alt = xpath.select1('string(//div[@class="info"]/h2/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var pub = xpath.select1('string(//div[@class="pub"])', parser);
var updated = xpath.select1('string(//span[@class="date"])', parser);
var tags = xpath.select1('string(//span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var recommend = xpath.select1('string(//div[@class="short-note"]/div/span[contains(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//p[@class="comment"])', parser);
comment = comment ? comment : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
list.push({
title: title,
alt: alt,
image: image,
pub:pub,
updated:updated,
tags: tags,
recommend: recommend,
comment: comment
});
}
}).parseFromString(response.data.toString());
var items = xpath.select('//ul[@class="interest-list"]/li[@class="subject-item"]', doc);
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("/")) {
next = "https://book.douban.com" + next;
}
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="info"]/h2/a/@title)', parser);
var alt = xpath.select1('string(//div[@class="info"]/h2/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var pub = xpath.select1('string(//div[@class="pub"])', parser);
var updated = xpath.select1('string(//span[@class="date"])', parser);
var tags = xpath.select1('string(//span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var recommend = xpath.select1('string(//div[@class="short-note"]/div/span[contains(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//p[@class="comment"])', parser);
comment = comment ? comment : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
var items = xpath.select('//div[@class="grid-view"]/div[@class="item"]', doc);
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("/")) {
next = "https://movie.douban.com" + next;
}
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//li[@class="title"]/a/em)', parser);
var alt = xpath.select1('string(//li[@class="title"]/a/@href)', parser);
var image = xpath.select1('string(//div[@class="item"]/div[@class="pic"]/a/img/@src)', parser).replace('ipst', 'spst');
var tags = xpath.select1('string(//li/span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var date = xpath.select1('string(//li/span[@class="date"])', parser);
date = date ? date : '';
var recommend = xpath.select1('string(//li/span[starts-with(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//li/span[@class="comment"])', parser);
comment = comment ? comment : '';
var info = xpath.select1('string(//li[@class="intro"])', parser);
info = info ? info : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
list.push({
title: title,
alt: alt,
image: image,
var items = xpath.select('//div[@class="game-list"]/div[@class="common-item"]', doc);
var list = [];
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("?")) {
next = "https://www.douban.com/people/" + config.douban.user + "/games" + next;
}
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="title"]/a)', parser);
var alt = xpath.select1('string(//div[@class="title"]/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var tags = xpath.select1('string(//div[@class="rating-info"]/span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var date = xpath.select1('string(//div[@class="rating-info"]/span[@class="date"])', parser);
date = date ? date : '';
var recommend = xpath.select1('string(//div[@class="rating-info"]/span[contains(@class,"allstar")]/@class)', parser);
recommend = renderStar(recommend.substr(19, 1));
var comment = xpath.select1('string(//div[@class="content"]/div[not(@class)])', parser);
comment = comment ? comment : '';
var info = xpath.select1('string(//div[@class="desc"]/text())', parser);
info = info ? info : '';
info = info.replace(/(^\s*)|(\s*$)/g, '');
list.push({
title: title,
alt: alt,
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("?")) {
next = "https://www.douban.com/people/" + config.douban.user + "/games" + next;
}
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="title"]/a)', parser);
var alt = xpath.select1('string(//div[@class="title"]/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var tags = xpath.select1('string(//div[@class="rating-info"]/span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var date = xpath.select1('string(//div[@class="rating-info"]/span[@class="date"])', parser);
date = date ? date : '';
var recommend = xpath.select1('string(//div[@class="rating-info"]/span[contains(@class,"allstar")]/@class)', parser);
recommend = renderStar(recommend.substr(19, 1));
var comment = xpath.select1('string(//div[@class="content"]/div[not(@class)])', parser);
comment = comment ? comment : '';
var info = xpath.select1('string(//div[@class="desc"]/text())', parser);
info = info ? info : '';
info = info.replace(/(^\s*)|(\s*$)/g, '');
list.push({
title: title,
alt: alt,
image: image,
tags: tags,
date: date,
}).parseFromString(response.data.toString());
var items = xpath.select('//ul[@class="interest-list"]/li[@class="subject-item"]', doc);
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("/")) {
next = "https://book.douban.com" + next;
}
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="info"]/h2/a/@title)', parser);
var alt = xpath.select1('string(//div[@class="info"]/h2/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var pub = xpath.select1('string(//div[@class="pub"])', parser);
var updated = xpath.select1('string(//span[@class="date"])', parser);
var tags = xpath.select1('string(//span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var recommend = xpath.select1('string(//div[@class="short-note"]/div/span[contains(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//p[@class="comment"])', parser);
comment = comment ? comment : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
list.push({
var next = xpath.select('string(//span[@class="next"]/a/@href)', doc);
if (next.startsWith("/")) {
next = "https://book.douban.com" + next;
}
var list = [];
for (var i in items) {
var parser = new Dom().parseFromString(items[i].toString());
var title = xpath.select1('string(//div[@class="info"]/h2/a/@title)', parser);
var alt = xpath.select1('string(//div[@class="info"]/h2/a/@href)', parser);
var image = xpath.select1('string(//div[@class="pic"]/a/img/@src)', parser);
var pub = xpath.select1('string(//div[@class="pub"])', parser);
var updated = xpath.select1('string(//span[@class="date"])', parser);
var tags = xpath.select1('string(//span[@class="tags"])', parser);
tags = tags ? tags.substr(3) : '';
var recommend = xpath.select1('string(//div[@class="short-note"]/div/span[contains(@class,"rating")]/@class)', parser);
recommend = renderStar(recommend.substr(6, 1));
var comment = xpath.select1('string(//p[@class="comment"])', parser);
comment = comment ? comment : '';
//image = 'https://images.weserv.nl/?url=' + image.substr(8, image.length - 8) + '&w=100';
list.push({
title: title,
alt: alt,
image: image,
pub:pub,