Commit d41f49df authored by TheTechRobo's avatar TheTechRobo
Browse files

Add Nyane.online

parent 722b5e90
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ methods:

  playboard_co:
    title: Playboard.co
    enabled: true
    enabled: false
    user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.%s.0.0 Safari/537.36"

  removededm:
@@ -61,5 +61,9 @@ methods:
    title: PreserveTube
    enabled: true

  nyaneonline:
    title: Nyane.online
    enabled: true

# Global User-Agent
user_agent: "FindYoutubeVideo/1.0 operated by TheTechRobo"
user_agent: "FindYoutubeVideo/1.0 operated by XYZ"
+28 −1
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ class Filmot(YouTubeService):
        while time.time() - cls.lastretrieved < cls.cooldown:
            await asyncio.sleep(0.1)
        lastupdated = time.time()
        cls.lastretrieved = time.time()
        cls.lastretrieved = int(time.time())
        async with session.get(f"https://filmot.com/api/getvideos?key={key}&id={id}&flags=1") as resp:
            metadata = await resp.json(content_type=None)
        rawraw = metadata
@@ -550,3 +550,30 @@ class PreserveTube(YouTubeService):
                rawraw=None, comments=False, available=available,
                metaonly=False, classname=cls.__name__
        )

class NyaneOnline(YouTubeService):
    name = methods['nyaneonline']['title']
    note = ""
    configId = "nyaneonline"

    @classmethod
    async def _run(cls, id, session: aiohttp.ClientSession) -> typing.Self:
        url = f"https://www.nyane.online/video"

        async with session.head(url, params={"id": id}) as resp:
            lastupdated = time.time()
            status = resp.status
            if status == 200:
                archived = True
                available = str(resp.request_info.url)
            elif status == 404:
                archived = False
                available = None
            else:
                raise AssertionError(f"bad status code {status}")

        return cls(archived=archived, capcount=1 if archived else 0,
                   lastupdated=lastupdated, name=cls.getName(), note=cls.note,
                   rawraw=None, comments=False, available=available,
                   metaonly=False, classname=cls.__name__
        )