From 568660c6a99f32cb6dfd8b6569b65ca5f7f77f5f Mon Sep 17 00:00:00 2001 From: Nes370 Date: Sun, 11 Oct 2026 09:39:09 -0700 Subject: [PATCH] Update Mastodon.ts Added video support. --- src/engines/Mastodon.ts | 88 ++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/src/engines/Mastodon.ts b/src/engines/Mastodon.ts index 0cbcf55..541febd 100644 --- a/src/engines/Mastodon.ts +++ b/src/engines/Mastodon.ts @@ -7,26 +7,34 @@ import { } from "../ScrapeEngine.js"; interface Attachment { - url: string; // original URL, ?sensitive=true stripped - previewUrl?: string; // local cached preview (for video posters) + url: string; // original media URL, ?sensitive=true stripped + previewUrl?: string; // poster / cached preview (for video posters) contentType: ContentType; } /** * Handles Mastodon-compatible instances, including forks such as baraag.net. * - * On a Mastodon post page, media is rendered as: - * + * Mastodon renders media in three different shapes: * - * The anchor href is the original (often federated) file. The is a - * scaled-down local cache. We read the anchor href, never the img src. + * 1. Images: + * + * + * + * → read the anchor href. * - * Multi-image posts repeat the same structure; we return one ScrapedPost - * per anchor, matching how Pixiv/Twitter engines behave. + * 2. GIFVs: + * + * → read the