Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac-Flath committed Aug 21, 2024
1 parent f868e16 commit 4d9cb76
Show file tree
Hide file tree
Showing 11 changed files with 1,829 additions and 902 deletions.
5 changes: 3 additions & 2 deletions TIL/DelayedRedirect.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ I did to redirect people to the new location of the FastHTML gallery site.
```python
from fasthtml.common import *

new_url = "https://gallery.fastht.ml/"
def _not_found(req, exc):
msg = Div(H1("We moved to ",A(href="https://gallery.fastht.ml/")("https://gallery.fastht.ml/")),
msg = Div(H1("We moved to ",A(href=new_url)(new_url))
P("Please update your bookmark! Redirecting in 3 seconds..."))
return msg,Meta(http_equiv="refresh", content="3;url=https://gallery.fastht.ml/")
return msg,Meta(http_equiv="refresh", content=f"3;url={new_url}")

app = FastHTML(exception_handlers={404:_not_found})

Expand Down
17 changes: 17 additions & 0 deletions TIL/YoutubeTerminalDownload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Download Youtube Videos with yt-dlp"
author: "Isaac Flath"
date: "2024-8-21"
description: "Download youtube videos with yt-dlp in the terminal"
categories: [terminal]
---

# Today I Learned

There's a magic terminal ccommand that can download youtube videos thanks to [Hamel's twitter post](https://x.com/HamelHusain/status/1825751477060522435)

[This](https://github.com/yt-dlp/yt-dlp) is the library it uses, which seems like it can do lots of stuff that may be useful some day.

```bash
yt-dlp -v -f mp4 --cookies-from-browser chrome "<url>"
```
17 changes: 9 additions & 8 deletions docs/TIL/DelayedRedirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,15 @@ <h1>Today I Learned</h1>
<p>I did to redirect people to the new location of the FastHTML gallery site.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> fasthtml.common <span class="im">import</span> <span class="op">*</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> _not_found(req, exc):</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> msg <span class="op">=</span> Div(H1(<span class="st">"We moved to "</span>,A(href<span class="op">=</span><span class="st">"https://gallery.fastht.ml/"</span>)(<span class="st">"https://gallery.fastht.ml/"</span>)),</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> P(<span class="st">"Please update your bookmark! Redirecting in 3 seconds..."</span>))</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> msg,Meta(http_equiv<span class="op">=</span><span class="st">"refresh"</span>, content<span class="op">=</span><span class="st">"3;url=https://gallery.fastht.ml/"</span>)</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>app <span class="op">=</span> FastHTML(exception_handlers<span class="op">=</span>{<span class="dv">404</span>:_not_found})</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a>serve()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>new_url <span class="op">=</span> <span class="st">"https://gallery.fastht.ml/"</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="kw">def</span> _not_found(req, exc):</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> msg <span class="op">=</span> Div(H1(<span class="st">"We moved to "</span>,A(href<span class="op">=</span>new_url)(new_url))</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> P(<span class="st">"Please update your bookmark! Redirecting in 3 seconds..."</span>))</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> msg,Meta(http_equiv<span class="op">=</span><span class="st">"refresh"</span>, content<span class="op">=</span><span class="ss">f"3;url=</span><span class="sc">{</span>new_url<span class="sc">}</span><span class="ss">"</span>)</span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>app <span class="op">=</span> FastHTML(exception_handlers<span class="op">=</span>{<span class="dv">404</span>:_not_found})</span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a>serve()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>


</section>
Expand Down
Loading

0 comments on commit 4d9cb76

Please sign in to comment.