Updated CSET-foretell logs; updated coupcast month
This commit is contained in:
parent
9831c86674
commit
2ca3815de1
|
@ -8,7 +8,7 @@ import {calculateStars} from "../utils/stars.js"
|
||||||
import {upsert} from "../utils/mongo-wrapper.js"
|
import {upsert} from "../utils/mongo-wrapper.js"
|
||||||
|
|
||||||
/* Definitions */
|
/* Definitions */
|
||||||
let coupCastEndpoint = "https://www.oneearthfuture.org/sites/all/themes/stability/stability_sub/data/dashboard_2021_code_02.csv"
|
let coupCastEndpoint = "https://www.oneearthfuture.org/sites/all/themes/stability/stability_sub/data/dashboard_2021_code_05.csv"
|
||||||
var datenow = new Date();
|
var datenow = new Date();
|
||||||
var currentmonth = datenow.getMonth() + 1;
|
var currentmonth = datenow.getMonth() + 1;
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ function sleep(ms) {
|
||||||
/* Body */
|
/* Body */
|
||||||
|
|
||||||
async function csetforetell_inner(cookie){
|
async function csetforetell_inner(cookie){
|
||||||
let i=1
|
let i=0
|
||||||
let response = await fetchPage(i, cookie)
|
let response = await fetchPage(i, cookie)
|
||||||
let results = []
|
let results = []
|
||||||
let init = Date.now()
|
let init = Date.now()
|
||||||
|
@ -129,9 +129,8 @@ async function csetforetell_inner(cookie){
|
||||||
|
|
||||||
let htmlLines = response.split("\n")
|
let htmlLines = response.split("\n")
|
||||||
let h4elements = htmlLines.filter(str => str.includes("<h5><a href=") || str.includes("<h4><a href="))
|
let h4elements = htmlLines.filter(str => str.includes("<h5><a href=") || str.includes("<h4><a href="))
|
||||||
|
|
||||||
if(process.env.DEBUG_MODE == "on"){
|
if(process.env.DEBUG_MODE == "on"){
|
||||||
console.log(`Page #${i}`)
|
|
||||||
console.log(response)
|
console.log(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +170,9 @@ async function csetforetell_inner(cookie){
|
||||||
console.log(error)
|
console.log(error)
|
||||||
console.log(`We encountered some error when fetching the URL: ${url}, so it won't appear on the final json`)
|
console.log(`We encountered some error when fetching the URL: ${url}, so it won't appear on the final json`)
|
||||||
}
|
}
|
||||||
|
i=i+1
|
||||||
}
|
}
|
||||||
i=i+1
|
|
||||||
// console.log("Sleeping for ~5secs so as to not be as noticeable to the cset-foretell servers")
|
// console.log("Sleeping for ~5secs so as to not be as noticeable to the cset-foretell servers")
|
||||||
await sleep(5000 + Math.random()*1000) // don't be as noticeable
|
await sleep(5000 + Math.random()*1000) // don't be as noticeable
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user