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