From b6b4252c7238a0f0a59fd896504d2710f824923e Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 22 Aug 2021 20:08:04 +0200 Subject: [PATCH] fix: Light csetforetell-fetch modifications --- src/platforms/csetforetell-fetch.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/platforms/csetforetell-fetch.js b/src/platforms/csetforetell-fetch.js index d8d5d3a..c71ae8a 100644 --- a/src/platforms/csetforetell-fetch.js +++ b/src/platforms/csetforetell-fetch.js @@ -43,7 +43,6 @@ async function fetchStats(questionUrl, cookie){ }), }) .then(res => res.data) - //console.log(response) if(response.includes("Sign up or sign in to forecast")){ throw Error("Not logged in") @@ -131,14 +130,14 @@ async function fetchStats(questionUrl, cookie){ return result } -function isNotSignedIn(html){ +function isSignedIn(html){ - let isNotSignedInBool = html.includes("You need to sign in or sign up before continuing") || html.includes("Sign up") - if(isNotSignedInBool){ + let isSignedInBool = ! ( html.includes("You need to sign in or sign up before continuing") || html.includes("Sign up") ) + if(!isSignedInBool){ console.log("Error: Not signed in.") } - console.log(`isNotSignedIn? ${isNotSignedInBool}`) - return isNotSignedInBool + console.log(`Signed in? ${isSignedInBool}`) + return isSignedInBool } function isEnd(html){ @@ -162,7 +161,7 @@ async function csetforetell_inner(cookie){ let results = [] let init = Date.now() // console.log("Downloading... This might take a couple of minutes. Results will be shown.") - while(!isEnd(response) && !isNotSignedIn(response)){ + while(!isEnd(response) && isSignedIn(response)){ let htmlLines = response.split("\n") let h4elements = htmlLines.filter(str => str.includes("