happy path in mixdrop

This commit is contained in:
Jonathan Barrow
2023-09-29 14:37:01 -04:00
parent db79b16a83
commit c2d1fdde67

View File

@@ -16,12 +16,23 @@ export const mixdropScraper = makeEmbed({
const streamRes = await ctx.proxiedFetcher<string>(ctx.url);
const packed = streamRes.match(packedRegex);
if (packed) {
// MixDrop uses a queue system for embeds
// If an embed is too new, the queue will
// not be completed and thus the packed
// JavaScript not present
if (!packed) {
throw new Error('failed to find packed mixdrop JavaScript');
}
const unpacked = unpacker.unpack(packed[1]);
const link = unpacked.match(linkRegex);
if (link) {
if (!link) {
throw new Error('failed to find packed mixdrop source link');
}
const url = link[1];
return {
stream: {
type: 'file',
@@ -38,9 +49,5 @@ export const mixdropScraper = makeEmbed({
},
},
};
}
}
throw new Error('mixdrop source not found');
},
});