fix: metaculus fetch
This commit is contained in:
		
							parent
							
								
									07f30f57a2
								
							
						
					
					
						commit
						379269a2a1
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -13,3 +13,4 @@ AlgoliaNotes.md | |||
| 
 | ||||
| ## Build artifacts | ||||
| done.txt | ||||
| *.swp | ||||
|  |  | |||
							
								
								
									
										101892
									
								
								data/frontpage.json
									
									
									
									
									
								
							
							
						
						
									
										101892
									
								
								data/frontpage.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -53,13 +53,14 @@ 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 | ||||
|     }) | ||||
|     let unresolvedResults = results.filter(result => !result.isResolved) | ||||
| 	  console.log(unresolvedResults) | ||||
|     console.log(unresolvedResults) | ||||
|     return unresolvedResults //resultsProcessed
 | ||||
| } | ||||
| 
 | ||||
|  | @ -74,4 +75,4 @@ export async function manifoldmarkets() { | |||
|     await upsert(results, "manifoldmarkets-questions") | ||||
|     console.log("Done") | ||||
| } | ||||
| manifoldmarkets() | ||||
| // manifoldmarkets()
 | ||||
|  |  | |||
|  | @ -82,7 +82,8 @@ export async function metaculus() { | |||
|         await sleep(5000)  | ||||
|         let questionPage = await fetchMetaculusQuestionDescription(result.page_url) | ||||
|         if(!questionPage.includes("A public prediction by")){ | ||||
|           let descriptionraw = questionPage.split(`<div  class="content" ng-bind-html-compile="qctrl.question.description_html">`)[1] //.split(`<div class="question__content">`)[1]
 | ||||
| 					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) | ||||
|           let description = descriptionprocessed2 | ||||
|  |  | |||
|  | @ -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; | ||||
|  | @ -39,4 +39,4 @@ let main = async () => { | |||
|   console.log(`Took ${difference / 1000} seconds, or ${difference / (1000 * 60)} minutes.`) | ||||
| 
 | ||||
| } | ||||
| main() | ||||
| main() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user