 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
menaphus
Joined: 28 Nov 2008 Posts: 111 Location: United Kingdom
|
Posted: Sat Nov 29, 2008 7:04 pm Post subject: |
|
|
| menaphus wrote: | | garry wrote: | hello menaphus,
it downloads to Harddisk
start script and copy url-link (CTRL+c or mouse rightclick )
place where download:
REC =c:\_RECORDED1 ; maybe change path
;---- DOWNLOADS YOUTUBE FLV or MP4 with correct name (2nd script with MP3converter ) -----
;---- automatically select best quality or define fmt=0/18/22 ------------------
-----------------------------------------------------------------
hello Q,
sorry for the late answer
ĉesko -
I'll have to login, didn't tried
maybe are the videos downloaded in FireFox cache
http://www.autohotkey.com/forum/topic25694.html&highlight=firefox |
Ok ty i think i shall get it  |
Where is it saved , all i can find is a text file full of browser code or is that it? _________________ Adam
http://moourl.com/8w0tx
 |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Sat Nov 29, 2008 7:20 pm Post subject: |
|
|
hello menaphus,
(delete my answers in your post (don't repeat) )
I tried first script again, it works
just copy script save as youtubexy.ahk, start, enter
automatically downloads example jim reeves
after 5 seconds script minimizes, wait until 100% , then starts video
-Jim Reeves - Ek Verlang Na Jou.mp4
when copy a link in youtube , script starts (maximized) and 5 second later minimized, see download process in procent (tray)
should have an xy.mp4 or xy.flv file in c:\_recorded1
when no succes / questions can me also send mail |
|
| Back to top |
|
 |
fsnow55
Joined: 08 Jun 2006 Posts: 36
|
Posted: Wed Dec 17, 2008 10:21 pm Post subject: don't want mp3/mp4 converter |
|
|
Garry, the pgm does nothing (does not run) when I pick no to the free mp3/4 converter
(I'm wary about spyware in it). |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Thu Dec 18, 2008 10:17 am Post subject: |
|
|
if you don't want use the mp3converter
should desactive / correct some lines
| Code: | MP3extract =%A_programfiles%\DVDVideoSoft\Free Video to Mp3 Converter\FreeVideoToMP3Converter.exe
;ifnotexist,%MP3extract%
; goto,mp3converter
........
ifexist,%MP3extract%
{
if MQ2=0
Gui,2:Add,CheckBox,c%textcolor% x350 y270 vMP31 gMP31A ,MP3 extract
else
Gui,2:Add,CheckBox,c%textcolor% checked x350 y270 vMP31 gMP31A ,MP3 extract
}
......
ifnotexist,%mp3extract%
{
;msgbox,262144,,Download MP3Extract`r`nhttp://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
return
}
|
|
|
| Back to top |
|
 |
fsnow55
Joined: 08 Jun 2006 Posts: 36
|
Posted: Thu Dec 18, 2008 9:06 pm Post subject: |
|
|
| Thanks for the quick response. |
|
| Back to top |
|
 |
..:: Free Radical ::..
Joined: 20 Sep 2006 Posts: 72
|
Posted: Tue Dec 30, 2008 11:18 am Post subject: |
|
|
Here's how I use it
| Code: | DownloadMgr=H:\FlashGet\flashget.exe
F1 =%A_Temp%\YouTube.HTML
URL1=%1%
UrlDownloadToFile,%URL1%,%F1%
transform,ten,chr,10
transform,tre,chr,13
CF=%TRE%%TEN%
FileRead,AA,%F1%
StringReplace,AA,AA,%TEN%,%CF%,all
FileDelete,%F1%
FileAppend,%AA%`r`n,%F1%
CONTEN=var fullscreenUrl =
VANAF2=&title=
UNTIL2=';
MP4=0
SEARCHFOR=">watch in high quality</a>
Loop,Read,%F1%
{
LR=%A_LoopReadLine%
if LR contains %SEARCHFOR%
{
MP4=1
break
}
}
HSS=
HSS2=
SEARCHFOR=video_id=,l=,sk=,t=,hl=,plid=
Loop,Read,%F1%
{
LR=%A_LoopReadLine%
ifinstring,LR,%CONTEN%
{
Loop, Parse,LR ,`&,`
{
H%A_Index% := A_LoopField
if H%A_Index% contains %searchfor%
T%A_Index%:=A_LoopField
if T%A_Index%<>
HSS=%HSS%%A_LoopField%&
if A_loopfield contains title=
TITLE=%A_LoopField%
H%A_Index%=
T%A_index%=
}
stringreplace,TITLE,TITLE,title=,%nothing%,all
stringreplace,TITLE,TITLE,`',%nothing%,all
stringreplace,TITLE,TITLE,`;,%nothing%,all
; ---- replace at least portuguese letters --
stringreplace,TITLE,TITLE,quot,%S%,all
stringreplace,TITLE,TITLE,",%S%,all
stringreplace,TITLE,TITLE,&,%S%,all
;stringreplace,TITLE,TITLE,-,%S%,all
stringreplace,TITLE,TITLE,,c,all
stringreplace,TITLE,TITLE,,e,all
stringreplace,TITLE,TITLE,,e,all
stringreplace,TITLE,TITLE,,n,all
stringreplace,TITLE,TITLE,,a,all
stringreplace,TITLE,TITLE,ç,c,all ;
stringreplace,TITLE,TITLE,ã,a,all ;
stringreplace,TITLE,TITLE,ö,oe,all ;
stringreplace,TITLE,TITLE,é,e,all ;
stringreplace,TITLE,TITLE,,a,all ;
break
}
}
stringlen,L5,HSS
END5:=(L5-1)
stringmid,HSS2,HSS,1,END5
URL2=http://www.youtube.com/get_video?%HSS2%&fmt=22
SIZE:=HttpQueryInfo(URL2,5)
if SIZE=timeout
URL2=http://www.youtube.com/get_video?%HSS2%&fmt=18
else, URL2=http://www.youtube.com/get_video?%HSS2%&fmt=22
gosub,removechr
SplitPath,F2, name7, dir7, ext7, name_no_ext7, drive7
Run, "%DownloadMgr%" "%URL2%"
WinWait, Add new download, , 5
IfWinNotActive, Add new download, , WinActivate, Add new download,
WinWaitActive, Add new download,
SendInput, {TAB 7}%F2%{Enter}
FileDelete,%F1%
exitapp
;---------- Remove special characters from video name ----------------------
REMOVECHR:
autotrim,off
new2=
Loop,Parse,TITLE
{
A:=(Asc(A_LoopField))
B:=chr(a)
if (B="_" OR B=" " OR B="-") ;allow _space autotrim,off
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
stringmid,ANOW1,A_NOW,1,12 ;if not readable chinese...
anow1=%anow1%
new2=%new2%
if new2=
{
F2=_%ANOW1%.MP4
return
}
F2=%new2%.MP4
return
;-------------------------- FUNCTION GETSIZE before download -------------------------
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
} |
Thanks garry |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Fri Jan 02, 2009 11:11 am Post subject: |
|
|
thank you ..:: Free Radical ::..
I didn't used flashget yet
I made to complicated, now added a logfile,
listview A/B/C
( usermember / video / link ) |
|
| Back to top |
|
 |
mtman1020
Joined: 08 Aug 2008 Posts: 36
|
Posted: Thu Feb 12, 2009 1:16 pm Post subject: |
|
|
garry,
Thanks for taking the time to keep this updated and working!!
How do you clear the listview? I have 51 items already and don't want to see the ones I downloaded last week....
Thanks, |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Fri Feb 13, 2009 7:07 pm Post subject: |
|
|
hello mtman1020
| Quote: |
How do you clear the listview? I have 51 items already and don't want to see the ones I downloaded last week.... |
example below deletes all saved URL's and names
(it's possible also to manage listview, delete only marked rows)
Filerecycle youtubelog.txt (tools menu) and clears Listview
| Code: | Menu,S2,add,Delete Logfile ,MH14
; or can use also a button
.......
MH14:
msgbox, 262180, Start URL,Want you delete the logfile %F21% ?
ifmsgbox,NO
return
else
{
Filerecycle,%F21%
gosub,filllist1
}
return
|
|
|
| Back to top |
|
 |
WankaUSR
Joined: 14 Aug 2007 Posts: 86
|
Posted: Mon Aug 10, 2009 12:14 pm Post subject: |
|
|
Added some minor modifications like selection of the save to folder because i use the script compiled on my work pc . here is the script
| Code: |
MODIFIED =20090119 ;youtube changed autoselect
;MODIFIED=20090107 ;extractaudio 31351 changed
;MODIFIED=20090102 ;added listview logfile
;MODIFIED=20081217 ;added checkbox
;MODIFIED=20081122 ;added radio-box to select fmt=0/18/22
;MODIFIED=20081117 ;FMT=18 FMT=22
;MODIFIED=20081026 ;added freeware converts video to MP3
FILENAME=YOUTUBE_%MODIFIED%
YOUTUBEMP4INI=%A_scriptdir%\YOUTUBEMP4a.ini
ifnotexist,%YOUTUBEMP4INI%
{
IniWrite,0 , %YOUTUBEMP4INI% ,Startvideo , KEY1
IniWrite,0 , %YOUTUBEMP4INI% ,Beep , KEY1
IniWrite,%A_scriptDir%\YouTube_Vids, %YOUTUBEMP4INI% ,Settings, SaveTo
}
;REC =d:\Download\YouTube_Download
;run,%COMSPEC% /C if not exist \%REC%\NUL MD %REC%,,hide
IniRead, REC,%YOUTUBEMP4INI%, Settings, SaveTo
IfNotExist, %REC%
FileCreateDir, %REC%
;---- DOWNLOADS YOUTUBE FLV or MP4 with right name and convert to MP3 ---------
;---- automatically select best quality ----------------------------------------
;================================================================================
/*
.............how to use ................................................
start this script and youtube
copy video link with rightclick or CTRL+c
download starts, downloads ---namexy.flv-- or -- namexy.mp4 --
when download finished possibility to convert video to MP3
creates a logfile start member/youtube or download again
........................................................................
http://www.autohotkey.net/~garry/20081122_YOUTUBE_MP4.png
size example=
-----------------------------------------------
-720p HD Test 2: Big Buck Bunny
http://www.youtube.com/watch?v=wUPcimeiqLE&fmt=22 166-MB mp4
http://www.youtube.com/watch?v=wUPcimeiqLE&fmt=18 42-MB mp4
http://www.youtube.com/watch?v=wUPcimeiqLE 24-MB flv
------------------------------------------------
var isHDAvailable = true;
........................ http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm
........................ http://www.dvdvideosoft.com/free-dvd-video-software.htm
.............. Free Video to MP3 Converter ...........................................................
http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
http://www.dvdvideosoft.com/products/dvd/Free-Video-to-MP3-Converter.htm
Use Free Video to MP3 Converter to extract audio from video files
(*.avi, *mpg, *.mpg, *.mp4, *.m4v, *.mpeg, *.dvr-ms, *.wmv, *.asf, *.mov, *.qt, *.3gp, *.3g2 and *.flv)
and save it as MP3
There are 3 pre-configured presets:
- High Quality (MP3, 256kbps, 48000Hz, STEREO);
- Standard Quality (MP3, 128kbps, 44100Hz, STEREO);
- Economy Quality (MP3, 96kbps, 22050Hz, STEREO).
and TRIM video
........................................................................................................
*/
;==================================================
#NoEnv
SetBatchlines -1
SendMode Input
setworkingdir, %a_scriptdir%
WA=%A_screenwidth%
HA=%A_screenheight%
MP3extract =%A_programfiles%\DVDVideoSoft\Free Video to Mp3 Converter\FreeVideoToMP3Converter.exe
;ifnotexist,%MP3extract%
; goto,mp3converter
Settitlematchmode, 2
Gui,2:default
Gui,2: +AlwaysOnTop
Gui,2:Color,black
Gui,2:Font, S10 CDefault , Lucida Console
transform,ten,chr,10
transform,tre,chr,13
CF=%TRE%%TEN%
;-------- menu ----------------------------------------------
;--------------- SETTINGS ------------------
;menu ,S1 ,Add,&Ask for start video after download ,MH1
;menu ,S1 ,Add,&Ask for convert to MP3 after download ,MH2
;-------------- TOOLS ---------------------------
Menu,S2,add,Converter start ,MH11
Menu,S2,add,Converter download ,MH12
Menu,S2,add,Converter HomePage ,MH13
;menu, myMenuBar, Add, Settings ,:S1
menu, myMenuBar, Add, Tools ,:S2
gui,2:menu,MyMenuBar
;----------------------------------------------------
AFC=0
TEXTCOLOR=yellow
EDITCOLOR=red
Gui,2:add, text, x0 y0 h0 w0 vTEXT3 ,%text4% ;text is hidden , see settimer AAS4
Gui,2:Add,Text,c%textcolor% x10 y10 ,URL1
Gui,2:Add,Text,c%textcolor% x10 y40 ,URL2
Gui,2:Add,Text,c%textcolor% x10 y70 ,FILENAME
Gui,2:Add,Text,c%textcolor% x10 y100 ,NAME
Gui,2:Add,Text,c%textcolor% x10 y130 ,PROCESS
Gui,2:Add,Text,c%textcolor% x10 y160 ,PROGRESS
Gui,2:Add,Text,c%textcolor% x10 y190 ,STATUS
Gui,2:Add,Text,c%textcolor% x10 y220 ,SAVE TO
Gui,2:Add,Text,c%textcolor% x10 y250 ,SEARCH
;------- for test --------------------------------------------------------------
;ALCC=http://www.youtube.com/watch?v=DJZv_U0zGGI ;Ek verlang na jou
;ALCC=http://www.youtube.com/watch?v=3ujBjUriUjI ;jim reeves
;ALCC=http://www.youtube.com/watch?v=WR59yE0w2P8 ;Solidao
;ALCC=http://www.youtube.com/watch?v=zlfKdbWwruY ;fmt=22 Matt
;ALCC=http://www.youtube.com/watch?v=Zd8f9Zqap6U ;US elect
;ALCC=http://www.youtube.com/watch?v=wUPcimeiqLE ;fmt=22 big buck bunny 720p
;ALCC=http://www.youtube.com/watch?v=kRTZoHTK608 ;Yao Lee
;ALCC=http://www.youtube.com/watch?v=n9l3bX-xWxQ ;SULLE SALAISUUDEN KERTOA M VOISIN
;ALCC=http://www.youtube.com/watch?v=SH6wgK-A6Q8 ;Molbavello Dhou Goa India
;ALCC=http://www.youtube.com/watch?v=QA7euN0KgWk ;Lee Hsiang Lan / Li Xiang Lan / Shirley Yamaguchi / Yoshiko Otaka
ALCC=http://www.youtube.com/watch?v=IHzIItZKmD8 ;Ye Lai Xiang
;---------------------------------------------------------------------------------
Gui,2:Add,Edit,c%editcolor% x100 y10 h20 w400 vEditYoutube ,%ALCC% ;EDIT YOUTUBE
Gui,2:add,button, x100 y10 w0 default gDOWNLOAD1,
Gui,2:Add,Edit,c%editcolor% x100 y40 h20 w510 vURL2 Readonly ,
Gui,2:Add,Edit,c%editcolor% x100 y70 h20 w510 vAL1 Readonly ,
Gui,2:Add,Edit,c%editcolor% x100 y100 h20 w510 vNAME1 Readonly ,
Gui,2:Add,Edit,c%editcolor% x100 y130 h20 w510 vPROCESS11 Readonly ,
Gui,2:Add,Progress, x100 y160 h20 w510 vPRBAR cFF7200
;Gui,2:Add,Text, x100 y162 w510 +0x200 +Center +BackgroundTrans vText22,
Gui,2:Add,Edit,c%editcolor% x100 y190 h20 w50 vText22 Readonly , ;procent
Gui,2:Add,Edit,c%editcolor% x160 y190 h20 w450 vText23 Readonly , ;size / name
Gui,2:add,text, c%textcolor% x295 y290 ,FMT=
Gui,2:Add,Edit, c%editcolor% x330 y290 h20 w40 vFMTX Readonly ,
;--------------------------------------------------------------
Gui,2:Add,Edit,c%editcolor% x100 y220 h20 w510 vREC ,%REC% ;for test
;--- for test ---
AAX1=Jim Reeves
Gui,2:Add,Edit,c%editcolor% x100 y250 h20 w280 vSRCH1 ,%AAX1% ;for test
Gui,2:Add,Button, x400 y250 h20 w100 gYOUTUBE ,>YOUTUBE
Gui,2:Add,Button, x510 y250 h20 w100 gFolder1 ,RECORDED
ifexist,%MP3extract%
Gui,2:Add,Button, x510 y280 h20 w100 gEXTRACTMP3 ,EXTRACTMP3
Gui,2:Add,Button, x510 y310 h20 w100 gReload1 ,Reload
Gui,2:add,text, c%textcolor% x10 y320 ,When download finished
;------------------------------------------------------------------------------------
IniRead,VID1, %YOUTUBEMP4INI% ,Startvideo , KEY1
IniRead,BEEP1, %YOUTUBEMP4INI% ,Beep , KEY1
if VID1=0
Gui,2:Add,CheckBox,c%textcolor% x200 y320 vVID1 gVID1A ,Run Video
else
Gui,2:Add,CheckBox,c%textcolor% checked x200 y320 vVID1 gVID1A ,Run Video
if BEEP1=0
Gui,2:Add,CheckBox,c%textcolor% x330 y320 vBEEP1 gBEEP1A ,Beep
else
Gui,2:Add,CheckBox,c%textcolor% checked x330 y320 vBEEP1 gBEEP1A ,Beep
;------------------------------------------------------------------------------------
F21=%A_scriptdir%\youtubelog.txt
T1 :=100
T2 :=420
T3 :=50
T4 :=0
T5 :=0
T1A:=T1
T2A:=T1+T2
T3A:=T1+T2+T3
T4A:=T1+T2+T3+T4
T5A:=T1+T2+T3+T4+T5
LSW:=T1+T2+T3+T4+T5+20
GSW:=LSW+30
Gui,2:Font, S12 CDefault, Verdana
Gui,2:Add, ListView, x10 y350 grid r14 w%LSW% +hscroll altsubmit vA1 gA2,Member| < Start > Youtube|DNL|URL2|DATE
Gui,2:Font, CDefault, FixedSys
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
LV_ModifyCol(5,T5)
gosub,filllist1
Gui,2:add,text, c%textcolor% x10 y650 vLINES1 ,Links= %I%
gosub,DDDD
settimer,DDDD,1300
YTB1=YOUTUBE
Gui,2:Show, x0 y0 h670 w%GSW% ,%YTB1% [100]
return
;-------------------------------------------------------------------
EXTRACTMP3:
Gui,2: Show,minimize ;minimize screen
run,%MP3extract%
ifexist,%rec%
run,%rec%
return
VID1A:
Gui,2:submit,nohide
if VID1=0
IniWrite,0, %YOUTUBEMP4INI% ,Startvideo , KEY1
else
IniWrite,1, %YOUTUBEMP4INI% ,Startvideo , KEY1
return
BEEP1A:
Gui,2:submit,nohide
if BEEP1=0
IniWrite,0, %YOUTUBEMP4INI% ,BEEP , KEY1
else
IniWrite,1, %YOUTUBEMP4INI% ,BEEP , KEY1
return
MH11:
ifexist,%MP3extract%
run,%MP3extract%
else
goto,MP3CONVERTER
return
MH12:
run,http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
return
MH13:
run,http://www.dvdvideosoft.com
return
;------------------------------------------------------------------------
folder1:
run,%rec%
return
reload1:
reload
return
;-------------------------------------------------------------------
filllist1:
Gui,2:default
Gui,2:ListView,A1
I=0
LV_Delete()
loop,read,%F21%
{
LR=%A_loopreadline%
if LR=
continue
I++
stringsplit,C,LR,`;
SplitPath,C2, name9, dir9, ext9, name_no_ext9, drive9
LV_Add("",C1,name9,C3,C4,C5)
C1=
C2=
C3=
C4=
C5=
}
LV_Modify(LV_GetCount(), "Vis") ;goto last position
return
;------------------ LISTVIEW --------------------------------------
A2:
Gui,2: Submit, NoHide
Gui,2:ListView,A1
RN:=LV_GetNext("C") ;2 selected checked
RF:=LV_GetNext("F") ;2 selected focused
GC:=LV_GetCount() ;4 total
if A_GuiEvent=Normal
{
if (RN="" OR RN=0)
return
C1=
C2=
C3=
C4=
C5=
MouseGetPos,x,y
{
if x<%T1A%
{
LV_GetText(C1,A_EventInfo,1)
run,http://www.youtube.com/user/%C1%&view=videos
return
}
if x<%T2A%
{
LV_GetText(C3,A_EventInfo,3)
run,%C3%
return
}
if x<%T3A%
{
LV_GetText(C3,A_EventInfo,3)
GuiControl,2:Text,EditYoutube,%C3%
GuiControl,2:Focus,EditYoutube
send,{enter}
return
}
}
}
return
;--------------------------------------------------------------------------------
;================= SETTIMER =====================================================
DDDD:
Gui,2:submit,nohide
StringRight, REC_, REC, 1
if REC_ <> \
{
IniWrite,%REC%, %YOUTUBEMP4INI% ,Settings, SaveTo
IfNotExist, %REC%
FileCreateDir, %REC%
}
else
{
StringTrimRight, REC, REC, 1
IniWrite,%REC%, %YOUTUBEMP4INI% ,Settings, SaveTo
IfNotExist, %REC%
FileCreateDir, %REC%
GuiControl,2:Text,REC,%REC%
}
URL11=%clipboard%
stringmid,URL11,URL11,1,60
if URL11 contains watch?v=
goto,start2
stringmid,URL1aa,URL11,1,25
if URL1aa=http://www.youtube.com/v/
{
stringright,STRRR,URL11,11
URL11=http://www.youtube.com/watch?v=%STRRR%
goto,start2
}
return
;---------------------------
START2:
Gui,2:Show, x0 y0 h650 w%GSW% ,
GuiControl,2:Text,EditYoutube,%URL11%
clipboard=
settimer,DDDD,off
gosub,DOWNLOAD1
edityoutube=
URL2=
settimer,DDDD,ON
return
;====================================================================================
YOUTUBE:
Gui,2: Show,minimize
GuiControlGet, SRCH1
stringreplace,SRCH1,SRCH1,%S%,`%20,all
run,http://www.youtube.com/results?search_query=%SRCH1%&search=Search
return
;====================================================================================
;============================== YOUTUBE ==================================
;------------------------------ GETTITLE and 2nd-URL ----------------------
DOWNLOAD1:
Gui,2:submit,nohide
Guicontrolget,EditYoutube,2:
if EditYoutube contains youtube.com/watch?v=
URL1=%EditYoutube%
if URL1=
return
if URL1 not contains youtube.com/watch?v=
return
GuiControl,2:Text,process11,
WinSetTitle,%YTB1% [100], ,%YTB1% [0]
GuiControl,2:,PRBAR,%nothing%
GuiControl,2:,Text22,%nothing%
GuiControl,2:,Text23,%nothing%
URL2=
TITLE=
new2=
F1 =%A_scriptdir%\YTB1.txt
ifexist,%F1%
filedelete,%F1%
GuiControl,2:Text,PROCESS11,Start Download
UrlDownloadToFile,%URL1%,%F1% ;<<<<<<<<<<<<<<<<
GuiControl,2:Text,PROCESS11,Search for name
Fileread,AA,%F1%
stringreplace,AA,AA,%TEN%,%CF%,all
filedelete,%F1%
Fileappend,%AA%`r`n,%F1%
;var isHDAvailable = true;
;var pageVideoId = 'hzpcZaI6NuE';
;var pageVideoSearchQueryStr = 'Shirley Yamaguchi Yoshiko Li Hsiang Lan';
;var embedUrl = 'http://www.youtube.com/v/hzpcZaI6NuE&hl=en&fs=1';
;var fullscreenUrl = '/watch_fullscreen?fs=1&vq=None&video_id=kRTZoHTK608&l=174&sk=uysg2FclE8_ZjhYckv1mvKCVcyrptrJuC&fmt_map=&t=OEgsToPDskIFTv2t2sDGJ2yVW50i1pIN&hl=en&plid=AAReRAmSPRTkjCpaAAACgAAQAAA&sdetail=f%253Arelated%252C&title=『跟 開玩笑』~ 姚莉 【Yao Lee】';
CONTEN=var fullscreenUrl =
;---- HQ --------------------------------
HD4=0
SEARCHFOR=var isHDAvailable = true
Loop,Read,%F1%
{
if A_LoopReadLine contains %SEARCHFOR%
{
HD4=1
break
}
}
;------------------------------------------
USERNAME2=
Q2=
; var watchUsername = 'hsianggelilah';
SEARCHFOR=var watchUsername
Loop,Read,%F1%
{
LR=%A_LoopReadLine%
if LR contains %SEARCHFOR%
{
Loop, Parse,LR ,`',`
{
Q%A_Index% := A_LoopField
if Q2<>
break
}
}
if Q2<>
break
}
USERNAME2=%Q2%
; <title>YouTube - Susan Fuentes: Kanhi Ako Pinangga (Visayan Folksong)</title>
; <meta name="title" content="Susan Fuentes: Kanhi Ako Pinangga (Visayan Folksong)">
;------------- TITLE NAME ------------------
SEARCHFOR=<meta name="title" content=
Loop,Read,%F1%
{
LR=%A_LoopReadLine%
if LR contains %SEARCHFOR%
{
stringmid,LR2,LR,29,200
title=%LR2%
stringreplace,TITLE,TITLE,">,%nothing%,all
title=%title%
stringreplace,TITLE,TITLE,`&`;quot`;,%S%,all ;`"
stringreplace,TITLE,TITLE,`&`;amp`;,%S%and%S%,all ;`&
;stringreplace,TITLE,TITLE,title=,%nothing%,all
stringreplace,TITLE,TITLE,`',%nothing%,all
stringreplace,TITLE,TITLE,`;,%nothing%,all
; ---- replace at least portuguese letters --
stringreplace,TITLE,TITLE,",%S%,all
stringreplace,TITLE,TITLE,quot,%S%,all
;stringreplace,TITLE,TITLE,",%S%,all
stringreplace,TITLE,TITLE,&,%S%,all
;stringreplace,TITLE,TITLE,-,%S%,all
stringreplace,TITLE,TITLE,,c,all
stringreplace,TITLE,TITLE,,e,all
stringreplace,TITLE,TITLE,,e,all
stringreplace,TITLE,TITLE,,n,all
stringreplace,TITLE,TITLE,,a,all
stringreplace,TITLE,TITLE,ç,c,all ;
stringreplace,TITLE,TITLE,ã,a,all ;
stringreplace,TITLE,TITLE,ö,oe,all ;
stringreplace,TITLE,TITLE,é,e,all ;
stringreplace,TITLE,TITLE,,a,all ;
break
}
}
TITLE=%title%
t=
video_id=
sk=
hl=
plid=
;vq=
HSS=
HSS2=
;SEARCHFOR=video_id=,l=,sk=,t=,hl=,plid=,fmt_map=,tk=,iv_storage_server=,vq=
SEARCHFOR=video_id=,l=,sk=,t=,hl=,plid=
Loop,Read,%F1%
{
LR=%A_LoopReadLine%
ifinstring,LR,%CONTEN%
{
Loop, Parse,LR ,`&,`
{
H%A_Index% := A_LoopField
if H%A_Index% contains %searchfor%
T%A_Index%:=A_LoopField
if T%A_Index%<>
HSS=%HSS%%A_LoopField%&
;if A_loopfield contains title=
; TITLE=%A_LoopField%
if A_loopfield contains t=
t=%A_LoopField%
if A_loopfield contains video_id=
video_id=%A_LoopField%
if A_loopfield contains sk=
sk=%A_LoopField%
if A_loopfield contains hl=
hl=%A_LoopField%
if A_loopfield contains plid=
plid=%A_LoopField%
H%A_Index%=
T%A_index%=
}
break
}
}
;stringlen,L5,HSS
;END5:=(L5-1)
;stringmid,HSS2,HSS,1,END5
HSS2=%video_id%&%t%&%sk%&%hl%&%plid%
URL2a=http://www.youtube.com/get_video?%HSS2%
URL2=http://www.youtube.com/get_video?%HSS2%
ADD1=
;-------------------------------------------
if HD4=1
{
URL2=%URL2a%&fmt=22
ADD1=&fmt=22
GuiControl,2:Text,FMTX,22
}
else
{
URL2=%URL2a%&fmt=18
ADD1=&fmt=18
GuiControl,2:Text,FMTX,18
}
;--------------------------------------------
GuiControl,2:Text,URL2,%URL2%
; --- in name should be removed all special characters
gosub,removechr
SplitPath,F2, name7, dir7, ext7, name_no_ext7, drive7
GuiControl,2:Text,AL1,%REC%\%F2%
GuiControl,2:Text,name1,%name7%
;-----------------------------------------------------------------------------------
;-------------------------- DOWNLOAD YOUTUBE VIDEO ---------------------------------
DOWNLOAD2:
if URL2=
{
msgbox,262208,TEST, YOUTUBE URL to download is missing
WinSetTitle,%YTB1% [0], ,%YTB1% [100]
settimer,DDDD,1000
return
}
;---------------------------------------------------------------------------------------
continue5:
SIZE3=
SIZE3:=HttpQueryInfo(URL2,5) ;<<< check size from new URL2 adress
if size3=timeout
{
{
URL2=%URL2a%
ADD1=
GuiControl,2:Text,FMTX,
goto,continue5
}
ENDED1:
AFC=0
settimer,AAS4,OFF
msgbox, 262208, Youtube download,Download not possible
GuiControl,2:Text,EditYoutube,
GuiControl,2:Text,AL1,
GuiControl,2:Text,name1,
GuiControl,2:Text,URL2,
return
}
AFC=0
settimer,AAS4,500
GuiControl,2:Text,PROCESS11,Download
GuiControl,2:+RANGE0-%SIZE3%,PRBAR ;CHANGE processbar
GuiControl,2:,Text23,SIZE=%SIZE3%
URL2b=%URL2%
; Splashimage,,b w%WA% h50 x0 Y400 CWsilver m9 b fs10 zh0,Size=%size3%`n%URL2%
;----------------------------------------------------------------------------------------
URLDownloadToFile,%URL2%,%REC%\%F2% ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------------------
; sleep,500
; Splashimage, off
;------- write logfile -------------------------------------------------------------------
stringmid,ANOW7,A_NOW,1,12
Loop, Parse,URL1 ,`&,`
{
H%A_Index% := A_LoopField
if H1<>
URL1NEW=%H1%
}
;-----------------------------------------------------------------------------------------
settimer,AAS4,off
AFC=0
SIZE3:=HttpQueryInfo(URL2,5)
if size3=-1
{
msgbox, 262180, Youtube download,Error size=-1`nTry again ?
ifmsgbox,no
return
else
{
GuiControl,2:Text,FMTX,
goto,download1
}
}
Filegetsize,size7,%REC%\%F2%
if size7<500
{
GuiControl,2:Text,PROCESS11,NO SUCCESS try again maybe use FMT=18 OR LOW
GuiControl,2:,Text22,0 `%
}
else
{
GuiControl,2:Text,EditYoutube,
GuiControl,2:Text,PROCESS11,Download finished
GuiControl,2:,Text22,100 `%
Fileappend,%USERNAME2%;%REC%\%F2%;%URL1NEW%%ADD1%;%URL2b%;%ANOW7%`r`n,%F21%
}
GuiControl,2:,PRBAR, %SIZE3%
;GuiControl,2:,Text22,100 `% %name1% SIZE=%SIZE3%
GuiControl,2:,Text23,%name7%
WinSetTitle,%YTB1% [%RES2%], ,%YTB1% [100]
GuiControl,2:Text,AL1,
GuiControl,2:Text,name1,
GuiControl,2:Text,URL2,
gosub,filllist1
GuiControl,2:Text,LINES1,Links= %I%
IniRead, VID1 , %YOUTUBEMP4INI% ,Startvideo , KEY1
IniRead,BEEP1, %YOUTUBEMP4INI% ,Beep , KEY1
if BEEP1=1
SoundBeep,400,150
;---------- should Start video (?) -------------------
if VID1=0
return
else
{
ifexist,%REC%\%F2%
run,%REC%\%F2% ;run video when download finished
return
}
return
;--------------------------------------------------------------------------
;---------- GOSUB remove special characters from video name ----------------------
REMOVECHR:
autotrim,off
new2=
Loop,Parse,TITLE
{
A:=(Asc(A_LoopField))
B:=chr(a)
if (B="_" OR B=" " OR B="-") ;allow _space autotrim,off
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
stringmid,ANOW1,A_NOW,1,12 ;if not readable chinese...
anow1=%anow1%
new2=%new2%
if new2=
{
if ADD1<>
new3=_%ANOW1%.mp4
else
new3=_%ANOW1%.flv
F2=%new3%
return
}
if ADD1<>
new3=%new2%.mp4
else
new3=%new2%.flv
F2=%new3%
ifexist,%REC%\%F2%
F2=_%ANOW1%_%F2%
return
;======================== END YOUTUBE ============================================
;================= GOSUBS ==================================
AAS4:
Filegetsize,size1,%REC%\%F2%
if AFC=0
{
if size1>500
{
AFC=1
sleep,2000
Gui,2: Show,minimize ;minimize screen
}
}
RES1:=Round((100*SIZE1)/SIZE3)
GuiControl,2:,PRBAR, %SIZE1%
;GuiControl,2:,Text22,%RES1% `% SIZE=%SIZE3%
GuiControl,2:,Text22,%RES1% `%
Guicontrolget,text3 ;<< 1-99
WinSetTitle,%YTB1% [%RES2%], ,%YTB1% [%RES1%]
RES2=%RES1%
Text4=%Res2%
GuiControl,2:Text,TEXT3,%text4%
return
;================ END AAS4 =================================
;================= DOWNLOAD http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe ===================
MP3CONVERTER:
{
text31=
(
If you want convert downloaded video to MP3
needs FreeVideoToMp3Converter.exe
Download
from
http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
Want you download this program ?
)
msgbox, 262180, Start URL,%text31%
ifmsgbox,NO
exitapp
else
{
run,http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
exitapp
}
}
return
;============================================================================
2Guiclose:
Gui,2:submit,nohide
;ifexist,%F1%
; filedelete,%F1%
exitapp
esc::exitapp
;-------------------------- FUNCTION GETSIZE before download -------------------------
;http://www.autohotkey.com/forum/topic10510.html
; Olfen PhiLho
;SIZE:=HttpQueryInfo(URL, 5)
;msgbox,262144,MESSAGE,SIZE = %SIZE% Byte
/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
QueryInfoFlag:
HTTP_QUERY_RAW_HEADERS = 21
Receives all the headers returned by the server.
Each header is terminated by "\0". An additional "\0" terminates the list of headers.
HTTP_QUERY_CONTENT_LENGTH = 5
Retrieves the size of the resource, in bytes.
HTTP_QUERY_CONTENT_TYPE = 1
Receives the content type of the resource (such as text/html).
Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp
Proxy Settings:
INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
; Examples:
; url1 = http://www.autohotkey.com
; url2 = http://www.autohotkey.com/download/AutoHotkeyInstall.exe
; MsgBox % HttpQueryInfo(url1)
; MsgBox % HttpQueryInfo(url2, 5)
; MsgBox % HttpQueryInfo(url2, 1)
USAGE=
Example for size:
#Include dlfilesize.ahk
;------ Jim reeves Mexican Joe ----
url=http://www.youtube.com/watch?v=YSx_kgXQJDg
SIZE:=HttpQueryInfo(URL, 5)
MsgBox,64,Info,Dateigre = %SIZE% Byte
*/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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
}
;------------------------------------------------------------------
|
|
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Wed Aug 12, 2009 6:21 pm Post subject: |
|
|
WankaUSR
| Quote: | Added some minor modifications like
selection of the save to folder because i use the script compiled on my work pc |
thank you WankaUSR
so it's easier (editfield) to change the folder where to save
I will change it like you suggested
(in the sript predefined as (example) c:\_RECORDED1 ) |
|
| Back to top |
|
 |
mtman1020
Joined: 08 Aug 2008 Posts: 36
|
Posted: Thu Oct 22, 2009 10:01 pm Post subject: |
|
|
Garry,
Looks like it needs fixing again.
Could you tell me what codec it uses to make FLV files? I run Linux at home and don't know what codec I'm missing to play them. (MP4 works fine) Here is an example of a video I downloaded and works fine on most computers but not my home PC: http://www.youtube.com/watch?v=ep7W89I_V_g
B.T.W. I like this a lot better than the VidRipper because VidRipper is just so much more than I need. I love the simplicity of this.
Thanks again for keeping this running for us!!  |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Fri Oct 23, 2009 7:53 am Post subject: |
|
|
hello mtman1020,
thank you , modified script, works now
youtube changes ~ all 2 months, maybe I have no solution ...
I used vlc.exe to play all videos (extensions always open with ... vlc.exe )
http://www.videolan.org/ (vlc.exe)
if you don't want to have flv files (fmt=35) [ get FMT=18 / MP4 instead ], so block this part from script with /* */
in lines 668-687 =
;------------ try to search fmt=35 ------------- |
|
| Back to top |
|
 |
mtman1020
Joined: 08 Aug 2008 Posts: 36
|
Posted: Mon Oct 26, 2009 3:19 pm Post subject: |
|
|
Thanks Garry,
I use VLC at home and at work, they play fine at work (probably because VLC automatically updates with the internet connection) but won't play at home.
I found w64codecs_20071001-0.3_amd64.deb, I'll try it tonight.... |
|
| Back to top |
|
 |
vasu Guest
|
Posted: Thu Jul 15, 2010 2:49 pm Post subject: |
|
|
| garry wrote: | thank you ..:: Free Radical ::..
modified script
;---- DOWNLOADS YOUTUBE FLV or MP4 with right name (2nd with MP3converter ) -----
;---- automatically select best quality or define fmt=0/18/22 ------------------
examples ( size )
| Code: |
http://www.youtube.com/watch?v=zlfKdbWwruY
FMT=22 75320 kB mp4 ( high quality )
FMT=18 20784 kB mp4 ( high quality )
FMT= 11295 kB flv
|
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|