Run the script below in your Browser's DevTools console at https://www.tibia.com/library/?subtopic=boostablebosses.
Created
February 13, 2024 21:55
-
-
Save VitorLuizC/ab127dcd9838ccf71e241a40df06937a to your computer and use it in GitHub Desktop.
Download Tibia bosses information from their site.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function download(fileBlob, fileName) { | |
const anchor = window.document.createElement('a') | |
anchor.rel = 'noreferrer noopener' | |
anchor.href = window.URL.createObjectURL(fileBlob) | |
anchor.target = '_blank' | |
anchor.download = fileName | |
window.document.body.appendChild(anchor) | |
anchor.click() | |
window.setTimeout(() => window.document.body.removeChild(anchor), 1_000) | |
} | |
const BOSSES_SELECTOR = '#boostablebosses .Creatures > div' | |
const bosses = [] | |
window.document.querySelectorAll(BOSSES_SELECTOR).forEach((container) => { | |
const name = container.querySelector('div') | |
const image = container.querySelector('img') | |
window | |
.fetch(image.src) | |
.then((response) => response.blob()) | |
.then((blob) => download(blob, image.src.split('/').at(-1))) | |
bosses.push({ | |
name: name.textContent.trim(), | |
cooldown: 1_000 * 60 * 60 * 20, | |
image_uri: '/image/boss/'.concat(image.src.split('/').at(-1)), | |
}) | |
}) | |
download( | |
new Blob([JSON.stringify(bosses, null, 2)], { | |
type: 'application/json', | |
}), | |
'bosses.json', | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment