parent
7f51092362
commit
a6a4308276
|
|
@ -8,7 +8,6 @@ import {
|
|||
|
||||
interface Attachment {
|
||||
url: string; // original media URL, ?sensitive=true stripped
|
||||
previewUrl?: string; // poster / cached preview (for video posters)
|
||||
contentType: ContentType;
|
||||
}
|
||||
|
||||
|
|
@ -100,14 +99,12 @@ export default class Mastodon extends ScrapeEngineBase {
|
|||
if (!rawHref) continue;
|
||||
|
||||
const img = a.querySelector("img");
|
||||
const preview = img?.currentSrc || img?.src;
|
||||
|
||||
const url = this.normalizeUrl(rawHref) || this.largestFromSrcset(img);
|
||||
if (!url) continue;
|
||||
|
||||
add({
|
||||
url,
|
||||
previewUrl: preview && preview !== url ? preview : undefined,
|
||||
contentType: this.contentTypeFor(url),
|
||||
});
|
||||
}
|
||||
|
|
@ -121,12 +118,8 @@ export default class Mastodon extends ScrapeEngineBase {
|
|||
const url = this.normalizeUrl(rawSrc);
|
||||
if (!url) continue;
|
||||
|
||||
// Use the poster as a thumbnail when available.
|
||||
const poster = v.getAttribute("poster") || undefined;
|
||||
|
||||
add({
|
||||
url,
|
||||
previewUrl: poster && poster !== url ? poster : undefined,
|
||||
contentType: "video",
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue