mirror of
https://git.stupid.fish/teidesu/scripts.git
synced 2025-07-28 02:32:11 +10:00
chore: update public repo
This commit is contained in:
parent
c118bcbfc3
commit
f02ccb6029
12 changed files with 510 additions and 2 deletions
39
scripts/misc/shikimori/utils.ts
Normal file
39
scripts/misc/shikimori/utils.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { ffetch as ffetchBase } from '../../../utils/fetch.ts'
|
||||
import { rateLimitBypass } from './_very-secret-ratelimit-bypass.ts'
|
||||
|
||||
export const ffetchShiki = ffetchBase.extend({
|
||||
baseUrl: 'https://shikimori.one',
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
|
||||
'Accept-Language': 'en-US,en;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
},
|
||||
retry: {},
|
||||
...(rateLimitBypass as any),
|
||||
})
|
||||
|
||||
export function counterIter(start = 0, end = Infinity) {
|
||||
let i = start
|
||||
let ended = false
|
||||
|
||||
const iter: IterableIterator<number> = {
|
||||
[Symbol.iterator]: () => iter,
|
||||
next() {
|
||||
if (ended) {
|
||||
return { value: undefined, done: true }
|
||||
}
|
||||
|
||||
if (i > end) {
|
||||
return { value: undefined, done: true }
|
||||
}
|
||||
|
||||
return { value: i++, done: false }
|
||||
},
|
||||
}
|
||||
return {
|
||||
iter,
|
||||
end: () => {
|
||||
ended = true
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue