Commit 97733f38 authored by TheTechRobo's avatar TheTechRobo
Browse files

Check for single frame on RemovedEDM

parent 7201eb7a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -483,6 +483,19 @@ class removededm(YouTubeService):
                        contains = LinkContains(thumbnail = True),
                        title = "Thumbnail"
                    )
            # Sometimes, if the video itself isn't available, but they have a frame from it,
            # it'll be available here.
            frame_link = f"https://removededm.com/File:{id}_.{extension}"
            async with session.head(frame_link, timeout=15, allow_redirects=True) as response:
                is_archived = response.status == 200
                if is_archived:
                    archived = True
                    yield Link(
                        url = frame_link,
                        contains = LinkContains(single_frame = True),
                        title = "Frame",
                        note = "This is a single frame of the video.",
                    )

        yield cls(
            archived=archived, rawraw=rawraw, metaonly=not got_video,
+3 −0
Original line number Diff line number Diff line
@@ -232,6 +232,9 @@ class LinkContains(JSONDataclass):
    thumbnail: bool = False
    captions: bool = False

    single_frame: bool = False
    """A single frame from the video."""


@dataclasses.dataclass
class Link(JSONDataclass):
+3 −4
Original line number Diff line number Diff line
@@ -42,11 +42,10 @@ function makeLinkElement(link) {
    elem.appendChild(span);
    elem.appendChild(a);

    const possible_contains = ["video", "metadata", "comments", "thumbnail", "captions"];
    let actual_contains = [];
    possible_contains.forEach((i) => {
        if (contains[i]) actual_contains.push(i);
    });
    for (const [key, value] of Object.entries(contains)) {
        if (value === true) actual_contains.push(key.replace("_", " "));
    }
    let contains_str;
    if (actual_contains.length == 1) {
        contains_str = "Contains " + actual_contains[0];