Deploying to documentation from @ CWKevo/python-piped-api-client@56d70e7230 🚀
This commit is contained in:
parent
f4b6261315
commit
c54e640d6c
6 changed files with 2990 additions and 11 deletions
|
@ -42,18 +42,33 @@
|
|||
<h1 class="modulename">
|
||||
piped_api </h1>
|
||||
|
||||
<div class="docstring"><p>Failed to read README.md!</p>
|
||||
</div>
|
||||
|
||||
<details>
|
||||
<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>
|
||||
|
||||
<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">.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">'README.md'</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">'r'</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">"UTF-8"</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">"Failed to read README.md!"</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="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>
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
<li>
|
||||
<a class="function" href="#PipedClient.get_comments">get_comments</a>
|
||||
</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>
|
||||
|
||||
</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.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">'_MDL'</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">'_MDL'</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">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">"/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">"</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">-></span> <span class="n">Video</span><span class="p">:</span>
|
||||
<span class="sd">"""</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"> """</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">"/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">"</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">'US'</span><span class="p">)</span> <span class="o">-></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">"""</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'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.</span>
|
||||
<span class="sd"> """</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">"/trending"</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">'region'</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>
|
||||
|
@ -193,6 +225,31 @@
|
|||
|
||||
<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">"/comments/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">"</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">-></span> <span class="n">Video</span><span class="p">:</span>
|
||||
<span class="sd">"""</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"> """</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">"/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">"</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">'US'</span><span class="p">)</span> <span class="o">-></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">"""</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'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.</span>
|
||||
<span class="sd"> """</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">"/trending"</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">'region'</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>
|
||||
|
@ -283,6 +340,81 @@ There are often 20 comments per page.</li>
|
|||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="PipedClient.get_video" class="classattr">
|
||||
<div class="attr function"><a class="headerlink" href="#PipedClient.get_video">#  </a>
|
||||
|
||||
|
||||
<span class="def">def</span>
|
||||
<span class="name">get_video</span><span class="signature">(self, video_id: str) -> <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">-></span> <span class="n">Video</span><span class="p">:</span>
|
||||
<span class="sd">"""</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"> """</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">"/streams/</span><span class="si">{</span><span class="n">video_id</span><span class="si">}</span><span class="s2">"</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">#  </a>
|
||||
|
||||
|
||||
<span class="def">def</span>
|
||||
<span class="name">get_trending</span><span class="signature">(
|
||||
self,
|
||||
country_code: str = 'US'
|
||||
) -> 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">'US'</span><span class="p">)</span> <span class="o">-></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">"""</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'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.</span>
|
||||
<span class="sd"> """</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">"/trending"</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">'region'</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>
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<h2>Submodules</h2>
|
||||
<ul>
|
||||
<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>
|
||||
|
||||
<h2>API Documentation</h2>
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
<li>
|
||||
<a class="variable" href="#Comments.Comment.commented_time">commented_time</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="variable" href="#Comments.Comment.is_edited">is_edited</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="variable" href="#Comments.Comment.commentor_url">commentor_url</a>
|
||||
</li>
|
||||
|
@ -140,10 +143,32 @@
|
|||
<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">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`)</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`).</span>
|
||||
|
||||
<span class="sd"> ### Note:</span>
|
||||
<span class="sd"> The raw time from API also includes the `'(edited)'` 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['commentedTime']`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'commentedTime'</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">' (edited)'</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">-></span> <span class="nb">bool</span><span class="p">:</span>
|
||||
<span class="sd">"""</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 `'(edited)'` in the `commentedTime` property, because that's where you get that from.</span>
|
||||
<span class="sd"> See `Comments.Comment.commented_time`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'(edited)'</span><span class="p">)</span>
|
||||
|
||||
|
||||
<span class="nd">@property</span>
|
||||
|
@ -292,10 +317,32 @@
|
|||
<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">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`)</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`).</span>
|
||||
|
||||
<span class="sd"> ### Note:</span>
|
||||
<span class="sd"> The raw time from API also includes the `'(edited)'` 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['commentedTime']`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'commentedTime'</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">' (edited)'</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">-></span> <span class="nb">bool</span><span class="p">:</span>
|
||||
<span class="sd">"""</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 `'(edited)'` in the `commentedTime` property, because that's where you get that from.</span>
|
||||
<span class="sd"> See `Comments.Comment.commented_time`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'(edited)'</span><span class="p">)</span>
|
||||
|
||||
|
||||
<span class="nd">@property</span>
|
||||
|
@ -507,10 +554,32 @@
|
|||
<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">-></span> <span class="nb">str</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`)</span>
|
||||
<span class="sd"> The time the comment was made (format: `'x y ago'`).</span>
|
||||
|
||||
<span class="sd"> ### Note:</span>
|
||||
<span class="sd"> The raw time from API also includes the `'(edited)'` 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['commentedTime']`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'commentedTime'</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">' (edited)'</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">-></span> <span class="nb">bool</span><span class="p">:</span>
|
||||
<span class="sd">"""</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 `'(edited)'` in the `commentedTime` property, because that's where you get that from.</span>
|
||||
<span class="sd"> See `Comments.Comment.commented_time`</span>
|
||||
<span class="sd"> """</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">'commentedTime'</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">'(edited)'</span><span class="p">)</span>
|
||||
|
||||
|
||||
<span class="nd">@property</span>
|
||||
|
@ -627,7 +696,30 @@
|
|||
</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">#  </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>
|
||||
|
||||
|
||||
|
|
2739
piped_api/models/videos.html
Normal file
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
Loading…
Reference in a new issue