MODIFIED=20120126
script works with AHK_BASIC
to use with AHK_L , replace the last part HttpQueryInfo
Quote:
;================ Function httpquery for AHK_L ===============================
;--
http://www.autohotkey.com/forum/post-429148.html#429148
TestScript, get the highest quality
Code:
;-------- http://www.autohotkey.com/forum/topic34932.html ---
MODIFIED=20120126
;-- note: all special characters are removed in title
;----------------------------------------------------
#singleinstance force
;---- replace this URL ----
URL1=http://www.youtube.com/watch?v=12345678901
if (url1="http://www.youtube.com/watch?v=12345678901")
{
msgbox, 262208,Failure,Not valid URL
return
}
F11 =%A_scriptdir%\mytest.txt
AA=
urldownloadtofile,%url1%,%f11%
Fileread,AA,%F11%
xx4 =<meta name="title" content=
title=
hss=
;-----------------------------------------------
Loop,parse,aa,`n,`r
{
LR=%A_loopfield%
if LR contains %xx4%
{
stringmid,title,LR,29,110
stringreplace,title,title,`",,all
stringreplace,title,title,`',,all
stringreplace,title,title,`;,,all
stringreplace,title,title,`>,,all
stringreplace,title,title,`),,all
stringreplace,title,title,`(,,all
stringreplace,title,title,`:,,all
title := RegExReplace(title, "\W", " ")
stringreplace,title,title,quot,,all
stringreplace,title,title,amp,,all
title=%title%
if title=
title=%A_now%
}
;------------ url -------------------------------------
;CONTEN =<embed type="application/x-shockwave-flash"
conten=var swf
searchfor=url_encoded_fmt_stream_map
ifinstring,LR,%CONTEN% ;
{
Loop, Parse,LR ,`; ,
{
if A_LoopField contains %searchfor%
{
HSS=%A_LoopField%
break
}
}
}
}
AA=
;===================================================================
stringreplace,hss,hss,http,|http,all
;------------------------------------
stringreplace,hss,hss,`%253A,`:,all
stringreplace,hss,hss,`%252F,`/,all
stringreplace,hss,hss,`%26,`&,all
;-- G2--G10 -----------------------
loop,parse,hss,`|
G%A_Index% := A_LoopField
;-- G2 is the highest quality
StringSplit,G2,G2,&
stringreplace,G21,G21,2525,,all
stringreplace,G21,G21,`%253D,`=,all
stringreplace,G21,G21,`%2526,`&,all
stringreplace,G21,G21,`%253F,`?,all
;msgbox,G21=%g21%
;exitapp
hss=
Splashimage,,b w600 h90 CWteal m9 b fs10 zh0,DOWNLOAD Youtube Video`nNAME=%title%`nVideo plays after Download`nESC=exit
urldownloadtofile,%g21%,%title%.mp4
Splashimage,off
ifexist,%title%.mp4
run,%title%.mp4
exitapp
esc::exitapp
;============================ END TEST SCRIPT =======================================
MODIFIED=20110804
-select quality/size
-Listview with logfile to start user or video later
-convert videos to audio MP3
-convert videos to mobilphone

Code:
MODIFIED=20120126
;-- http://www.autohotkey.com/forum/topic34932.html
;-- http://www.autohotkey.net/~garry/Youtube_ShanghaiByNight_20110801.png
/*
How to use:
------------
Copy URL, script shows max 9 possibilities (quality)
click download button [DNL1-9]
when download started GUI will minimize in a few seconds, see process in tray [0-100]
=============================================================================
[Clear ] = ready for next download
[Folder ] = click to see downloaded file in c:\_A_INPUT
[MP4>MP3 ] = convert video to audio c:\_A_OUTPUT
[MP4>Nokia] = convert to 320*240 c:\_A_OUTPUT
[YT-USER ] = open url from user
[LogFile ] = show log , click column to start user or video in youtube again
==============================================================================
*/
#NoEnv
SetBatchlines -1
SendMode Input
Settitlematchmode, 2
setworkingdir, %a_scriptdir%
Filetitle=YTB_DNL
F41=%A_scriptdir%\youtubelog.txt
clipboard=
transform,S,chr,32 ;-- SPACE
transform,P,chr,37 ;-- procent
transform,E,chr,96 ;-- escapeChar
FFMPEGXX=%A_scriptdir%\ffmpeg.exe
;--- maybe remove this if don't want convert videos to MP3 ---
ifnotexist,%ffmpegxx%
gosub,dnlffmpeg
;-------------------------------------------------------------
FileInstall,ffmpeg.exe,ffmpeg.exe,1 ;--- if you compile to xy.exe ffmpeg.exe woul'd be also in scriptdir
;================= FOR TEST ===========================
;--FMT ( *- recommended )
;-- (FMT=22 maximal recommended to use with Atom CPU )
;--------- FLV -------------------------
;-- 5 400* 240 240
;--34 640* 360 360
;--35 854* 480 480 *
;--------- MP4 -------------------------
;--18 640* 360 360
;--22 1280* 720 720 *
;--37 1920*1080 1080 *
;--38 4096*3072
;--------- WebM --------------------------
;--43 640* 360
;--44 854* 480
;--45 1280* 720
;------- 3GP ----------------------------
;--17 176* 144
;=======================================================
;----------------------------------------------
F31=http://www.youtube.com/watch?v=XSGBVzeBUbk ;big buck bunny
; 37 265 MB MP4
; 22 * 156 MB MP4
; 18 39 MB MP4
; 35 * 81 MB flv
; 34 44 MB flv
; 5 23 MB flv
; 45 442 MB WebM
; 44 85 MB WebM
; 43 138 MB WebM
;----------------------------------------------
;F31=http://www.youtube.com/watch?v=lH8Xcqvs3JM ;fmt=35( 480) China tango
;F31=http://www.youtube.com/watch?v=siJLeHAnZIk ;fmt=37(1080) 22(720) China 1080HD
;F31=http://www.youtube.com/watch?v=d_MfQ1nBHEg ;chang Loo seven lonely days
;F31=http://www.youtube.com/watch?v=ZIfpCLrjXVU ;grace chang ka li su hole
;F31=http://www.youtube.com/watch?v=og1kzX0y2xw ;Yao lee (no more exist)
;F31=http://www.youtube.com/watch?v=bpi8Bek6jdM ;he'll have to go Jim Reeves
;F31=http://www.youtube.com/watch?v=nkbuUvZblQQ ;Fragancia Sven Bertil Taube
;F31=http://www.youtube.com/watch?v=nECoA-uVGfw ;Jim reeves I love you because
;F31=http://www.youtube.com/watch?v=AVDxCPffoPU ;-- sa kabukiran 69541 kB
;F31=http://www.youtube.com/watch?v=qlEnmt8Vntg ;-- poon sow keng 3221 kB
;F31=http://www.youtube.com/watch?v=MCPYNcijVkE ;YeLaiXiang
;F31=http://www.youtube.com/watch?v=iCKMzrPy4t4 ;aquela janela
;run,%f31% ; <<<<<<<<< for test open YT-url
;clipboard=%f31% ; <<<<<<<<< for test check first run <<<<<<<<<<
;================= END TEST ==========================================================
;-- check if connected to internet
Connected(fl = 0x40){
Return, DllCall("Wininet.dll\InternetGetConnectedState", "UInt *", fl, "UInt", 0)
}
If Connected() <> 1
{
msgbox, 262192,Internet-Info,Internet Not connected
return
}
;=======================================================================================
RECXX =c:\_A_INPUT
IfNotExist, %RECXX%
FileCreateDir, %RECXX%
OUTXX =c:\_A_OUTPUT
IfNotExist, %OUTXX%
FileCreateDir, %OUTXX%
;---------------------------------------
;----------------------------
Menu,S1,add,WikiYoutube ,MH1
Menu,S1,add,ConvertMP3_FFMPEG ,MH1
Menu,S1,add,FreeYoutubeDownload ,MH1
Menu,S1,add,ProxyHelp ,MH1
;----------------------------
Menu,S2,add,Volume ,MH2
Menu,S2,add,Charmap ,MH2
;----------------------------
Menu,S3,add,Help_Info ,MH3
Menu,S3,add,ThisScript ,MH3
;----------------------------
Menu,S4,add,XP_INFO ,MH4
;----------------------------
menu,myMenuBar,Add,Tools ,:S1
menu,myMenuBar,Add,Programme ,:S2
menu,myMenuBar,Add,Help ,:S3
menu,myMenuBar,Add,Info ,:S4
;----------------------------
gui,2:menu,MyMenuBar
;----------------------------
;============== BLOCK GUI-2 =======================
Gui,2: +AlwaysOnTop
Gui,2:default
Gui,2:Font, CDefault , Fixedsys
Gui,2:Add,Text, x10 y10 ,Title
Gui,2:Add,Text, x10 y35 ,UserName
Gui,2:Add,Text, x10 y60 ,Video_ID
Gui,2:Add,Edit, x100 y10 h20 w510 vTitle1 ,
Gui,2:Add,Edit, x100 y35 h20 w200 vUsername1 readonly ,
Gui,2:Add,Edit, x100 y60 h20 w100 vVideoId1 readonly ,
Gui,2:Add,Button,x310 y35 h20 w90 gUser1 vUser1 +disabled ,<YT-USER
Gui,2:Add,Edit, x220 y60 h20 w140 vSUCC readonly ,
;Gui,2:Add,Edit, x410 y60 h20 w100 vTime1 right readonly ,
Gui,2:Add,Edit, x410 y35 h20 w100 vFolder1 readonly ,
Gui,2:Add,Button,x520 y35 h20 w90 gFolder1 ,<Folder
Gui,2:Add,Button,x520 y60 h20 w90 gA4 vA4x ,Logfile
Gui,2:Add,Text, x10 y90 ,PROGRESS
Gui,2:Add,Progress, x150 y90 h20 w480 vPRBAR cFF7200 -smooth
Gui,2:Add,Edit, x100 y90 h20 w45 vText22 Readonly , ;-- procent
Gui,2:Add,Text, x10 y115 ,DNLLINK
Gui,2:Add,Edit, x100 y115 h20 w530 vDNLLINK Readonly , ;-- DNLLINK
Gui,2:Add,Edit, x0 y0 h0 w0 vNotexist readonly ,
Gui,2:Add,Edit, section x100 y140 w150 h25 vYTBSRCH ,
Gui,2:add,button, xp+160 y140 w80 h25 gYtb2 ,<Youtube
Gui,2:add,button, xp+90 y140 w85 h25 gMP4toMP3 vMP4toMP3 ,MP4>MP3
Gui,2:add,button, xp+95 y140 w85 h25 gMP4toMP4 vMP4toMP4 ,MP4>Nokia
Gui,2:add,button, xp+105 y140 w80 h25 gNewbegin1 ,CLEAR
;---------------- url ------------------------------------------------------------
Gui,2:Add, Edit ,x100 section y170 w100 h25 readonly vGX1 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX2 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX3 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX4 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX5 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX6 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX7 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX8 ,
Gui,2:Add, Edit ,x100 yp+30 w100 h25 readonly vGX9 ,
;--------------------------- file-size -------------------------------------------------
Gui,2:Add, Edit ,x220 section y170 w100 h25 readonly right vQ1 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ2 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ3 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ4 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ5 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ6 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ7 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ8 ,
Gui,2:Add, Edit ,x220 yp+30 w100 h25 readonly right vQ9 ,
;--------------------------- FMT -------------------------------------------------
Gui,2:Add, Edit ,x340 section y170 w80 h25 readonly right vFMT1 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT2 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT3 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT4 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT5 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT6 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT7 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT8 ,
Gui,2:Add, Edit ,x340 yp+30 w80 h25 readonly right vFMT9 ,
;------------ 320x240 -----------------------------------------------------------
Gui,2:Add, Edit ,x430 section y170 w90 h25 readonly right vsizex1 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex2 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex3 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex4 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex5 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex6 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex7 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex8 ,
Gui,2:Add, Edit ,x430 yp+30 w90 h25 readonly right vsizex9 ,
;----------------- DNL- buttons ----------------------------------------------------
Gui,2:Add, Button ,x530 section y170 w90 h25 vDNL1 gDNL1 ,DNL1
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL2 gDNL2 ,DNL2
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL3 gDNL3 ,DNL3
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL4 gDNL4 ,DNL4
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL5 gDNL5 ,DNL5
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL6 gDNL6 ,DNL6
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL7 gDNL7 ,DNL7
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL8 gDNL8 ,DNL8
Gui,2:Add, Button ,x530 yp+30 w90 h25 vDNL9 gDNL9 ,DNL9
Gui,2:Show, x5 y500 w640 h450,%filetitle% [100]
;----------------------------------------------
GuiControl,2:Focus,notexist
GuiControl,2:,Folder1,%recxx%
ifnotexist,%ffmpegxx%
{
GuiControl,2:Disable,MP4toMP3
GuiControl,2:Disable,MP4toMP4
}
GuiControl,2:Disable,DNL1
GuiControl,2:Disable,DNL2
GuiControl,2:Disable,DNL3
GuiControl,2:Disable,DNL4
GuiControl,2:Disable,DNL5
GuiControl,2:Disable,DNL6
GuiControl,2:Disable,DNL7
GuiControl,2:Disable,DNL8
GuiControl,2:Disable,DNL9
settimer,DDDD,1300
return
;================= END GUI-2 PART-1 =============================
2GuiClose:
ExitApp
;------------
USER1:
run,http://www.youtube.com/user/%username%
return
;------------
Folder1:
run,%recxx%
return
;------------
MH1:
if A_thisMenuItem=WikiYoutube
run,http://en.wikipedia.org/wiki/YouTube
if A_thisMenuItem=ConvertMP3_FFMPEG
run,http://ffmpeg.zeranoe.com/builds/
if A_thisMenuItem=FreeYoutubeDownload
run,http://www.dvdvideosoft.com/de/products/dvd/Free-YouTube-Download.htm
if A_thisMenuItem=ProxyHelp
run,http://dvdvideosoft.com/de/guides/faq/youtube-blocked-video-not-available-in-your-country.htm
return
;------------------------------------------------------------------
MH2:
if A_thisMenuItem=Volume
{
run,sndvol32
run,sndvol32 /rec
;CN=RunDLL32.EXE shell32.dll,Control_RunDLL mmsys.cpl,,1
;run,%CN%
}
if A_thisMenuItem=Charmap
run,charmap
return
;------------------------------------------------------------------
MH3:
if A_thisMenuItem=help_INFO
gosub,help_INFO
if A_thisMenuItem=ThisScript
run,http://www.autohotkey.com/forum/topic34932.html
return
;------------------------------------------------------------------
MH4:
if A_thisMenuItem=XP_INFO
gosub,XP_INFO
return
;------------------------------------------------------------------
;----------------------------------------------
YTB2:
gui,2:submit,nohide
if ytbsrch=
ytbsrch="dolores duran" solidao
stringreplace,ytbsrch,ytbsrch,%s%,+,all
run,http://www.youtube.com/results?search_query=`%22%ytbsrch%`%22
return
;-----------------------------------------------
NewBegin1:
clipboard=
settimer,DDDD,ON
clearall1:
GuiControl,2:Disable,DNL1
GuiControl,2:Disable,DNL2
GuiControl,2:Disable,DNL3
GuiControl,2:Disable,DNL4
GuiControl,2:Disable,DNL5
GuiControl,2:Disable,DNL6
GuiControl,2:Disable,DNL7
GuiControl,2:Disable,DNL8
GuiControl,2:Disable,DNL9
GuiControl,2:,GX1,
GuiControl,2:,GX2,
GuiControl,2:,GX3,
GuiControl,2:,GX4,
GuiControl,2:,GX5,
GuiControl,2:,GX6,
GuiControl,2:,GX7,
GuiControl,2:,GX8,
GuiControl,2:,GX9,
GuiControl,2:,Q1,
GuiControl,2:,Q2,
GuiControl,2:,Q3,
GuiControl,2:,Q4,
GuiControl,2:,Q5,
GuiControl,2:,Q6,
GuiControl,2:,Q7,
GuiControl,2:,Q8,
GuiControl,2:,Q9,
GuiControl,2:,FMT1,
GuiControl,2:,FMT2,
GuiControl,2:,FMT3,
GuiControl,2:,FMT4,
GuiControl,2:,FMT5,
GuiControl,2:,FMT6,
GuiControl,2:,FMT7,
GuiControl,2:,FMT8,
GuiControl,2:,FMT9,
GuiControl,2:,sizex1,
GuiControl,2:,sizex2,
GuiControl,2:,sizex3,
GuiControl,2:,sizex4,
GuiControl,2:,sizex5,
GuiControl,2:,sizex6,
GuiControl,2:,sizex7,
GuiControl,2:,sizex8,
GuiControl,2:,sizex9,
GuiControl,2:,title1 ,
GuiControl,2:,videoid1 ,
GuiControl,2:,username1 ,
GuiControl,2:,SUCC,
GuiControl,2:,Text22,
return
;============= BLOCK SETTIMER ===============
DDDD:
Gui,2:submit,nohide
F1Y=%clipboard%
stringmid,F1Y,F1Y,1,60
if F1Y contains watch?v=
goto,start2
stringmid,URL1aa,F1Y,1,25
if URL1aa=http://www.youtube.com/v/
{
stringright,STRRR,F1Y,11
F1Y=http://www.youtube.com/watch?v=%STRRR%
goto,start2
}
return
;---------------------------
START2:
settimer,DDDD,off
gosub,DOWNLOAD1 ;-- >>>>>>>>>>>>>>>>>>
return
;============ END BLOCK TIMER =================
;========== BLOCK YT-ANALYZE ===================
DOWNLOAD1:
Gui,2:Show,
Gui,2:submit,nohide
gosub,clearall1 ;-- >>>>>>>>>>> clear
GuiControl,2:,SUCC,...CHECK...
aa=
F11 =%A_scriptdir%\YTB1.txt
UrlDownloadToFile,%F1Y%,%F11% ;<<<<<<<<<<<<<<<< analyze text
Fileread,AA,%F11%
;--------- for test ----------------
stringreplace,AA,AA,`n,`r`n,all
filedelete,%F11%
Fileappend,%AA%`r`n,%F11%
;-----------------------------------
;xx4 =document.title =
xx4 =<meta name="title" content=
xx5 ='VIDEO_ID':
xx6 ='VIDEO_USERNAME':
title=
videoid=
username=
hss=
hsss=
LR=
fmt=
size=
x11=0
;-----------------------------------------------
;================================================
Loop,parse,aa,`n,`r
{
LR=%A_loopfield%
if LR contains %xx4% ;-- >>>>>>>>>>>> title
{
stringmid,title,LR,29,110
stringreplace,title,title,`",,all
stringreplace,title,title,`',,all
stringreplace,title,title,`;,,all
stringreplace,title,title,`>,,all
title=%title%
}
if LR contains %xx5% ;-- 'VIDEO_ID':
stringmid,videoid,LR,14,11
if LR contains %xx6% ;-- ;'VIDEO_USERNAME': "uvedkommend",
{
stringmid,username,LR,20,80
stringreplace,username,username,`",,all
stringreplace,username,username,`',,all
stringreplace,username,username,`,,,all
stringreplace,username,username,},,all
stringreplace,username,username,),,all
stringreplace,username,username,`;,,all
username=%username%
gosub,titlesearch ;-- >>>>>>>>>> title/filename
}
if x11=1
{
if LR contains YouTube - Broadcast Yourself
{
title=Not found [YouTube - Broadcast Yourself]
break
}
}
if LR contains <title>
x11++
;------------ url -------------------------------------
;CONTEN =<embed type="application/x-shockwave-flash"
conten=var swf
searchfor=url_encoded_fmt_stream_map
ifinstring,LR,%CONTEN% ;
{
Loop, Parse,LR ,`; ,
{
if A_LoopField contains %searchfor%
{
HSS=%A_LoopField%
break
}
}
}
;--------------- fmt and size 320x240 -----------------------------
I=0
;CONTEN2 ='PLAYER_CONFIG':
CONTEN2 = yt.playerConfig
searchfor2=fmt_list
ifinstring,LR,%CONTEN2% ;
{
Loop, Parse,LR ,`" ,
{
if A_LoopField contains %searchfor2%
{
HSSS=%hsss%%A_LoopField%
searchfor2=x
i++
if i=2
break
}
}
}
}
;===================================================================
AA=
;- hss= here are the urls
;------------------------------------
stringreplace,hss,hss,http,`|http,all
;------------------------------------
stringreplace,hss,hss,`%253A,`:,all
stringreplace,hss,hss,`%252F,`/,all
stringreplace,hss,hss,`%26,`&,all
G=
G1=
G2=
G3=
G4=
G5=
G6=
G7=
G8=
G9=
G10=
G21=
G31=
G41=
G51=
G61=
G71=
G81=
G91=
G101=
loop,parse,hss,`|
{
G%A_Index% := A_LoopField
}
StringSplit,G2,G2,&
stringreplace,G21,G21,2525,,all
stringreplace,G21,G21,`%253D,`=,all
stringreplace,G21,G21,`%2526,`&,all
stringreplace,G21,G21,`%253F,`?,all
StringSplit,G3,G3,&
stringreplace,G31,G31,2525,,all
stringreplace,G31,G31,`%253D,`=,all
stringreplace,G31,G31,`%2526,`&,all
stringreplace,G31,G31,`%253F,`?,all
StringSplit,G4,G4,&
stringreplace,G41,G41,2525,,all
stringreplace,G41,G41,`%253D,`=,all
stringreplace,G41,G41,`%2526,`&,all
stringreplace,G41,G41,`%253F,`?,all
StringSplit,G5,G5,&
stringreplace,G51,G51,2525,,all
stringreplace,G51,G51,`%253D,`=,all
stringreplace,G51,G51,`%2526,`&,all
stringreplace,G51,G51,`%253F,`?,all
StringSplit,G6,G6,&
stringreplace,G61,G61,2525,,all
stringreplace,G61,G61,`%253D,`=,all
stringreplace,G61,G61,`%2526,`&,all
stringreplace,G61,G61,`%253F,`?,all
StringSplit,G7,G7,&
stringreplace,G71,G71,2525,,all
stringreplace,G71,G71,`%253D,`=,all
stringreplace,G71,G71,`%2526,`&,all
stringreplace,G71,G71,`%253F,`?,all
StringSplit,G8,G8,&
stringreplace,G81,G81,2525,,all
stringreplace,G81,G81,`%253D,`=,all
stringreplace,G81,G81,`%2526,`&,all
stringreplace,G81,G81,`%253F,`?,all
StringSplit,G9,G9,&
stringreplace,G91,G91,2525,,all
stringreplace,G91,G91,`%253D,`=,all
stringreplace,G91,G91,`%2526,`&,all
stringreplace,G91,G91,`%253F,`?,all
StringSplit,G10,G10,&
stringreplace,G101,G101,2525,,all
stringreplace,G101,G101,`%253D,`=,all
stringreplace,G101,G101,`%2526,`&,all
stringreplace,G101,G101,`%253F,`?,all
;------------------------------------------
;- hsss = here fmt and size (see also itag in hss Gx )
;------------------------------------------------------
fmt=
fmt1=
fmt2=
fmt3=
fmt4=
fmt5=
fmt6=
fmt7=
fmt8=
fmt9=
;-- "fmt_list": "43\/640x360\/99\/0\/0,34\/640x360\/9\/0\/115,18\/640x360\/9\/0\/115,5\/320x240\/7\/0\/0",
stringsplit,fmt,hsss,`,
stringtrimleft,fmt1,fmt1,8
u=
u11=
u21=
u31=
u41=
u51=
u61=
u71=
u81=
u91=
u11a=
u21a=
u31a=
u41a=
u51a=
u61a=
u71a=
u81a=
u91a=
;--- u=fmt / *fmt recommended --------
stringsplit,u1,fmt1,`\
if (u11=43 or u11=44 or u11=45)
u11a=%u11%-web
if (u11=37 or u11=22 or u11=18)
u11a=%u11%-mp4
if (u11=35 or u11=34 or u11=5)
u11a=%u11%-flv
if (u11a="22-mp4" or u11a="35-flv" or u11a="34-flv" or u11a="37-mp4" or u11a="38-mp4")
u11a=*%u11a%
stringsplit,u2,fmt2,`\
if (u21=43 or u21=44 or u21=45)
u21a=%u21%-web
if (u21=37 or u21=22 or u21=18)
u21a=%u21%-mp4
if (u21=35 or u21=34 or u21=5)
u21a=%u21%-flv
if (u21a="22-mp4" or u21a="35-flv" or u21a="34-flv" or u21a="37-mp4" or u21a="38-mp4")
u21a=*%u21a%
stringsplit,u3,fmt3,`\
if (u31=43 or u31=44 or u31=45)
u31a=%u31%-web
if (u31=37 or u31=22 or u31=18)
u31a=%u31%-mp4
if (u31=35 or u31=34 or u31=5)
u31a=%u31%-flv
if (u31a="22-mp4" or u31a="34-flv" or u31a="35-flv" or u31a="37-mp4" or u31a="38-mp4")
u31a=*%u31a%
stringsplit,u4,fmt4,`\
if (u41=43 or u41=44 or u41=45)
u41a=%u41%-web
if (u41=37 or u41=22 or u41=18)
u41a=%u41%-mp4
if (u41=35 or u41=34 or u41=5)
u41a=%u41%-flv
if (u41a="22-mp4" or u41a="35-flv" or u41a="34-flv" or u41a="37-mp4" or u41a="38-mp4")
u41a=*%u41a%
stringsplit,u5,fmt5,`\
if (u51=43 or u51=44 or u51=45)
u51a=%u51%-web
if (u51=37 or u51=22 or u51=18)
u51a=%u51%-mp4
if (u51=35 or u51=34 or u51=5)
u51a=%u51%-flv
if (u51a="22-mp4" or u51a="35-flv" or u51a="34-flv" or u51a="37-mp4" or u51a="38-mp4")
u51a=*%u51a%
stringsplit,u6,fmt6,`\
if (u61=43 or u61=44 or u61=45)
u61a=%u61%-web
if (u61=37 or u61=22 or u61=18)
u61a=%u61%-mp4
if (u61=35 or u61=34 or u61=5)
u61a=%u61%-flv
if (u61a="22-mp4" or u61a="35-flv" or u61a="34-flv" or u61a="37-mp4" or u61a="38-mp4")
u61a=*%u61a%
stringsplit,u7,fmt7,`\
if (u71=43 or u71=44 or u71=45)
u71a=%u71%-web
if (u71=37 or u71=22 or u71=18)
u71a=%u71%-mp4
if (u71=35 or u71=34 or u71=5)
u71a=%u71%-flv
if (u71a="22-mp4" or u71a="35-flv" or u71a="34-flv" or u71a="37-mp4" or u71a="38-mp4")
u71a=*%u71a%
stringsplit,u8,fmt8,`\
if (u81=43 or u81=44 or u81=45)
u81a=%u81%-web
if (u81=37 or u81=22 or u81=18)
u81a=%u81%-mp4
if (u81=35 or u81=34 or u81=5)
u81a=%u81%-flv
if (u81a="22-mp4" or u81a="35-flv" or u81a="34-flv" or u81a="37-mp4" or u81a="38-mp4")
u81a=*%u81a%
stringsplit,u9,fmt9,`\
if (u91=43 or u91=44 or u91=45)
u91a=%u91%-web
if (u91=37 or u91=22 or u91=18)
u91a=%u91%-mp4
if (u91=35 or u91=34 or u91=5)
u91a=%u91%-flv
if (u91a="22-mp4" or u91a="35-flv" or u91a="34-flv" or u91a="37-mp4" or u91a="38-mp4")
u91a=*%u91a%
p1=
p2=
p3=
p4=
p5=
p6=
p7=
p8=
p9=
p12=
p22=
p32=
p42=
p52=
p62=
p72=
p82=
p92=
;--- p = 320x240 -----
stringsplit,p1,fmt1,`/
stringsplit,p2,fmt2,`/
stringsplit,p3,fmt3,`/
stringsplit,p4,fmt4,`/
stringsplit,p5,fmt5,`/
stringsplit,p6,fmt6,`/
stringsplit,p7,fmt7,`/
stringsplit,p8,fmt8,`/
stringsplit,p9,fmt9,`/
stringtrimright,p12,p12,1
stringtrimright,p22,p22,1
stringtrimright,p32,p32,1
stringtrimright,p42,p42,1
stringtrimright,p52,p52,1
stringtrimright,p62,p62,1
stringtrimright,p72,p72,1
stringtrimright,p82,p82,1
stringtrimright,p92,p92,1
;------------------------------------------------
;-------- url -----------------------------
GuiControl,2:,GX1,%G21%
GuiControl,2:,GX2,%G31%
GuiControl,2:,GX3,%g41%
GuiControl,2:,GX4,%G51%
GuiControl,2:,GX5,%G61%
GuiControl,2:,GX6,%G71%
GuiControl,2:,GX7,%G81%
GuiControl,2:,GX8,%G91%
GuiControl,2:,GX9,%G101%
;------- fmt -----------------------------
GuiControl,2:,FMT1,%u11a%
GuiControl,2:,FMT2,%u21a%
GuiControl,2:,FMT3,%u31a%
GuiControl,2:,FMT4,%u41a%
GuiControl,2:,FMT5,%u51a%
GuiControl,2:,FMT6,%u61a%
GuiControl,2:,FMT7,%u71a%
GuiControl,2:,FMT8,%u81a%
GuiControl,2:,FMT9,%u91a%
;------------- size 320*240 -----------
GuiControl,2:,Sizex1,%p12%
GuiControl,2:,Sizex2,%p22%
GuiControl,2:,Sizex3,%p32%
GuiControl,2:,Sizex4,%p42%
GuiControl,2:,Sizex5,%p52%
GuiControl,2:,Sizex6,%p62%
GuiControl,2:,Sizex7,%p72%
GuiControl,2:,Sizex8,%p82%
GuiControl,2:,Sizex9,%p92%
size1:=0
size2:=0
size3:=0
size4:=0
size5:=0
size6:=0
size7:=0
size8:=0
size9:=0
if G21<>
SIZE1:=HttpQueryInfo(G21,5)
if G31<>
SIZE2:=HttpQueryInfo(G31,5)
if g41<>
SIZE3:=HttpQueryInfo(g41,5)
if G51<>
SIZE4:=HttpQueryInfo(G51,5)
if G61<>
SIZE5:=HttpQueryInfo(G61,5)
if G71<>
SIZE6:=HttpQueryInfo(G71,5)
if G81<>
SIZE7:=HttpQueryInfo(G81,5)
if G91<>
SIZE8:=HttpQueryInfo(G91,5)
if G101<>
SIZE9:=HttpQueryInfo(G101,5)
if (size1>500)
GuiControl,2:Enable,DNL1
if (size2>500)
GuiControl,2:Enable,DNL2
if (size3>500)
GuiControl,2:Enable,DNL3
if (size4>500)
GuiControl,2:Enable,DNL4
if (size5>500)
GuiControl,2:Enable,DNL5
if (size6>500)
GuiControl,2:Enable,DNL6
if (size7>500)
GuiControl,2:Enable,DNL7
if (size8>500)
GuiControl,2:Enable,DNL8
if (size9>500)
GuiControl,2:Enable,DNL9
;-----------------------------
;SetFormat, float, 04
size1a:=0
size2a:=0
size3a:=0
size4a:=0
size5a:=0
size6a:=0
size7a:=0
size8a:=0
size9a:=0
size1a:=((size1/1024))
size1a:=floor(size1a)
size2a:=((size2/1024))
size2a:=floor(size2a)
size3a:=((size3/1024))
size3a:=floor(size3a)
size4a:=((size4/1024))
size4a:=floor(size4a)
size5a:=((size5/1024))
size5a:=floor(size5a)
size6a:=((size6/1024))
size6a:=floor(size6a)
size7a:=((size7/1024))
size7a:=floor(size7a)
size8a:=((size8/1024))
size8a:=floor(size8a)
size9a:=((size9/1024))
size9a:=floor(size9a)
if (size1>0)
GuiControl,2:,Q1,%size1a%-kB
if (size2>0)
GuiControl,2:,Q2,%size2a%-kB
if (size3>0)
GuiControl,2:,Q3,%size3a%-kB
if (size4>0)
GuiControl,2:,Q4,%size4a%-kB
if (size5>0)
GuiControl,2:,Q5,%size5a%-kB
if (size6>0)
GuiControl,2:,Q6,%size6a%-kB
if (size7>0)
GuiControl,2:,Q7,%size7a%-kB
if (size8>0)
GuiControl,2:,Q8,%size8a%-kB
if (size9>0)
GuiControl,2:,Q9,%size9a%-kB
;gosub,test666 ;-- >>>>>>> Test
GuiControl,2:,title1 ,%title%
GuiControl,2:,videoid1 ,%videoid%
GuiControl,2:,username1 ,%username%
if username<>
GuiControl,2:Enable,USER1
GuiControl,2:,SUCC,CHECKED
settimer,DDDD,OFF
hss=
hsss=
return
;========== END BLOCK YT-ANALYZE =================
;========== BLOCK YT-DOWNLOAD =================
DNL1:
gosub,stt9
FMT=%u11%
gosub,stt10
F20=%G21%
F21=%recxx%\%title1%_%u11%.%ext%
S21:=(size1)
;msgbox, 262180, ,F20=%f20%`nF21=%f21%`nS21=%s21%
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL2:
gosub,stt9
FMT=%u21%
gosub,stt10
F20=%G31%
F21=%recxx%\%title1%_%u21%.%ext%
S21:=(size2)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL3:
gosub,stt9
FMT=%u31%
gosub,stt10
F20=%G41%
F21=%recxx%\%title1%_%u31%.%ext%
S21:=(size3)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL4:
gosub,stt9
FMT=%u41%
gosub,stt10
F20=%G51%
F21=%recxx%\%title1%_%u41%.%ext%
S21:=(size4)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL5:
gosub,stt9
FMT=%u51%
gosub,stt10
F20=%G61%
F21=%recxx%\%title1%_%u51%.%ext%
S21:=(size5)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL6:
gosub,stt9
FMT=%u61%
gosub,stt10
F20=%G71%
F21=%recxx%\%title1%_%Fu61%.%ext%
S21:=(size6)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL7:
gosub,stt9
FMT=%u71%
gosub,stt10
F20=%G81%
F21=%recxx%\%title1%_%u71%.%ext%
S21:=(size7)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL8:
gosub,stt9
FMT=%u81%
gosub,stt10
F20=%G91%
F21=%recxx%\%title1%_%u81%.%ext%
S21:=(size8)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
DNL9:
gosub,stt9
FMT=%u91%
gosub,stt10
F20=%G101%
F21=%recxx%\%title1%_%u91%.%ext%
S21:=(size9)
gosub,prbar1
urldownloadtofile,%f20%,%f21%
gosub,downloadfinished
return
;---- start download ------------------------
STT9:
gui,2:submit,nohide
settimer,DDDD,off
Guicontrolget,Title1,2:
GuiControl,2:,PRBAR,
GuiControl,2:,Text22,
;F2Y=http://www.youtube.com/watch?v=%videoid%
WinSetTitle,%filetitle% [100], ,%filetitle% [0]
aa=
F20=
F21=
S21=
fmt=
return
;------------------------------------------------------
stt10:
;--------- flv ---------------------
if ((fmt=5) or (fmt=35) or (fmt=34))
ext=flv
;---------- mp4 --------------------
if ((fmt=18) or (fmt=22) or (fmt=37) or (fmt=38))
ext=mp4
;---------- WebM --------------------
if ((fmt=43) or (fmt=44) or (fmt=45))
ext=mp4
;---------- 3GP ---------------------
if (fmt=17)
{
ext=mp4
rmk=3GP
}
return
;=======================================================
;----------------------------
;--- download finished ------
downloadfinished:
settimer,AAS4,off
WinSetTitle,%filetitle% [%RES2%], ,%filetitle% [100]
Filegetsize,size11,%f21%
if (S21=SIZE11)
{
GuiControl,2:,SUCC,succes
GuiControl,2:,Text22,100 `%
}
else
{
GuiControl,2:,SUCC,NO succes
GuiControl,2:,Text22,0 `%
}
;stringmid,F1Y,F1Y,1,43
stringmid,dates,A_now,1,12
F2Y=http://www.youtube.com/watch?v=%videoid%
SplitPath,F21, name11, dir, ext, name_no_ext, drive
Fileappend,%username%`;%name11%`;%f2y%`;%f20%`;%dates%`;%fmt%`r`n,%f41%
return
;------------------------------------------
;========== END BLOCK YT-DOWNLOAD =========
;-------------- gosub ---------------------
PRBAR1:
GuiControl,2:,dnllink ,%F20%
if (S21="timeout" or S21=0 or S21=-1)
{
settimer,AAS4,off
;msgbox,URL not found
GuiControl,2:,SUCC,NO SUCCESS
return
}
settimer,AAS4,500
GuiControl,2:+RANGE0-%S21%,PRBAR ;CHANGE processbar
GuiControl,2:,SUCC,... running ...
return
;--------------------------------------------
AAS4:
i++
Filegetsize,size11,%f21%
RES1:=Round((100*SIZE11)/S21)
GuiControl,2:,PRBAR, %SIZE11%
GuiControl,2:,Text22,%RES1% `%
WinSetTitle,%filetitle% [%RES2%], ,%filetitle% [%RES1%]
RES2=%RES1%
if I=10 ;-- minimize GUI after a few seconds
gui,2:show,minimize
return
;===========================================================
;=========== TITLE =========================================
titlesearch:
gui,2:submit,nohide
;-- remove special characters like chinese
title := RegExReplace(title, "\W", " ")
stringreplace,title,title,quot,,all
stringreplace,title,title,amp,,all
;---------- remove special characters from video name -------------------
autotrim,off
stringmid,TRX,A_now,1,12
new2=
Loop,Parse,TITLE
{
A:=(Asc(A_LoopField))
B:=chr(a)
;if (B=" " or B="ç" or B="ã")
if (B=" ")
Goto,SKIP8
if ((a<48 or a>57) AND A<65 OR A>90 AND A<97 OR A>122)
continue
SKIP8:
new2=%new2%%b%
}
autotrim,on
new2=%new2%
title=%new2%
title=%title%_%username%_%videoid%
title := RegExReplace(title,"\x20{2,}"," ") ; remove double spaces
;title:=delspaces(title)
return
;---------------------------------------------
delspaces(title){
title :=RegExReplace(title,"\s{2,}", " ") ;-- whitespace in the string
title :=RegExReplace(title,"(^\s)|(\s$)","") ;-- trailing whitespace
return %title%
}
;=========== end TITLE ==============================================
esc::exitapp
;---------------- Convert MP4 to MP3 from folder ---------------------------------------------
MP4toMP3:
Gui,2:submit,nohide
Loop,%RECxx%\*.*,0,1
{
ALF= %A_LoopFileFullPath%
SplitPath, ALF, name, dir, ext, name_no_ext, drive
FileDest=%outxx%\%name_no_ext%.mp3
ifexist,%Filedest%
FileDest=%outxx%\%A_now%_%name_no_ext%.mp3
if (ext="mp4" or ext="flv" or ext="mpg")
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -ab 192k "%Filedest%"
}
run,%outxx%
return
;---------------------------------------------------------------------------------------------
;------------------ Convert MP4 to NOKIA E51 320*240 from folder ------------------------------
MP4toMP4:
Gui,2:submit,nohide
;qvga 320*240 Nokia
;vga 640*480
;svga 800*600
;xga 1024*768
Loop,%RECxx%\*.*,0,1
{
ALF= %A_LoopFileFullPath%
SplitPath, ALF, name, dir, ext, name_no_ext, drive
if ext=mp4
runwait,%comspec% /k ffmpeg.exe -i "%ALF%" -s qvga -r 25 "%outxx%\%name%" ;--qvga=320*240
if ext=flv
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -s qvga -r 25 "%outxx%\%name_no_ext%.mp4"
if ext=mpg
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -s qvga -r 25 "%outxx%\%name_no_ext%.mp4"
}
run,%outxx%
return
;----------------- END BLOCK MP3/MP4 convert FFMPEG --------------------------------------------------
;================= DOWNLOAD FFMPEG ===================
DNLFFMPEG:
{
;FXX=http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-git-1929807-win32-static.7z ;- 20110607
FXX=http://ffmpeg.zeranoe.com//builds/
text31=
(
If you want convert downloaded video to MP3
needs FFMPEG in same folder as script
Download
from
%fxx%
- builds static
Want you download this program ?
)
msgbox, 262180, Start URL,%text31%
ifmsgbox,NO
return
else
{
run,%fxx%
;run,http://www.davidtavarez.com/wp-content/2009/12/ffmpeg-r17988-komeil.cab
;run,http://www.autohotkey.net/~garry/FFMPEGX.zip
exitapp
}
}
return
;============================================================================
;=========================================================================
;================ GUI-4 Listview shows downloaded links (logfile ) =======
A4:
#NoEnv
SetBatchlines -1
SendMode Input
Settitlematchmode, 2
setworkingdir, %a_scriptdir%
transform,S,chr,32 ;SPACE
Gui,4:default
Gui,4:Font, CDefault , Fixedsys
Gui,4: Add, ListView, x2 y0 w1160 h520 grid +hscroll logical altsubmit gLV1A vLV1 -LV0x10,User|Title|URL1|URL2|DATE|FMT
TAB1 =150
TAB2 =740
TAB3 =70
TAB4 =0
TAB5 =120
TAB6 =50
T1C:=TAB1
T2C:=TAB1+TAB2
T3C:=TAB1+TAB2+TAB3
T4C:=TAB1+TAB2+TAB3+TAB4
T5C:=TAB1+TAB2+TAB3+TAB4+TAB5
T6C:=TAB1+TAB2+TAB3+TAB4+TAB5+TAB6
LV_ModifyCol(1,TAB1) ;
LV_ModifyCol(2,TAB2) ;
LV_ModifyCol(3,TAB3) ;
LV_ModifyCol(4,TAB4) ;
LV_ModifyCol(5,TAB5) ;
LV_ModifyCol(6,TAB6) ;
LV_ModifyCol(5,"integer")
LV_ModifyCol(6,"integer")
Gui,4:Add,Edit, x5 y550 w295 h20 vURLX1 gSEARCH1
Gui,4:Add,Edit, x1000 y550 w90 h20 readonly vCountFile1 right,
Gui,4:Show, x2 y5 w1200 h630, Listview
GuiControl,2:Disable,A4x
Search1=NO
GoSub,FILLLIST
return
;===================================================================================
4GuiClose:
Gui,4:destroy
GuiControl,2:Enable,A4x
return
;========= GUI EVENT ===================
LV1A:
Gui,4:default
Gui,4: Submit, NoHide
Gui, 4:ListView, LV1
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
if A_GuiEvent=K
{
GetKeyState,state,DEL
if state=D
{
msgbox,DEL
return
}
}
If A_GuiEvent = Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
LV_GetText(C5,A_EventInfo,5)
LV_GetText(C6,A_EventInfo,6)
}
If A_GuiEvent = doubleclick
{
MouseGetPos,x,y
{
if x<%T1C%
{
LV_GetText(C1,A_EventInfo,1)
run,http://www.youtube.com/user/%c1%
return
}
if x<%T2C%
return
if x<%T3C%
{
LV_GetText(C3,A_EventInfo,3)
run,%C3%
return
}
if x<%T4C%
return
if x<%T5C%
return
if x<%T6C%
return
}
return
}
If A_GuiEvent = Rightclick ;-- opens big picture
{
LV_GetText(C3,A_EventInfo,3)
stringmid,STR3,C3,32,11
C3=http://www.youtube.com/v/%str3%
run,%c3%
}
return
;--------
;========================================
Search1:
Gui,4:submit,nohide
search1=YES
Guicontrolget,urlx1,4:
if (urlx1="")
search1=no
FillList:
Gui,4:submit,nohide
Gui,4:default
Gui,4: Listview, LV1
X:=0
Guicontrol,4:,CountFile1,%x%
Loop,Read,%F41%
Linex = %A_Index%
LV_Delete()
I=0
GuiControl,4: -Redraw,LV1
loop,read,%F41%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
C4 =
C5 =
C6=
stringsplit,C,LR,`;,
if (search1="YES")
{
CX=%C1% %C2% %C3% %C4% %C5% %C6%
ifinstring,CX,%URLX1%
{
I++
LV_Add("",C1,C2,C3,C4,C5,C6)
}
Guicontrol,4:,CountFile1,%i%
continue
}
{
I++
LV_Add("",C1,C2,C3,C4,C5,C6)
Guicontrol,4:,CountFile1,%i%
}
}
LV_ModifyCol(5,"integer")
LV_ModifyCol(6,"integer")
LV_ModifyCol(5, "Sort")
LV_Modify(LV_GetCount(), "Vis") ;scrollt nach unten
GuiControl,4: +Redraw,LV1
if (I=linex)
search1=NO
return
;========================== END GUI-4 ===============================================
;-------------- Label Test ----------------------
test666:
F51=test666.txt
ifexist,%f51%
filedelete,%f51%
;--- fmt --------------------------
fileappend,%u11%`r`n,%f51%
fileappend,%u21%`r`n,%f51%
fileappend,%u31%`r`n,%f51%
fileappend,%u41%`r`n,%f51%
fileappend,%u51%`r`n,%f51%
fileappend,%u61%`r`n,%f51%
fileappend,%u71%`r`n,%f51%
fileappend,%u81%`r`n,%f51%
fileappend,%u91%`r`n,%f51%
fileappend,-----------------------`r`n,%f51%
;--- url -------------------------
fileappend,%G21%`r`n,%f51%
fileappend,%G31%`r`n,%f51%
fileappend,%G41%`r`n,%f51%
fileappend,%G51%`r`n,%f51%
fileappend,%G61%`r`n,%f51%
fileappend,%G71%`r`n,%f51%
fileappend,%G81%`r`n,%f51%
fileappend,%G91%`r`n,%f51%
fileappend,%G101%`r`n,%f51%
fileappend,-----------------------`r`n,%f51%
;- fmt_url_map=37%7C|http://o-o.preferred.swisscom-zrh1.v21.lscache3.c.youtube.com/...
fileappend,hss=%hss%`r`n,%f51%
fileappend,-----------------------`r`n,%f51%
;-- fmt_list37\/1920x1080\/9\/0\/115,45\/1280x720\/99\/0\/0,22\/1280x720\/9\/0\/115,44\/854x480\/99\/0\/0,
; 35\/854x480\/9\/0\/115,43\/640x360\/99\/0\/0,34\/640x360\/9\/0\/115,18\/640x360\/9\/0\/115,5\/320x240\/7\/0\/0
fileappend,hsss=%hsss%`r`n,%f51%
run,%f51%
return
;-------------- End Label Test ----------------------
Help_Info:
e4x=
(
How to use:
------------
Copy URL, script shows max 9 possibilities (quality)
click download button [DNL1-9]
when download started GUI will minimize in a few seconds, see process in tray [0-100]
======================================================================
[Clear ] = ready for next download
[Folder ] = click to see downloaded file in c:\_A_INPUT
[MP4>MP3 ] = convert video to audio c:\_A_OUTPUT
[MP4>Nokia] = convert to 320*240 c:\_A_OUTPUT
[YT-USER ] = open url from user
[LogFile ] = show log , click column to start user or video in youtube again
=======================================================================
;-- http://en.wikipedia.org/wiki/YouTube
;-- howto find a proxy:
;-- http://dvdvideosoft.com/de/guides/faq/youtube-blocked-video-not-available-in-your-country.htm
;-- see also:
;-- http://www.dvdvideosoft.com/de/products/dvd/Free-YouTube-Download.htm
;-- howto convert video to MP3 / FFMPEG.exe =
;-- http://ffmpeg.zeranoe.com/builds/ ; ( static build )
;-- http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-git-1929807-win32-static.7z ;-- 20010607 32-bit
)
msgbox, 262192,Help-Info,%e4x%
return
;-------------------------------------------------------------------
XP_INFO:
HA=%A_screenheight%
HW=%A_screenwidth%
;-------- http://www.autohotkey.com/forum/topic74755.html ---
info := "AHK Version:`t" A_AhkVersion
. "`nUnicode:`t`t" (A_IsUnicode ? "Yes " ((A_PtrSize=8) ? "(64-bit)" : "(32-bit)") : "No")
. "`nOperating System:`t" (!A_OSVersion ? A_OSType : A_OSVersion)
. "`nAdmin Rights:`t" (A_IsAdmin ? "Yes" : "No")
if (HA=576)
text11=You have maybe a netbook Lenovo S10e
loop, 26 ;- loop through the possible letters
{
drv:=chr(a_index+64) ;- convert to a character, uppercase A is 65 decimal
IfExist, %drv%:\ ;- test if it exists
the_list.=drv
}
msgbox, 262208,INFO,%info%`nDrives=%the_list%`nScreen=%hw%*%ha%`n%text11%
return
;--------------------------------------------------------------------------
;================ Function httpquery ===============================
;http://www.autohotkey.com/forum/topic10510.html
HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
If (Proxy != "")
AccessType=3
Else
AccessType=1
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}
VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)
Loop, 5
{
hqi := DllCall("wininet\HttpQueryInfoA"
, "uint", iou_hInternet
, "uint", QueryInfoFlag ;dwInfoLevel
, "uint", &buffer
, "uint", &buffer_len
, "uint", 0) ;lpdwIndex
If (hqi = 1) {
hqi=success
break
}
}
IfNotEqual, hqi, success, SetEnv, res, timeout
If (hqi = "success") {
p := &buffer
Loop
{
l := DllCall("lstrlen", "UInt", p)
VarSetCapacity(tmp_var, l+1, 0)
DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
p += l + 1
res := res . "`n" . tmp_var
If (*p = 0)
Break
}
StringTrimLeft, res, res, 1
}
DllCall("wininet\InternetCloseHandle", "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle", "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)
return, res
}
;=============== END Function httpquery ===========================
;=============== END script youtube ===============================
OLD=

============== MP42MP3 convert video to MP3 =============================
Convert videos to MP3 and videos to 320*240 for mobilphone NOKIA E51
for FFMPEG see ( 20110608 )
http://ffmpeg.zeranoe.com//builds/Code:
MODIFIED=20110312
FILENAME=ConvertVideoToMP3_%MODIFIED%
;-- MP42MP3 MP42NOKIA [ MP4>MP3 MP4>NOKIA ] ----------------
;
;-- Convert files [ drag&drop or Fileselect or all files in folder ]
;
;-- 1-- convert video to MP3
;-- 2-- convert video to Nokia E51 video 320*240
;
;
;===============================================
#NoEnv
SetBatchlines -1
SendMode Input
Settitlematchmode, 2
FFMPEGXX=%A_scriptdir%\ffmpeg.exe
ifnotexist,%ffmpegxx%
goto,dnlffmpeg
FileInstall,ffmpeg.exe,ffmpeg.exe,1 ;--- if you compile to xy.exe ffmpeg.exe woul'd be also in scriptdir
;========== BLOCK create FOLDERS ===============
RECXX =c:\_A_INPUT
IfNotExist, %RECXX%
FileCreateDir, %RECXX%
OUTXX =c:\_A_OUTPUT
IfNotExist, %OUTXX%
FileCreateDir, %OUTXX%
;===============================================
GUI,2:+AlwaysOnTop
Gui,2:Color,black
Gui,2:Font, S10 CDefault , Lucida Console
TEXTCOLOR=yellow
EDITCOLOR=red
;inix=%A_scriptdir%\dragdrop.ini
;ifnotexist,%inix%
; IniWrite,0,%inix%,Nokia,KEY1
Gui,2:Add, Edit ,x5 y95 w750 h110 c%textcolor% Readonly vF2,
Gui,2:Font, CDefault ,Fixedsys
Gui,2:Add, Edit ,x5 y5 w750 h40 vF1,
Gui,2:Add,button ,x620 y55 w90 h25 vBrowse gBrowse ,Browse
Gui,2:add,button,x5 y55 w180 h25 gMP4toMP3drag ,^ MP4>MP3
Gui,2:add,button,x200 y55 w180 h25 gMP4toMP4drag ,^ MP4>MP4 NOKIA
Gui,2:add,button,x5 y220 w180 h25 gMP4toMP3 ,Folder MP4>MP3
Gui,2:add,button,x200 y220 w180 h25 gMP4toMP4 ,Folder MP4>MP4 NOKIA
Gui,2:add,button,x500 y220 w100 h25 gFolderinput ,Folder-IN
Gui,2:add,button,x620 y220 w100 h25 gFolderoutput ,Folder-OUT
/*
IniRead,Nokiax,%inix%,Nokia,KEY1
if Nokiax=0
Gui,2:Add,CheckBox,c%textcolor% x640 y65 vVID1 gVID1A ,Nokia
else
Gui,2:Add,CheckBox,c%textcolor% checked x640 y65 vVID1 gVID1A ,Nokia
*/
GUI,2:show, NA W770 H260 X20 Y20, %filename%
gosub,filllist
return
;----------------------------------------------------------
;--------- write settings to INI --------------------------
/*
VID1A:
Gui,2:submit,nohide
if VID1=0
IniWrite,0,%inix%,Nokia,KEY1
else
IniWrite,1,%inix%,Nokia,KEY1
return
*/
;-------------
Filllist:
e4x=
Loop,%RECxx%\*.*,0,0
{
SplitPath,A_LoopFileFullPath,name,dir,ext,name_no_ext,drive
if (ext="mp4" or ext="flv" or ext="mpg")
e4x=%name%`n%e4x%
}
GuiControl,2:,F2,%e4x%
e4x=
return
;---------------- Drag & Drop ------------------------------
2GuiDropFiles:
Loop, parse, A_GuiEvent, `n
{
GuiControl,2:,F1,%A_LoopField%
;if A_LoopField !=
; goto Convertx
}
return
;------------------------------------------------------------
;------------ FileSelect -----------------------------------
Browse:
;FileSelectFile, filename,1,%recxx%,Select your file,*.mp4;*.flv
FileSelectFile, filename,,%recxx%,Select your file,*.mp4;*.flv
if filename =
return
GuiControl,2:,F1,%filename%
return
;------------------------------------------------------------
Folderinput:
Gui,2: Show,minimize
run,%recxx%
return
Folderoutput:
Gui,2: Show,minimize
run,%outxx%
return
Convertx:
;IniRead,Nokiax,%inix%,Nokia,KEY1
;if Nokiax=0
; msgbox,K=0
;else
; msgbox,K=1
return
;---------------- Convert MP4 to MP3 from drag&drop -------------------------
MP4toMP3drag:
guicontrolget,F1
if F1<>
{
SplitPath, F1, name, dir, ext, name_no_ext, drive
Loop, %F1% ;-- create shortpath
SP1= %A_loopFileShortPath%
FileDest=%outxx%\%name_no_ext%.mp3
ifexist,%Filedest%
FileDest=%outxx%\%A_now%_%name_no_ext%.mp3
if (ext="mp4" or ext="flv" or ext="mpg")
runwait,%comspec% /c ffmpeg.exe -i "%SP1%" -ab 192k "%Filedest%"
else
msgbox, 262192, GWBASIC MESSAGE,This is not a file to convert
}
GuiControl,2:,F1,
run,%outxx%
return
;---------------------------------------------------------------------------------------------
;---------------- Convert MP4 to MP4 from drag&drop -------------------------
MP4toMP4drag:
guicontrolget,F1
if F1<>
{
SplitPath, F1, name, dir, ext, name_no_ext, drive
Loop, %F1% ;-- create shortpath
SP1= %A_loopFileShortPath%
if ext=mp4
runwait,%comspec% /k ffmpeg.exe -i "%SP1%" -s qvga -r 25 "%outxx%\%name%" ;--qvga=320*240
if ext=flv
runwait,%comspec% /c ffmpeg.exe -i "%SP1%" -s qvga -r 25 "%outxx%\%name_no_ext%.mp4"
if ext=mpg
runwait,%comspec% /c ffmpeg.exe -i "%SP1%" -s svga -r 25 "%outxx%\%name_no_ext%.mp4"
}
GuiControl,2:,F1,
run,%outxx%
return
;---------------- Convert MP4 to MP3 from folder ---------------------------------------------
MP4toMP3:
Gui,2:submit,nohide
Gui,2: Show,minimize
Loop,%RECxx%\*.*,0,1
{
ALF= %A_LoopFileFullPath%
SplitPath, ALF, name, dir, ext, name_no_ext, drive
FileDest=%outxx%\%name_no_ext%.mp3
ifexist,%Filedest%
FileDest=%outxx%\%A_now%_%name_no_ext%.mp3
if (ext="mp4" or ext="flv" or ext="mpg")
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -ab 192k "%Filedest%"
}
run,%outxx%
return
;---------------------------------------------------------------------------------------------
;------------------ Convert MP4 to NOKIA E51 320*240 from folder ------------------------------
MP4toMP4:
Gui,2:submit,nohide
Gui,2: Show,minimize
;qvga 320*240 Nokia
;vga 640*480
;svga 800*600
;xga 1024*768
Loop,%RECxx%\*.*,0,1
{
ALF= %A_LoopFileFullPath%
SplitPath, ALF, name, dir, ext, name_no_ext, drive
if ext=mp4
runwait,%comspec% /k ffmpeg.exe -i "%ALF%" -s qvga -r 25 "%outxx%\%name%" ;--qvga=320*240
if ext=flv
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -s qvga -r 25 "%outxx%\%name_no_ext%.mp4"
if ext=mpg
runwait,%comspec% /c ffmpeg.exe -i "%ALF%" -s svga -r 25 "%outxx%\%name_no_ext%.mp4"
}
run,%outxx%
return
;----------------- END BLOCK MP3/MP4 convert FFMPEG -------------