Hotkeys copy url in Firefox and Chrome ( or copy url with ctrl+c or use script from atnbueno for other browsers )
Finds out the URL of the current (active) browser tab for most of the modern browsers.
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3702
F4= VIDEO needs youtube-dl.exe https://youtube-dl.org/latest/youtube-dl.exe
F5= AUDIO MP3 192k needs also ffmpeg.exe https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.zip
Code: Select all
/*
MODIFIED =20200607 ^l copies url in firefox and chrome
MODIFIED =20190521
F4= video needs youtube-dl.exe https://youtube-dl.org/latest/youtube-dl.exe
F5= audio MP3 192k needs also ffmpeg.exe https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.zip
https://youtube-dl.org/
ffmpeg for AUDIO :
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.zip
https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip
https://ffmpeg.zeranoe.com/builds/win32/static/
http://ffmpeg.org/download.html#build-windows
*/
#warn
#persistent
#singleinstance,force
;#IfWinActive YouTube
setworkingdir,%a_scriptdir%
settitlematchmode,2
clipboard=
mp3x=0
youtubedl:=a_scriptdir . "\youtube-dl.exe"
ifexist,%youtubedl%
{
loop,%youtubedl%
SP1:=A_loopFileShortPath
;RunWait, %comspec% /k %sp1% -U ;- Update youtube-dl.exe
;------------------------------
;fhelp=%a_scriptdir%\%a_now%_youtube-dl_Help.txt
;runwait,%comspec% /k %sp1% --help >"%fhelp%" ;- see help file
;url9=https://www.youtube.com/watch?v=aqz-KE-bpKQ ;- for test big bucks bunny
;runwait,%comspec% /k %sp1% %url9% -F
;runwait,%comspec% /k %sp1% %url9% --get-format ;- 315 webm best
;runwait,%comspec% /k %sp1% %url9% --format 315 ;- this 10* bigger then FHD fmt=22
;runwait,%comspec% /k %sp1% %url9% --youtube-skip-dash-manifest ;- if no format defined makes fmt=22
;runWait,%comspec% /k %sp1% %url9% --verbose --youtube-skip-dash-manifest --write-auto-sub --sub-lang de -o "%fdmp4%\`%(title)s$`%(uploader)s$`%(id)s.`%(ext)s"
;--format FORMAT Video format code
;--all-formats Download all available video formats
}
else
run,https://youtube-dl.org/latest/youtube-dl.exe
return
;--------------
esc::exitapp
;--------------
;------- VIDEO -------
$f4::
if (winactive("YouTube"))
{
mp3x=0
send,^l
sleep,500
send,^c
}
return
;----------------------
;----- AUDIO MP3 192k ---------
$f5::
if (winactive("YouTube"))
{
mp3x=1
send,^l
sleep,500
send,^c
}
return
;---------------------
OnClipboardChange:
{
id:=""
L:=""
If (A_EventInfo=1)
{
if (winactive("YouTube"))
{
if (instr(clipboard, "https://www.youtube.com"))
{
Loop,parse,clipboard, `n, `r
{
x= %a_loopfield%
if x=
continue
Loop, Parse,x,`/`=`&`?%a_space%`#`:
{
id:= A_LoopField
stringlen,L,id
if (L=11)
break
}
}
}
}
if (L=11)
goto,download
else
return
}
}
return
;--------------
Download:
if (ID<>"")
{
clipboard=
url=https://www.youtube.com/watch?v=%id%
ifexist,%youtubedl%
{
if (mp3x=0)
RunWait, %comspec% /k %sp1% %url%
else
RunWait, %comspec% /k %sp1% %url% -x --audio-format mp3 --audio-quality 192k ;- needs ffmpeg.exe
}
url=
id=
}
return
;==========================================