fix: metaculus fetch

This commit is contained in:
NunoSempere 2022-01-12 13:06:29 +01:00
parent 07f30f57a2
commit 379269a2a1
6 changed files with 50091 additions and 51816 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ AlgoliaNotes.md
## Build artifacts
done.txt
*.swp

File diff suppressed because one or more lines are too long

0
heroku
View File

View File

@ -53,7 +53,8 @@ async function processPredictions(predictions) {
"createdTime": prediction.createdTime,
"volume7Days": prediction.volume7Days,
"volume24Hours": prediction.volume24Hours,
"pool": prediction.pool // normally liquidity, but I don't actually want to show it.
"pool": prediction.pool, // normally liquidity, but I don't actually want to show it.
"isResolved": prediction.isResolved
}
})
return result
@ -74,4 +75,4 @@ export async function manifoldmarkets() {
await upsert(results, "manifoldmarkets-questions")
console.log("Done")
}
manifoldmarkets()
// manifoldmarkets()

View File

@ -82,6 +82,7 @@ export async function metaculus() {
await sleep(5000)
let questionPage = await fetchMetaculusQuestionDescription(result.page_url)
if(!questionPage.includes("A public prediction by")){
console.log(questionPage)
let descriptionraw = questionPage.split(`<div class="content" ng-bind-html-compile="qctrl.question.description_html">`)[1] //.split(`<div class="question__content">`)[1]
let descriptionprocessed1 = descriptionraw.split("</div>")[0]
let descriptionprocessed2 = toMarkdown(descriptionprocessed1)

View File

@ -2,7 +2,7 @@ import fs from "fs"
import { mongoReadWithReadCredentials } from "./mongo-wrapper.js"
let filename = '/home/loki/Documents/core/software/fresh/js/metaforecasts/metaforecasts-backend/data/frontpage.json'
let filename = '/home/loki/Documents/core/software/fresh/js/metaforecast/metaforecast-backend/data/frontpage.json'
let shuffle = (array) => {
// https://stackoverflow.com/questions/2450954/how-to-randomi ze-shuffle-a-javascript-array
let currentIndex = array.length, randomIndex;