Commit 71e30f1d authored by TheTechRobo's avatar TheTechRobo
Browse files

Update API docs and add classname property

parent 74b6c574
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class YouTube(YouTubeService):
        lastupdated = time.time()
        return cls(
            archived=archived, available=available, capcount=capcount, lastupdated=lastupdated, name=cls.getName(), note="", rawraw=rawraw,
            metaonly=False, comments=False
            metaonly=False, comments=False, classname=cls.__name__
        )

class WaybackMachine(YouTubeService):
@@ -71,7 +71,7 @@ class WaybackMachine(YouTubeService):
        return cls(
                archived=archived, capcount=int(archived), rawraw=rawraw,
                available=lien, lastupdated=time.time(), name=cls.getName(),
                note="", metaonly=ismeta, comments=False
                note="", metaonly=ismeta, comments=False, classname=cls.__name__
        )

class ArchiveOrgDetails(YouTubeService):
@@ -121,7 +121,7 @@ class ArchiveOrgDetails(YouTubeService):
        capcount = int(archived)
        return cls(
            archived=archived, capcount=capcount, available=lien, lastupdated=time.time(), name=cls.getName(), note=note,
            rawraw=rawraw, metaonly=False, comments=False
            rawraw=rawraw, metaonly=False, comments=False, classname=cls.__name__
        )


@@ -189,7 +189,7 @@ class ArchiveOrgCDX(YouTubeService):
        return cls(
                archived=archived, capcount=int(archived), rawraw=None,
                available=lien, lastupdated=time.time(), name=cls.getName(),
                note="", metaonly=ismeta, comments=False
                note="", metaonly=ismeta, comments=False, classname=cls.__name__
        )


@@ -223,7 +223,7 @@ class GhostArchive(YouTubeService):
        lastupdated = time.time()
        return cls(
            archived=archived, available=available, capcount=capcount, lastupdated=lastupdated, name=cls.getName(), note="", rawraw=rawraw,
            metaonly=False, comments=False
            metaonly=False, comments=False, classname=cls.__name__
        )

class HackintYa(YouTubeService):
@@ -254,7 +254,7 @@ class HackintYa(YouTubeService):
        rawraw = (count, commentcount)
        return cls(
            archived=archived, capcount=count, comments=(len(comments) > 0), lastupdated=time.time(), name=cls.getName(),
            note=cls.note if archived else "", rawraw=rawraw, metaonly=False
            note=cls.note if archived else "", rawraw=rawraw, metaonly=False, classname=cls.__name__
        )

FYT_UA = "FindYoutubeVideo/1.0 operated by TheTechRobo"
@@ -295,7 +295,7 @@ class DistributedYoutubeArchive(YouTubeService):
        return cls(
            archived=archived, capcount=capcount, lastupdated=lastupdated,
            name=cls.getName(), note=note, rawraw=j, metaonly=metaonly,
            comments=comments, available=available
            comments=comments, available=available, classname=cls.__name__
        )

class Hobune(YouTubeService):
@@ -335,7 +335,7 @@ class Hobune(YouTubeService):
        return cls(
            archived=archived, capcount=1 if archived else 0,
            lastupdated=lastupdated, name=cls.getName(), note="",
            rawraw=raw, metaonly=False, comments=False, available=available
            rawraw=raw, metaonly=False, comments=False, available=available, classname=cls.__name__
        )

class removededm(YouTubeService):
@@ -376,7 +376,7 @@ class removededm(YouTubeService):
        return cls(
            archived=archived, rawraw=rawraw, available=lien, metaonly=ismeta, comments=False,
            capcount=(1 if archived else 0), error=None, lastupdated=time.time(),
            name=cls.getName(), note=""
            name=cls.getName(), note="", classname=cls.__name__
        )

# TODO: Make a YouTubeServiceWithCooldown or something
@@ -411,7 +411,7 @@ class Filmot(YouTubeService):
                archived=archived, capcount=capcount,
                lastupdated=lastupdated, name=cls.getName(), note="",
                rawraw=rawraw, metaonly=True, comments=False,
                available=available
                available=available, classname=cls.__name__
        )

class Playboard(YouTubeService):
@@ -444,5 +444,5 @@ class Playboard(YouTubeService):
                archived=archived, capcount=1 if archived else 0,
                lastupdated=lastupdated, name=cls.getName(), note=cls.note,
                rawraw=rawraw, metaonly=True, comments=False,
                available=available
                available=available, classname=cls.__name__
        )
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ class Service(JSONDataclass):
        rawraw (Any): The data used to check whether the video is archived on that particular service. For example, for GhostArchive, it would be the HTTP status code.
        metaonly (bool): True if only the metadata is archived. This value should not be relied on!
        comments (bool): True if the comments are archived. This value should not be relied on!
        classname (str): The internal class name, useful for streaming mode.
    """
    archived: bool
    capcount: int
@@ -44,6 +45,7 @@ class Service(JSONDataclass):
    rawraw: typing.Any
    metaonly: bool
    comments: bool
    classname: str

    available: typing.Optional[str] = None
    suppl: str = ""
+11 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
    <h4>API Documentation</h4>
	<p><b>Please note: The API can be used to embed this site into your own code. If you just want to search for a video, <a href="/">return to the homepage</a>.</b></p>
    <h6>Call: GET <code>/api/:version/:videoid</code></h6>
	<h6>Accepted parameters: <code>includeRaw</code> (set to include the <code>rawraw</code> field)</h6>
	<h6>Accepted query string parameters: <code>includeRaw</code> (set to include the <code>rawraw</code> field), <code>stream</code> (stream service objects as they are processed, rather than all at the end)</h6>
    <p>Current versions available: v2, v3, v4. Documentation below only applies to the latest version.</p>
	<u>Changelog</u>
	<div id="changelog">
@@ -47,7 +47,7 @@
			</ul>
		</ul>
	</div>
    <b>Fields</b>
    <b>Fields (non-streamed mode)</b>
    <dl>
        {% if fields is mapping %}
            {% for field, value in fields.items() %}
@@ -60,7 +60,15 @@
            Fail
        {% endif %}
    </dl>
	<u>NOTE:</u> The <code>rawraw</code> field is only set if you set the <code>includeRaw</code> parameter. Example: <code>/api/v4/dQw4w9WgXcQ?includeRaw=true</code>. Please only enable this if you have to, as it will slow down loading.
	<b>Streaming protocol</b>
	<p>A stream of JSONL: one json object followed by a newline, then the next, etc. The order of what is sent:
	<ul>
		<li>Object of internal class name to on-screen name. Use this to pre-populate the list. You probably don't need the internal class name - it's only provided in case you need it for e.g. element IDs where the usable character set is limited.</li>
		<li>Service objects (see below), as they are generated.</li>
		<li>Null, to show that we are finished generating the service objects. (You can also use the object of class names, but this probably works better.)</li>
		<li>A verdict.</li>
	</ul>
	<u>NOTE:</u> In both cases, the <code>rawraw</code> field is only set if you set the <code>includeRaw</code> parameter. Example: <code>/api/v4/dQw4w9WgXcQ?includeRaw=true</code>. Please only enable this if you have to, as it will slow down loading.
</div>
<div class="container">
    <b>Service Objects</b>