Switch scraping from Codeberg to Github because scraping codeberg is mean but big company scraping is moral
This commit is contained in:
parent
77aebee1da
commit
9e28abc38c
1 changed files with 9 additions and 3 deletions
|
@ -167,9 +167,15 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateCommits() {
|
async function updateCommits() {
|
||||||
var codebergResponse = await (await fetch(`https://codeberg.org/Bingus_Violet/Violets-Purgatory/src/branch/${process.env.BRANCH || "origin"}`)).text()
|
var siteResponse = await (await fetch(`https://github.com/Violets-puragtory/Violets-Purgatory.dev/tree/${process.env.BRANCH || "origin"}`)).text()
|
||||||
var commits = codebergResponse.substring(0, codebergResponse.indexOf("Commits"))
|
var commits = siteResponse.substring(0, siteResponse.indexOf("Commits"))
|
||||||
commits = commits.substring(commits.lastIndexOf("<b>") + 3, commits.lastIndexOf("</b>"))
|
console.log(commits)
|
||||||
|
// commits = commits.substring(commits.lastIndexOf("<b>") + 3, commits.lastIndexOf("</b>"))
|
||||||
|
// ^ this works for Forgejo (codeberg)
|
||||||
|
|
||||||
|
commits = commits.substring(commits.lastIndexOf(">") + 1)
|
||||||
|
// ^ This works for Github (fuck you Github)
|
||||||
|
|
||||||
commitCount = commits.toString()
|
commitCount = commits.toString()
|
||||||
if (process.env.BRANCH == "dev") {
|
if (process.env.BRANCH == "dev") {
|
||||||
commitCount += " | Beta site!"
|
commitCount += " | Beta site!"
|
||||||
|
|
Loading…
Reference in a new issue