Deploying to documentation from @ CWKevo/python-piped-api-client@56d70e7230 🚀

This commit is contained in:
CWKevo 2022-02-27 08:38:29 +00:00
parent f4b6261315
commit c54e640d6c
6 changed files with 2990 additions and 11 deletions

View file

@ -42,18 +42,33 @@
<h1 class="modulename"> <h1 class="modulename">
piped_api </h1> piped_api </h1>
<div class="docstring"><p>Failed to read README.md!</p>
</div>
<details> <details>
<summary>View Source</summary> <summary>View Source</summary>
<div class="pdoc-code codehilite"><pre><span></span><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> <div class="pdoc-code codehilite"><pre><span></span><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span>
<span class="kn">from</span> <span class="nn">pathlib</span> <span class="kn">import</span> <span class="n">Path</span>
<span class="kn">from</span> <span class="nn">.client</span> <span class="kn">import</span> <span class="n">PipedClient</span> <span class="kn">from</span> <span class="nn">.client</span> <span class="kn">import</span> <span class="n">PipedClient</span>
<span class="kn">from</span> <span class="nn">.models.comments</span> <span class="kn">import</span> <span class="n">Comments</span> <span class="kn">from</span> <span class="nn">.models.comments</span> <span class="kn">import</span> <span class="n">Comments</span>
<span class="c1"># For pdoc:</span>
<span class="n">README_PATH</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="vm">__file__</span><span class="p">)</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">absolute</span><span class="p">()</span> <span class="o">/</span> <span class="n">Path</span><span class="p">(</span><span class="s1">&#39;README.md&#39;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">README_PATH</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">&quot;UTF-8&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">readme</span><span class="p">:</span>
<span class="n">__readme__</span> <span class="o">=</span> <span class="n">readme</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="k">except</span><span class="p">:</span>
<span class="n">__readme__</span> <span class="o">=</span> <span class="s2">&quot;Failed to read README.md!&quot;</span>
<span class="vm">__doc__</span> <span class="o">=</span> <span class="n">__readme__</span>
<span class="c1"># Supress unused-import warnings:</span> <span class="c1"># Supress unused-import warnings:</span>
<span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> <span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="n">_</span> <span class="o">=</span> <span class="p">[</span><span class="n">PipedClient</span><span class="p">,</span> <span class="n">Comments</span><span class="p">]</span> <span class="n">_</span> <span class="o">=</span> <span class="p">[</span><span class="n">PipedClient</span><span class="p">,</span> <span class="n">Comments</span><span class="p">]</span>

View file

@ -39,6 +39,12 @@
<li> <li>
<a class="function" href="#PipedClient.get_comments">get_comments</a> <a class="function" href="#PipedClient.get_comments">get_comments</a>
</li> </li>
<li>
<a class="function" href="#PipedClient.get_video">get_video</a>
</li>
<li>
<a class="function" href="#PipedClient.get_trending">get_trending</a>
</li>
</ul> </ul>
</li> </li>
@ -67,9 +73,10 @@
<span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">BasePipedModel</span> <span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">BasePipedModel</span>
<span class="kn">from</span> <span class="nn">.models.comments</span> <span class="kn">import</span> <span class="n">Comments</span> <span class="kn">from</span> <span class="nn">.models.comments</span> <span class="kn">import</span> <span class="n">Comments</span>
<span class="kn">from</span> <span class="nn">.models.videos</span> <span class="kn">import</span> <span class="n">Video</span>
<span class="n">_MDL</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s1">&#39;_MDL&#39;</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">BasePipedModel</span><span class="p">)</span> <span class="n">_MDL</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s1">&#39;_MDL&#39;</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">BasePipedModel</span><span class="p">])</span>
@ -125,6 +132,31 @@
<span class="k">else</span><span class="p">:</span> <span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Comments</span><span class="p">)</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Comments</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">get_video</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">video_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Video</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Gets information about a specific video.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `video_id` - The ID of the video to get information for</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Video</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">get_trending</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">country_code</span><span class="p">:</span> <span class="nb">str</span><span class="o">=</span><span class="s1">&#39;US&#39;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">]:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Obtains trending videos for a specific country. If there are no trending videos (or `country_code` is invalid),</span>
<span class="sd"> an empty list is returned.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `country_code` - The country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)) to get trending videos for. This is automatically capitalized by this package,</span>
<span class="sd"> since Piped for some reason doesn&#39;t accept lowercase country codes. Note: countries such as China or North Korea don&#39;t have trending videos, so they will always return an empty list.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">(</span><span class="n">trending_video</span><span class="p">)</span> <span class="k">for</span> <span class="n">trending_video</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/trending&quot;</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;region&#39;</span><span class="p">:</span> <span class="n">country_code</span><span class="o">.</span><span class="n">upper</span><span class="p">()})]</span>
</pre></div> </pre></div>
</details> </details>
@ -193,6 +225,31 @@
<span class="k">else</span><span class="p">:</span> <span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Comments</span><span class="p">)</span> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Comments</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">get_video</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">video_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Video</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Gets information about a specific video.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `video_id` - The ID of the video to get information for</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Video</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">get_trending</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">country_code</span><span class="p">:</span> <span class="nb">str</span><span class="o">=</span><span class="s1">&#39;US&#39;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">]:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Obtains trending videos for a specific country. If there are no trending videos (or `country_code` is invalid),</span>
<span class="sd"> an empty list is returned.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `country_code` - The country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)) to get trending videos for. This is automatically capitalized by this package,</span>
<span class="sd"> since Piped for some reason doesn&#39;t accept lowercase country codes. Note: countries such as China or North Korea don&#39;t have trending videos, so they will always return an empty list.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">(</span><span class="n">trending_video</span><span class="p">)</span> <span class="k">for</span> <span class="n">trending_video</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/trending&quot;</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;region&#39;</span><span class="p">:</span> <span class="n">country_code</span><span class="o">.</span><span class="n">upper</span><span class="p">()})]</span>
</pre></div> </pre></div>
</details> </details>
@ -283,6 +340,81 @@ There are often 20 comments per page.</li>
</div> </div>
</div>
<div id="PipedClient.get_video" class="classattr">
<div class="attr function"><a class="headerlink" href="#PipedClient.get_video">#&nbsp;&nbsp</a>
<span class="def">def</span>
<span class="name">get_video</span><span class="signature">(self, video_id: str) -&gt; <a href="models/videos.html#Video">piped_api.models.videos.Video</a></span>:
</div>
<details>
<summary>View Source</summary>
<div class="pdoc-code codehilite"><pre><span></span> <span class="k">def</span> <span class="nf">get_video</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">video_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Video</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Gets information about a specific video.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `video_id` - The ID of the video to get information for</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">Video</span><span class="p">)</span>
</pre></div>
</details>
<div class="docstring"><p>Gets information about a specific video.</p>
<h3 id="parameters">Parameters:</h3>
<ul>
<li><code>video_id</code> - The ID of the video to get information for</li>
</ul>
</div>
</div>
<div id="PipedClient.get_trending" class="classattr">
<div class="attr function"><a class="headerlink" href="#PipedClient.get_trending">#&nbsp;&nbsp</a>
<span class="def">def</span>
<span class="name">get_trending</span><span class="signature">(
self,
country_code: str = &#39;US&#39;
) -&gt; List[<a href="models/videos.html#Video.RelatedStream">piped_api.models.videos.Video.RelatedStream</a>]</span>:
</div>
<details>
<summary>View Source</summary>
<div class="pdoc-code codehilite"><pre><span></span> <span class="k">def</span> <span class="nf">get_trending</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">country_code</span><span class="p">:</span> <span class="nb">str</span><span class="o">=</span><span class="s1">&#39;US&#39;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">]:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Obtains trending videos for a specific country. If there are no trending videos (or `country_code` is invalid),</span>
<span class="sd"> an empty list is returned.</span>
<span class="sd"> ### Parameters:</span>
<span class="sd"> - `country_code` - The country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)) to get trending videos for. This is automatically capitalized by this package,</span>
<span class="sd"> since Piped for some reason doesn&#39;t accept lowercase country codes. Note: countries such as China or North Korea don&#39;t have trending videos, so they will always return an empty list.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">[</span><span class="n">Video</span><span class="o">.</span><span class="n">RelatedStream</span><span class="p">(</span><span class="n">trending_video</span><span class="p">)</span> <span class="k">for</span> <span class="n">trending_video</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_json</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;/trending&quot;</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;region&#39;</span><span class="p">:</span> <span class="n">country_code</span><span class="o">.</span><span class="n">upper</span><span class="p">()})]</span>
</pre></div>
</details>
<div class="docstring"><p>Obtains trending videos for a specific country. If there are no trending videos (or <code>country_code</code> is invalid),
an empty list is returned.</p>
<h3 id="parameters">Parameters:</h3>
<ul>
<li><code>country_code</code> - The country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO 3166-1 alpha-2</a>) to get trending videos for. This is automatically capitalized by this package,
since Piped for some reason doesn't accept lowercase country codes. Note: countries such as China or North Korea don't have trending videos, so they will always return an empty list.</li>
</ul>
</div>
</div> </div>
</section> </section>
</main> </main>

View file

@ -30,6 +30,7 @@
<h2>Submodules</h2> <h2>Submodules</h2>
<ul> <ul>
<li><a href="models/comments.html">piped_api.models.comments</a></li> <li><a href="models/comments.html">piped_api.models.comments</a></li>
<li><a href="models/videos.html">piped_api.models.videos</a></li>
</ul> </ul>
<h2>API Documentation</h2> <h2>API Documentation</h2>

View file

@ -48,6 +48,9 @@
<li> <li>
<a class="variable" href="#Comments.Comment.commented_time">commented_time</a> <a class="variable" href="#Comments.Comment.commented_time">commented_time</a>
</li> </li>
<li>
<a class="variable" href="#Comments.Comment.is_edited">is_edited</a>
</li>
<li> <li>
<a class="variable" href="#Comments.Comment.commentor_url">commentor_url</a> <a class="variable" href="#Comments.Comment.commentor_url">commentor_url</a>
</li> </li>
@ -140,10 +143,32 @@
<span class="nd">@property</span> <span class="nd">@property</span>
<span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span> <span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`)</span> <span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`).</span>
<span class="sd"> ### Note:</span>
<span class="sd"> The raw time from API also includes the `&#39;(edited)&#39;` suffix to mark comment as edited (if it was).</span>
<span class="sd"> By accessing this property, the suffix is automatically removed.</span>
<span class="sd"> If you for whatever reason want to keep the suffix, access this property directly via `Comment.data[&#39;commentedTime&#39;]`</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span> <span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">removesuffix</span><span class="p">(</span><span class="s1">&#39; (edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">is_edited</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Whether or not the comment is edited.</span>
<span class="sd"> ### Note:</span>
<span class="sd"> This property checks whether there is `&#39;(edited)&#39;` in the `commentedTime` property, because that&#39;s where you get that from.</span>
<span class="sd"> See `Comments.Comment.commented_time`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">&#39;(edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span> <span class="nd">@property</span>
@ -292,10 +317,32 @@
<span class="nd">@property</span> <span class="nd">@property</span>
<span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span> <span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`)</span> <span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`).</span>
<span class="sd"> ### Note:</span>
<span class="sd"> The raw time from API also includes the `&#39;(edited)&#39;` suffix to mark comment as edited (if it was).</span>
<span class="sd"> By accessing this property, the suffix is automatically removed.</span>
<span class="sd"> If you for whatever reason want to keep the suffix, access this property directly via `Comment.data[&#39;commentedTime&#39;]`</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span> <span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">removesuffix</span><span class="p">(</span><span class="s1">&#39; (edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">is_edited</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Whether or not the comment is edited.</span>
<span class="sd"> ### Note:</span>
<span class="sd"> This property checks whether there is `&#39;(edited)&#39;` in the `commentedTime` property, because that&#39;s where you get that from.</span>
<span class="sd"> See `Comments.Comment.commented_time`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">&#39;(edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span> <span class="nd">@property</span>
@ -507,10 +554,32 @@
<span class="nd">@property</span> <span class="nd">@property</span>
<span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span> <span class="k">def</span> <span class="nf">commented_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`)</span> <span class="sd"> The time the comment was made (format: `&#39;x y ago&#39;`).</span>
<span class="sd"> ### Note:</span>
<span class="sd"> The raw time from API also includes the `&#39;(edited)&#39;` suffix to mark comment as edited (if it was).</span>
<span class="sd"> By accessing this property, the suffix is automatically removed.</span>
<span class="sd"> If you for whatever reason want to keep the suffix, access this property directly via `Comment.data[&#39;commentedTime&#39;]`</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span> <span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">removesuffix</span><span class="p">(</span><span class="s1">&#39; (edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">is_edited</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Whether or not the comment is edited.</span>
<span class="sd"> ### Note:</span>
<span class="sd"> This property checks whether there is `&#39;(edited)&#39;` in the `commentedTime` property, because that&#39;s where you get that from.</span>
<span class="sd"> See `Comments.Comment.commented_time`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">time</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="s1">&#39;commentedTime&#39;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">time</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s1">&#39;(edited)&#39;</span><span class="p">)</span>
<span class="nd">@property</span> <span class="nd">@property</span>
@ -627,7 +696,30 @@
</div> </div>
<div class="docstring"><p>The time the comment was made (format: <code>'x y ago'</code>)</p> <div class="docstring"><p>The time the comment was made (format: <code>'x y ago'</code>).</p>
<h3 id="note">Note:</h3>
<p>The raw time from API also includes the <code>'(edited)'</code> suffix to mark comment as edited (if it was).
By accessing this property, the suffix is automatically removed.
If you for whatever reason want to keep the suffix, access this property directly via <code>Comment.data['commentedTime']</code></p>
</div>
</div>
<div id="Comments.Comment.is_edited" class="classattr">
<div class="attr variable"><a class="headerlink" href="#Comments.Comment.is_edited">#&nbsp;&nbsp</a>
<span class="name">is_edited</span><span class="annotation">: bool</span>
</div>
<div class="docstring"><p>Whether or not the comment is edited.</p>
<h3 id="note">Note:</h3>
<p>This property checks whether there is <code>'(edited)'</code> in the <code>commentedTime</code> property, because that's where you get that from.
See <code><a href="#Comments.Comment.commented_time">Comments.Comment.commented_time</a></code></p>
</div> </div>

2739
piped_api/models/videos.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long