fix: Fix js memory/garbage collecting problems by not fetching as much information in the 1st place.

Turns out that the Hypermind request just has a parameter I can switch.
This commit is contained in:
NunoSempere 2021-08-13 18:23:58 +02:00
parent 140184cd64
commit 255af85b39

View File

@ -61,7 +61,7 @@ async function fetchHypermindDataShowcases(slug, cookie) {
//"Cookie": cookie //"Cookie": cookie
}, },
"referrer": "https://prod.hypermind.com/ngdp/en/showcase/showcase.html?inFrame=true", "referrer": "https://prod.hypermind.com/ngdp/en/showcase/showcase.html?inFrame=true",
"data": `[["showcase","getShowcase",{"showcase":"${slug}","fmt":{"fcsterCnt":true,"crowdFcst":true,"crowdFcstHist":true}}]]`, "data": `[["showcase","getShowcase",{"showcase":"${slug}","fmt":{"fcsterCnt":true,"crowdFcst":true,"crowdFcstHist":false}}]]`,
"method": "POST", "method": "POST",
"mode": "cors", "mode": "cors",
httpsAgent: insecureHttpsAgent httpsAgent: insecureHttpsAgent
@ -70,7 +70,7 @@ async function fetchHypermindDataShowcases(slug, cookie) {
.then(items => items.map(item => item.IFP)) .then(items => items.map(item => item.IFP))
// console.log(response) // console.log(response)
response.forEach(item => delete item.crowdFcstHist) // response.forEach(item => delete item.crowdFcstHist)
return response return response
} }
@ -167,7 +167,7 @@ async function hypermind_inner(cookie) {
} }
} }
// console.log(resultsTotal) // console.log(resultsTotal)
console.log(resultsTotalUnique) // console.log(resultsTotalUnique)
console.log(resultsTotalUnique.length, "results") console.log(resultsTotalUnique.length, "results")
// let string = JSON.stringify(resultsTotalUnique, null, 2) // let string = JSON.stringify(resultsTotalUnique, null, 2)
// fs.writeFileSync('./data/hypermind-questions.json', string); // fs.writeFileSync('./data/hypermind-questions.json', string);