Hi guys.
I just wanted to share my code with you. As I like functions more than Gosub Labels or just the complete code in my main file, I have created this functions:
*see below
This could easily be improved by splitting up the functions even more to return just the html file, so it can be used for getting the title and the download links and does not have to be downloaded again.
Another function which might be useful would be to return the list of all available fmt values for this video with their corresponding urls, so you can easily parse them.
YouTube MP4 download & convert video to MP3
Started by
garry
, Aug 21 2008 09:15 PM
152 replies to this topic
#76
-
Posted 21 March 2011 - 11:41 PM
Is this complete code to download YT, cuz it didn't work with my AHK basic? :?:
#77
-
Posted 21 March 2011 - 11:52 PM
I just tried to download some YTs but I get error messages: URL not found! :shock: It seems YT has done something to prevent download using this script? :?: I tried several URLs ... Can someone confirm this? :?:
#78
-
Posted 25 March 2011 - 09:28 AM
hi bruno,
added this, works now
.. but I think I'm not able always to run script
free mozilla firefox addon
<!-- m -->http://www.downloadh...r.net/index.php<!-- m -->
<!-- m -->http://www.downloadh... ... conversion<!-- m -->
Freeware:
<!-- m -->http://www.dvdvideos... ... wnload.htm<!-- m -->
--------------------
@flashkid
thank you for the function
I didn't realized to remove all special characters in title yet
didn't understand how to use the function >> YTDownloadURL(URL,fmt)
added this, works now
gosub,titlesearch ;-- >>>>>>>>>> ;msgbox,Title=%title%`nVideoid=%videoid%`nUsername=%username% stringreplace,hss,hss,%xx2%,,all ;-- "fmt_url_map": stringreplace,hss,hss,",,all stringreplace,hss,hss,%s%,,all stringreplace,hss,hss,\/,/,all stringreplace,hss,hss,\,&,all stringreplace,hss,hss,u0026,,all
.. but I think I'm not able always to run script
free mozilla firefox addon
<!-- m -->http://www.downloadh...r.net/index.php<!-- m -->
<!-- m -->http://www.downloadh... ... conversion<!-- m -->
Freeware:
<!-- m -->http://www.dvdvideos... ... wnload.htm<!-- m -->
--------------------
@flashkid
thank you for the function
I didn't realized to remove all special characters in title yet
didn't understand how to use the function >> YTDownloadURL(URL,fmt)
#79
-
Posted 25 March 2011 - 08:26 PM
Thanks, garry! Added in the following location, but didn't work! :shock:
stringreplace,hss,hss,%xx2%,,all ;-- "fmt_url_map": stringreplace,hss,hss,",,all stringreplace,hss,hss,%s%,,all stringreplace,hss,hss,\,,all ; Added on 032511. stringreplace,hss,hss,\/,/,all stringreplace,hss,hss,\,&,all stringreplace,hss,hss,u0026,,all
#80
-
Posted 25 March 2011 - 08:37 PM
I am also not very excited about downloading these huge downloaders (15MB +). :shock: Your script was small and perfect for my intended uses. :lol:
#81
-
Posted 25 March 2011 - 08:51 PM
sorry bruno, forget to mention , one line removed , see above again
( if you copy the script at first page should also work )
( if you copy the script at first page should also work )
#82
-
Posted 25 March 2011 - 08:54 PM
I updated my function as well.
This is a working example of downloading a youtube video: *see below
@garry:
What didn't you understand?
This is a working example of downloading a youtube video: *see below
@garry:
What didn't you understand?
#84
-
Posted 26 March 2011 - 10:51 AM
thank you flashkid for the very small script, works fine !
httpquery.ahk :
<!-- m -->http://www.autohotke... ... highlight=<!-- m -->
I didn't understand how to use function and how really works ( I'm working with gwbasic -style ... grrr )
maybe just missing how to select available quality (fmt)
usually I download best quality ( but not HD ( fmt=37) , video not runs well with my netbook )
httpquery.ahk :
<!-- m -->http://www.autohotke... ... highlight=<!-- m -->
I didn't understand how to use function and how really works ( I'm working with gwbasic -style ... grrr )
maybe just missing how to select available quality (fmt)
usually I download best quality ( but not HD ( fmt=37) , video not runs well with my netbook )
#85
-
Posted 26 March 2011 - 01:29 PM
I don't like labels, I put everything possible into functions, because the variables are only known to the functions until you declare them as global. This is a big improvement if you write very long scripts with many variables.
It would be easy to write a function that extracts all available qualities and returns them in a pipe-delimited list or something similar, maybe I will do this tomorrow.
I do not use the script personally, just wrote this for some friends who want to get the audio tracks from youtube.
It would be easy to write a function that extracts all available qualities and returns them in a pipe-delimited list or something similar, maybe I will do this tomorrow.
I do not use the script personally, just wrote this for some friends who want to get the audio tracks from youtube.
#86
-
Posted 26 March 2011 - 01:40 PM
@flashkid
thank you flashkid ...... just wrote this for some friends ...
#87
-
Posted 26 March 2011 - 01:51 PM
It's me again. I have rewritten my functions to be a complete "Youtube library".
Have a look: YTLib.ahk
Example #1: Download a file with a given quality
Example #2: Download all possible qualities with correct file extensions
There is also a documentation available: YTLib Documentation
Have a look: YTLib.ahk
Example #1: Download a file with a given quality
Example #2: Download all possible qualities with correct file extensions
There is also a documentation available: YTLib Documentation
#88
-
Posted 26 March 2011 - 05:15 PM
I presume you need AHK_L for flashkid's script? :?: :lol:
#89
-
Posted 26 March 2011 - 05:26 PM