From ad98c439e3ec37337e714404637aaac7087a9274 Mon Sep 17 00:00:00 2001 From: OCDkirby Date: Sat, 15 Jul 2023 13:04:54 -0500 Subject: [PATCH] Request number of contributors from GH API --- src/App.vue | 4 +++- src/components/Hook.vue | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 5de9200..7688e4c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -67,7 +67,9 @@ const darkThemeOverrides: GlobalThemeOverrides = {
- + + +
diff --git a/src/components/Hook.vue b/src/components/Hook.vue index 0a02769..f7c90cd 100644 --- a/src/components/Hook.vue +++ b/src/components/Hook.vue @@ -11,11 +11,9 @@ function getTime() { return months > 12 ? (time_result[0] + Math.round(time_result[1] / 12 * 10) / 10) + " years" : months + "months"; } -var contributors = 10; // TODO web scraping -// const response = await fetch("https://cors-anywhere.herokuapp.com/https://github.com/RPCSX/rpcsx/"); -// contributors = await cheerio.load(response.text())('.Counter m1-1'); -// console.log("hi"); - +const response = await fetch('https://api.github.com/repos/rpcsx/rpcsx/contributors?per_page=1') +const headers = response.headers +var contributors = headers.get('link')?.match(/&page=(\d+)>; rel="last"/)[1]