Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseHtml(htmlBody, cb) {
var soup = new JSSoup(htmlBody);
// itterate all JSSoup elements array to find interesting tags
soup.findAll().forEach(function (el) {
// filters tags with no interest check excluded list at top
var tag = _.find(excluded_1.default, function (tagName) {
if (tagName === el.name) {
return el;
}
});
// concatinating all text in one place
if (!tag && el.string !== undefined) {
rawHtmlText += el.text + ' ';
}
});
cb(rawHtmlText.replace(/"|'/g, '').toLowerCase()); // Some Keywords are wraped in "" || '' which will be replace with \s using this RegEx
}
function fromHTMLtoStringArray(siteUrl, isLocal, callback) {
function parseHtml(htmlBody, cb) {
const soup = new JSSoup(htmlBody);
// itterate all JSSoup elements array to find interesting tags
soup.findAll().forEach(el => {
// filters tags with no interest check excluded list at top
const tag = _.find(excluded, (tagName) => {
if (tagName === el.name) { return el; }
});
// concatinating all text in one place
if (!tag && el.string !== undefined) { rawHtmlText += el.text + ' '; }
});
cb(rawHtmlText.replace(/"|'/g, '').toLowerCase()); // Some Keywords are wraped in "" || '' which will be replace with \s using this RegEx
}
.then(html => {
// @ts-ignore
const soup = new JSSoup(html.replace('', ''));
const table = soup.find('table');
const inputs = table.findAll('input');
const benchmark = inputs.map(input => {
const score = input.previousElement.text.replace(' ', '').replace('*', '');
let name = '';
input.previousElement.contents.forEach(row => {
if (row.nextElement.text) {
name = row.nextElement.text;
}
});
return `${score} - ${name}`;
});
.then((html) => {
const soup = new JSSoup(html.replace('', ''));
const table = soup.find('table');
const inputs = table.findAll('input');
const benchmark = inputs.map((input) => {
const score = input.previousElement.text.replace(' ', '').replace('*', '');
let name = '';
input.previousElement.contents.forEach((row) => {
if (row.nextElement.text) {
name = row.nextElement.text;
}
});
return `${score} - ${name}`;
});
request('http://gen.lib.rus.ec/search.php?&req=' + encodeURIComponent(this.state.paperKeyword) + '&view=detailed&res=100', (err, response, body) => {
switch (err) {
case null:
switch (response.statusCode) {
case 200:
let ids = []
var soup = new JSSoup(body).findAll('table')
for (var i = 0; i < soup.length; i++) {
if (soup[i].findAll('td').length == 43) {
ids.push(soup[i].findAll('td')[26].contents[0]._text)
}
if (i == soup.length - 1) {
request({ url: `http://gen.lib.rus.ec/json.php?ids=${ids.join(',')}&fields=*` },
(err, response, body) => {
switch (err) {
case null:
switch (response.statusCode) {
case 200:
this.setState({
literatureSearchResults: JSON.parse(body),
networkPageIndex: 4,
literatureSearchResultsDisplay: true
})