Fix cheerio.load statement
parent
f0f451690c
commit
b005b7f969
|
@ -86,9 +86,10 @@ function parseGamePrefixes(body) {
|
||||||
// Obtain the title prefixes
|
// Obtain the title prefixes
|
||||||
const prefixeElements = body.find(f95Selector.GT_TITLE_PREFIXES);
|
const prefixeElements = body.find(f95Selector.GT_TITLE_PREFIXES);
|
||||||
|
|
||||||
|
const $ = cheerio.load([].concat(body));
|
||||||
prefixeElements.each(function parseGamePrefix(idx, el) {
|
prefixeElements.each(function parseGamePrefix(idx, el) {
|
||||||
// Obtain the prefix text
|
// Obtain the prefix text
|
||||||
let prefix = cheerio.load(el).text().trim();
|
let prefix = $(el).text().trim();
|
||||||
|
|
||||||
// Remove the square brackets
|
// Remove the square brackets
|
||||||
prefix = prefix.replace("[", "").replace("]", "");
|
prefix = prefix.replace("[", "").replace("]", "");
|
||||||
|
@ -167,8 +168,9 @@ function extractTags(body) {
|
||||||
|
|
||||||
// Get the game tags
|
// Get the game tags
|
||||||
const tagResults = body.find(f95Selector.GT_TAGS);
|
const tagResults = body.find(f95Selector.GT_TAGS);
|
||||||
|
const $ = cheerio.load([].concat(body));
|
||||||
return tagResults.map(function parseGameTags(idx, el) {
|
return tagResults.map(function parseGameTags(idx, el) {
|
||||||
return cheerio.load(el).text().trim();
|
return $(el).text().trim();
|
||||||
}).get();
|
}).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +302,7 @@ function parseMainPostText(text) {
|
||||||
*/
|
*/
|
||||||
function parseScriptTag(element) {
|
function parseScriptTag(element) {
|
||||||
// Get the element HTML
|
// Get the element HTML
|
||||||
const html = cheerio.load(element).html().trim();
|
const html = cheerio.load([].concat(element)).html().trim();
|
||||||
|
|
||||||
// Obtain the JSON-LD
|
// Obtain the JSON-LD
|
||||||
const data = html
|
const data = html
|
||||||
|
|
Loading…
Reference in New Issue