diff --git a/src/platforms/csetforetell-fetch.js b/src/platforms/csetforetell-fetch.js
index 477d79a..96f038e 100644
--- a/src/platforms/csetforetell-fetch.js
+++ b/src/platforms/csetforetell-fetch.js
@@ -13,7 +13,9 @@ String.prototype.replaceAll = function replaceAll(search, replace) { return this
/* Support functions */
async function fetchPage(page, cookie){
-
+ if(page==1){
+ cookie=cookie.split(";")[0] // Interesting that it otherwise doesn't work :(
+ }
let response = await axios({
url: htmlEndPoint+page,
method: 'GET',
@@ -46,6 +48,7 @@ async function fetchStats(questionUrl, cookie){
if(isbinary){
// Crowd percentage
let htmlElements = response.split("\n")
+ // console.log(htmlElements)
let h3Element = htmlElements.filter(str => str.includes("
"))[0]
let crowdpercentage = h3Element.split(">")[1].split("<")[0]
let probability = Number(crowdpercentage.replace("%", ""))/100
@@ -59,7 +62,9 @@ async function fetchStats(questionUrl, cookie){
type: "PROBABILITY"
}))
}else{
- let optionsHtmlElement = "
"
+ let optionsBody = response.split("tbody")[1]
+ // console.log(optionsBody)
+ let optionsHtmlElement = ""
let tablesAsJson = Tabletojson.convert(optionsHtmlElement)
let firstTable = tablesAsJson[0]
options = firstTable.map(element => ({
@@ -68,23 +73,23 @@ async function fetchStats(questionUrl, cookie){
type: "PROBABILITY"
}))
}
-
- // Description
- let descriptionraw = response.split(` `)[0]
let descriptionprocessed2 = descriptionprocessed1.replace(">", "")
let descriptionprocessed3 = descriptionprocessed2.replace("To suggest a change or clarification to this question, please select Request Clarification from the green gear-shaped dropdown button to the right of the question.", ``)
// console.log(descriptionprocessed3)
let descriptionprocessed4=descriptionprocessed3.replaceAll("\r\n\r\n", "\n")
- let descriptionprocessed5=descriptionprocessed4.replaceAll("\n\n", "\n")
+ let descriptionprocessed5= descriptionprocessed4.replaceAll("\n\n", "\n")
let descriptionprocessed6=descriptionprocessed5.replaceAll(""", `"`)
let descriptionprocessed7=descriptionprocessed6.replaceAll("'", "'")
let descriptionprocessed8=toMarkdown(descriptionprocessed7)
let description = descriptionprocessed8
+
// Number of forecasts
let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0]
// console.log(numforecasts)
-
+
// Number of predictors
let numforecasters = response.split("predictors_count":")[1].split(",")[0]
// console.log(numpredictors)
@@ -120,12 +125,23 @@ async function csetforetell_inner(cookie){
let init = Date.now()
// console.log("Downloading... This might take a couple of minutes. Results will be shown.")
while(!isEnd(response)){
- // console.log(`Page #${i}`)
+
let htmlLines = response.split("\n")
- let h4elements = htmlLines.filter(str => str.includes("