Commit 8a7b0c40 authored by TheTechRobo's avatar TheTechRobo
Browse files

Temporary circumvention for Playboard scraper

I hope they don't fix it. I'm not causing harm to their service by doing
this (e.g. by scraping data off and then reselling/reusing it).
If you are a Playboard employee and are reading this, please contact me.
thetechrobo AT proton DOT me
parent abf254de
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ class Playboard(YouTubeService):
    Playboard is metadata-only as far as I know.
    """
    name = "Playboard.co"
    note = "The Playboard scraper is unreliable; please verify values yourself."

    @classmethod
    def _run(cls, id, includeRaw=True, asynchronous=False):
@@ -184,18 +185,16 @@ class Playboard(YouTubeService):
        rawraw = {"status_code": code, "ua_used": user_agent}
        lastupdated = time.time()
        available = None
        if code == 200:
        if code == 200 or code == 429:
            archived = True
            available = url
        elif code == 404:
            archived = False
        elif code == 429:
            raise AssertionError("We've been blocked by Playboard")
        else:
            raise AssertionError(f"bad status code {code}")
        return cls(
                archived=archived, capcount=1 if archived else 0,
                lastupdated=lastupdated, name=cls.getName(), note="",
                lastupdated=lastupdated, name=cls.getName(), note=cls.note,
                rawraw=rawraw, metaonly=True, comments=False,
                available=available
        )