aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--watch.cmd18
1 files changed, 18 insertions, 0 deletions
diff --git a/watch.cmd b/watch.cmd
new file mode 100644
index 0000000..1c7ea1b
--- /dev/null
+++ b/watch.cmd
@@ -0,0 +1,18 @@
+@echo off
+set url=%*
+set url=%url:watch:=%
+
+youtube-dl -j %url% > %TEMP%\youtubejson
+
+type %TEMP%\youtubejson ^
+ | jq ".formats[] | select(.ext == """mp4""") | {width, url}"^
+ | jq -sr "sort_by(.width) | .[-1].url"^
+ > %TEMP%\youtubevideo
+
+type %TEMP%\youtubejson^
+ | jq ".formats[] | select(.ext == """m4a""") | {url}" | jq -sr ".[-1].url"^
+ > %TEMP%\youtubeaudio
+
+for /f %%v in (%TEMP%\youtubevideo) ^
+do for /f %%a in (%TEMP%\youtubeaudio) ^
+do start "" "%ProgramFiles%\MPC-HC\mpc-hc" "%%v" /dub "%%a" \ No newline at end of file