Last active
July 11, 2022 03:41
-
-
Save dreness/c14e03cb7e1b0e35f2f946404d3574f2 to your computer and use it in GitHub Desktop.
One-liner to open the most recent video in your YouTube watch history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is for macOS, and requires that you have yt-dlp and Chrome installed. | |
# yt-dlp gains easy access to your youtube profile by borrowing cookies from | |
# Chrome, so you'll need to have logged into youtube with Chrome. The yt-dlp | |
# command will return the URL to the video at the top of your history, which | |
# can then be opened using your tool of choice - in this case, I pass it to | |
# 'open' to use the default browser. | |
# I use this primarily when I am (or was) watching a YT video on my | |
# Internet telephone, but then I want to pick it up on the mac. | |
# This technique is faster for me than anything done from the phone, even if | |
# I'm actively using the phone at the time. | |
# Pro tip: Try to gracefully stop playback on Youtube, otherwise your play | |
# position bookmark might be a bit behind. | |
open $(yt-dlp --cookies-from-browser chrome --playlist-items 1 \ | |
--flat-playlist --get-url https://youtube.com/feed/history) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment