filtering all sources of post images

This commit is contained in:
waltem01 2024-02-22 10:41:17 +01:00
parent 4d6867e690
commit f2cb916782

View File

@ -17,6 +17,12 @@ export const GET: RequestHandler = async ({ url }) => {
// Read data as string // Read data as string
const text = await response.text(); const text = await response.text();
// Get all sources of posts
const regex = /<img[^>]+role="presentation"[^>]+src="(.*?)"[^>]*>/g;
let results = [], match;
while ((match = regex.exec(text)) !== null)
results.push(match[1]);
// Return source data // Return source data
return json({ success: true, results: text.split('\n') } as APIResponse); return json({ success: true, results } as APIResponse);
}; };