about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-01-17 02:11:06 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-01-17 02:11:06 +0900
commit98a6d91c1cc1af10893a655d4b11b24635672726 (patch)
treec44d521ea4aae520308670cf2c3e493e77b4baa8
parent5a4b75b528d6f8fa6165fb8fad735419ee4c9672 (diff)
downloadsite-98a6d91c1cc1af10893a655d4b11b24635672726.tar.gz
Publish YouTube usage guide
-rw-r--r--_assets/liferea-youtube.pngbin0 -> 93644 bytes
-rw-r--r--blog/threa.md2
-rw-r--r--blog/youtu.md225
-rw-r--r--config.md2
4 files changed, 227 insertions, 2 deletions
diff --git a/_assets/liferea-youtube.png b/_assets/liferea-youtube.png
new file mode 100644
index 0000000..220e199
--- /dev/null
+++ b/_assets/liferea-youtube.png
Binary files differdiff --git a/blog/threa.md b/blog/threa.md
index ce773ef..38b1e8c 100644
--- a/blog/threa.md
+++ b/blog/threa.md
@@ -1,7 +1,7 @@
 +++
 rss = "Raku's concision demonstrated in form of a tutorial"
 date = Date(2021, 7, 3)
-tags = ["fun", "recipe"]
+tags = ["fun", "recipe", "clipboard"]
 +++
 
 # Writing a Clipboard Manager
diff --git a/blog/youtu.md b/blog/youtu.md
new file mode 100644
index 0000000..13245bb
--- /dev/null
+++ b/blog/youtu.md
@@ -0,0 +1,225 @@
++++
+rss = "Do you know de wey?  Lemme show you de wey!"
+date = Date(2024, 1, 17)
+tags = ["fun", "recipe", "net", "nix", "clipboard"]
++++
+
+# Best Ways to Watch YouTube Videos
+
+In today's episode of [guides nobody asked for and likely having
+been covered by someone more qualified][idgaf], lemme show you
+the **correct** ways to view videos hosted on YouTube and other
+hostile, tracker-riddled hellscapes.  Whilst I despise Google's
+mass surveillance practices, it stores a large proportion
+of culturally significant videos and clips that would be difficult
+to mirror to user-respecting services due to copyright.  Hell, even YouTube
+doesn't have the right to distribute many of them in the first place.
+
+Because of YouTube's circumvention of advertisement blockers,
+the ad-blocking arm race finally caught mainstream media attention
+and tis kool to talk about that now.  Hence I'm happy to jump
+on the bandwagon, albeit a wee bit late, but this ain't just that.
+I feed you poison—over 4% of the pages linked from my site
+are on YouTube—so the least I can do is sell you my cures.
+
+## Using a Real Media Player
+
+The most popular solutions are either to use for a good blocker
+on a browser with (supposedly) long-term support for [Manifest V2]
+like [uBlock Origin] on Firefox, or use alternative front-ends
+such as [Invidious] or [Piped].  Although uBlock Origin is essential
+for a pleasant experience on the modern interwebs and alternative frontends
+offers the best UX for browsing videos, in-browser and service-specific
+media players are inferior anyway when compared to programs properly designed
+for a decent playback experience.
+
+My favorite has been [mpv] for as long as I can remember,
+as it makes it easy to adjust video brightness/contrast/etc.,
+playback speed, subtitle size and placements, and to overamplify
+quiet audios.  Out of the box, it integrates with [yt-dlp],
+a time shifter with support for [most online media services][supported].
+Just drop the URL into an mpv window and [boom], it werks!
+
+Either [drag-and-drop] or invoking `mpv $url` is quite convenient,
+but not that close to following an anchor, is it?  You'd need
+to first open mpv or a program launcher (or a terminal emulator),
+then drag the URL there, or perhaps copy and paste it for the latter cases.
+What if you [gotta go fast], aye?  As a [hedgehog-maxxer] meself,
+of course I can do better, and here's how.
+
+## With a Browser Add-on
+
+While drafting this article, I noticed that the _ff2mpv_ extension I was using
+had technically been [non-free][pacifist] for a while.  Although I understand
+and respect the author's noble intention against violence, I believe
+discrimination never ends up helping those oppressed due to the power imbalance
+for the exclusion false-positives to be worth it.
+
+For this reason, I switched to [Open in mpv] and recommend it instead.
+The usage is practically the same: open context menu at the video URL
+and select **Open this link in mpv**.  The internal mechanism
+is a bit different though, and because it influences the installation process,
+I will try to briefly explain [how it works].
+
+The way _Open in mpv_ works is a bit convoluted.  First, it wraps
+the specified URL in a `mpv` scheme.  The new URL starts with `mpv://`
+is then passed back to Firefox, which must have been configured to open it
+in the native program `open-in-mpv`.  This program parses the URL
+into the equivalent mpv command and execute it.  If you are not on NixOS,
+see the [extension's README] to set it up yourself.
+
+Otherwise, it can be declared in [configuration.nix(5)] as follows.
+The declarations should be self-explanatory after referencing
+Firefox's documentation for [policies.json].  If you have trouble finding
+an extension's ID and download URL, search for it in [Mozzarella].
+
+```nix
+{ pkgs, ... }:
+{
+  programs.firefox = {
+    enable = true;
+    policies = {
+      ExtensionSettings."{d66c8515-1e0d-408f-82ee-2682f2362726}" = {
+        default_area = "menupanel";
+        installation_mode = "normal_installed";
+        install_url =
+          "https://addons.mozilla.org/firefox"
+          + "/downloads/latest/iina-open-in-mpv/latest.xpi";
+      };
+      Handlers.scheme.mpv = {
+        action = "useHelperApp";
+        ask = false;
+        handlers = [ {
+          name = "open-in-mpv";
+          path = "${pkgs.open-in-mpv}/bin/open-in-mpv";
+        } ];
+      };
+    };
+  };
+}
+```
+
+Even though Mozzarella is supposed to only show libre add-ons, be aware
+that the metadata it crawls from addons.mozzila.org might not always
+be [correct][ff2mpv].  Ideally, browser extensions should be packaged
+in the distribution's repository, but packaging discipline is not exactly
+NixOS's strong suit.  I will probably post an update on how to declare
+policies.json in Guix once I figure that out.
+
+## From a Feed Reader
+
+Now we can properly watch videos while browsing the web,
+but subscribing to YouTube channels on its web interface
+would require creating an account and subjecting one's self
+to more surveillance.  Fortunately, at the time of writing,
+YouTube still provide Atom [feeds] for syndication.
+Funny enough, they are advertised on the channel pages as RSS:
+
+```html
+<link rel="alternate" type="application/rss+xml" title="RSS"
+      href="https://www.youtube.com/feeds/videos.xml?channel_id=…">
+```
+
+The referenced feed employ [Media RSS] to communicate the video URL.
+This extension is widely supported by feed readers, as well
+as the previously mentioned feed-discovery mechanism.  I use [Liferea],
+which allows me to directly paste the YouTube channel's URL
+(`https://www.youtube.com/@…`) and displays each video's description,
+thumbnail and enclosed media, e.g.
+
+![Liferea in action](/assets/liferea-youtube.md)
+
+For each MIME type to, enclosures can be configured to be opened
+by a user-preferred program.  In this case, I set `mpv --ytdl-format=b`
+for `application/x-shockwave-flash` (a reminiscence of a time
+when browsers needed [Flash] to play to play videos and animations)
+for the _second_ best quality to save some bandwidth.  YouTube encodes
+the highest resolution video separate from the audio, so the best combined
+format `b` is one level lower than yt-dlp's default best video
+and best audio together.
+
+## Via Clipboard Integration
+
+People also share videos with me via instant messaging.
+I find it cumbersome to open the URL in the browser then redirect it
+to the media player, so the clipboard is used as the bridge instead.
+To do this, I simply create a key binding to the command below.
+On [Wayland], replace `xclip` with something equivalent.
+
+```sh
+mpv --ytdl-format=b "$(xclip -out -selection clipboard)"
+```
+
+## Musing
+
+There, I shared how I do it so [you can too]!  If they seem
+needlessly complex, you share my disappointment on the UX evolution
+of the mainstream web.  I dream of a more semantic web, not necessarily
+web 3.0, but perhaps just a more explicitly typed web, where e.g.
+a YouTube URL for embedding would be a `video/webm` instead of a `text/html`.
+
+If `mailto` URIs can open our email client, and social media pages
+can bug us to open the post in their own app, why can't we have
+interoperable media handling?  Maybe we should, but I'm not sure we can.
+[Greed] stands in our way.  Providers force us to use their proprietary
+[malware] to consume their service.  [DRM] has become the foundation
+of media distribution.  Grassroots movements like [Framasoft] might never
+reach mainstream status.
+
+I don't mean to tell you to give up however, just to direct your energy
+to where it matters.  Spend less on developing [alternative front-ends]
+than on ethical replacements, bridges and inviting people over.
+We need more [videos], more [music], more [podcasts], more [knowledge]
+better [instant][xmpp] [messaging][matrix], better [search engines],
+better [translations], better [home] [automation][platypush], and whatnot.
+Against all odds, maybe things will finally start to improve
+even for those outside of our bubble.  [Perchance.]
+
+[idgaf]: https://www.alexmolas.com/2023/07/15/nobody-cares-about-your-blog.html
+[Manifest V2]: https://github.com/uBlockOrigin/uBlock-issues/issues/338#issuecomment-1332300191
+[uBlock Origin]: https://ublockorigin.com
+[Invidious]: https://invidious.io
+[Piped]: https://github.com/TeamPiped/Piped
+[mpv]: https://mpv.io
+[yt-dlp]: https://github.com/yt-dlp/yt-dlp
+[supported]: https://github.com/yt-dlp/yt-dlp/raw/master/supportedsites.md
+[boom]: https://www.youtube.com/watch?v=_FNzL5nW_u4
+[drag-and-drop]: https://uno.starshard.studio/notes/9nmgldtdgghu8m2n
+[gotta go fast]: https://ziglang.org/perf
+[hedgehog-maxxer]: https://video.hardlimit.com/c/morbiwars
+
+[pacifist]: https://github.com/woodruffw/ff2mpv/commit/2397193b36e6.patch
+[Open in mpv]: https://addons.mozilla.org/en-US/firefox/addon/iina-open-in-mpv
+[how it works]: https://www.youtube.com/watch?v=1Fl2sMV7Hcc
+[extension's README]: https://github.com/Baldomo/open-in-mpv/raw/master/README.md
+[configuration.nix(5)]: https://nixos.org/manual/nixos/stable/options#opt-programs.firefox.policies
+[policies.json]: https://mozilla.github.io/policy-templates
+[Mozzarella]: https://gnuzilla.gnu.org/mozzarella
+[ff2mpv]: https://issues.guix.gnu.org/68361
+
+[feeds]: https://en.wikipedia.org/wiki/Web_feed
+[Media RSS]: https://www.rssboard.org/media-rss
+[Liferea]: https://lzone.de/liferea
+[MIME]: https://en.wikipedia.org/wiki/MIME
+[Flash]: https://ruffle.rs
+
+[Wayland]: https://wayland.social/@compositor/110768798303454842
+
+[sandboxing]: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/design/sandbox.md
+[you can too]: /blog/youtu
+[Greed]: https://www.searchenginejournal.com/youtube-is-showing-ads-on-non-monetized-channels/388674
+[malware]: https://pluralistic.net/2023/01/21/potemkin-ai
+[DRM]: https://www.defectivebydesign.org
+[Framasoft]: https://framasoft.org
+[alternative front-ends]: https://sr.ht/~benbusby/farside
+[videos]: https://sepiasearch.org
+[music]: https://www.funkwhale.audio
+[podcasts]: https://castopod.org
+[knowledge]: https://en.wikipedia.org/wiki/Open_access
+[xmpp]: https://xmpp.org
+[matrix]: https://matrix.org
+[search engines]: https://seirdy.one/posts/2021/03/10/search-engines-with-own-indexes
+[translations]: https://browser.mt
+[home]: https://www.home-assistant.io
+[platypush]: https://platypush.tech
+[Perchance.]: https://fe.disroot.org/@mcsinyx/posts/ALaW77HgCSPq4pLxpo
diff --git a/config.md b/config.md
index 78c633b..3b57a33 100644
--- a/config.md
+++ b/config.md
@@ -2,7 +2,7 @@
 author = "Nguyễn Gia Phong"
 website_title = "Web logs of McSinyx"
 website_description = "Random write-ups packed with pop culture references"
-copyright = "🄯 2019–2023 " * author
+copyright = "🄯 2019–2024 " * author
 website_url = "https://cnx.gdn"
 date_format = "yyyy-mm-dd"
 mintoclevel = 2