fix: Added more detection of whether I'm not logged in to CSET-foretell; it turns out that the first page of questions is shown even if not logged in.

This commit is contained in:
NunoSempere 2021-07-05 00:01:09 +02:00
parent c46c0242a2
commit 87db98ec45
3 changed files with 4386 additions and 0 deletions

View File

@ -45,6 +45,10 @@ async function fetchStats(questionUrl, cookie){
.then(res => res.data) .then(res => res.data)
//console.log(response) //console.log(response)
if(response.includes("Sign up or sign in to forecast")){
throw Error("Not logged in")
}
// Is binary? // Is binary?
let isbinary = response.includes("binary?":true") let isbinary = response.includes("binary?":true")
// console.log(`is binary? ${isbinary}`) // console.log(`is binary? ${isbinary}`)
@ -104,6 +108,8 @@ async function fetchStats(questionUrl, cookie){
let description = descriptionprocessed8 let description = descriptionprocessed8
// Number of forecasts // Number of forecasts
console.log(response)
console.log(response.split("prediction_sets_count":")[1])
let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0] let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0]
// console.log(numforecasts) // console.log(numforecasts)

View File

@ -108,6 +108,9 @@ async function fetchStats(questionUrl, cookie) {
} }
function isEnd(html) { function isEnd(html) {
if(html.includes("You need to sign in or sign up before continuing")){
throw Error("You need to sign in or sign up before continuing")
}
return html.includes("No questions match your filter") return html.includes("No questions match your filter")
} }

4377
temp.txt Normal file

File diff suppressed because one or more lines are too long