Nitter instance bouncing is no longer SAAD

This commit is contained in:
Dakedres 2024-04-13 19:52:24 -06:00
parent 6ddd607da3
commit d80a69920f

View File

@ -4,15 +4,18 @@ import { createSource, createSourceOptions, extractImages, downloadImages, getPo
let nitter = {}
export const fetchChannelFromInstances = async (source) => {
let index = 0
let instances = source.instances
let cachedLink = source.cache.link
let cachedLinkIndex = source.instances.indexOf(source.cache.link)
let index = 0
let instances
let channel
if(cachedLink) {
instances.unshift(cachedLink.hostname)
}
if(cachedLinkIndex !== -1) {
instances = source.instances.toSpliced(cachedLinkIndex, 1)
instances.unshift(source.instances[cachedLinkIndex])
} else {
instances = [ ...source.instances ]
}
while(!channel && index != instances.length) {
source.hostname = instances[index]
channel = await fetchChannel(source)