Skip to content

Instantly share code, notes, and snippets.

@QuiltMeow
Created April 15, 2025 14:26
Show Gist options
  • Select an option

  • Save QuiltMeow/26273c685730301da3ec78655410a0aa to your computer and use it in GitHub Desktop.

Select an option

Save QuiltMeow/26273c685730301da3ec78655410a0aa to your computer and use it in GitHub Desktop.
Host Loc Gain Point
// https://hostloc.com/
function getRandomValue(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function getUniqueRandomList(size) {
let ret = new Set();
while (ret.size < size) {
ret.add(getRandomValue(1, 77000));
}
return [...ret];
}
function fetchURL(count) {
let period = 6000;
let visitId = getUniqueRandomList(count);
for (let i = 0; i < count; ++i) {
let id = visitId[i];
setTimeout(() => {
fetch(`https://hostloc.com/space-uid-${id}.html`).then(response => {
if (response.ok) {
console.log("完成存取 ID:" + id);
} else {
console.error("存取 ID:" + id + " 時失敗:" + response.status);
}
}).catch(error => {
console.error("存取 ID:" + id + " 時發生例外狀況:" + error);
});
}, i * period);
}
}
fetchURL(20);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment