Last active
January 6, 2026 09:12
-
-
Save shaoyanji/dbe38777514b96d50f81da4bc4ac2992 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export def ytsearch [] { | |
| http get https://www.youtube.com/results?search_query=(input "search> " | url encode) | |
| | split row "var ytInitialData =" | |
| | last | |
| | split row ";</script>" | |
| | first | |
| | from json | |
| | get -o contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents.0.itemSectionRenderer.contents.videoRenderer | |
| | uniq | sort | drop | |
| | select title.runs.text.0 videoId | |
| | flatten | |
| | input list -f -d "title.runs.text.0" | |
| | get videoId | |
| | $"https://www.youtube.com/watch?v=($in)" | |
| | mpv --ytdl-format="bv+ba" $"($in)" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment