1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Downloading YouTube Videos

Discussion in 'Technology Advice' started by Markham, Dec 27, 2012.

  1. Markham
    Offline

    Markham Guest

    You know how it is ... you're given the YouTube address for a must-watch video only and the dammed thing pauses every few seconds whilst it buffers-up the next bit. That happens a lot here and I've also encountered this problem in the UK where I have an 8Mbit BT connection. There are browser extensions - and third-party applications - that overcome this by downloading the video to your hard drive. But guess what - they are all broken thanks to radical changes to the format YouTube is in the process of rolling-out.


    Well not quite all.


    I've written a small program (in C#, in case you wanted to know) which is working splendiforously and it has a couple of major enhancements that I've not seen in other YouTube download offerings. Firstly, it attempts to give you a choice of all the various versions YouTube has on its servers - in terms of file type (WebM, Flash Video, MPEG-4 and 3GP) and resolutions (potentially up to 1280x720). And secondly you can convert the downloaded file into the correct format for a wide range of hand-held devices (mostly Apple and Android, it has to be said) but only if you choose to download a FLV (Flash Video) variant. (It is technically possible to convert WebM to MPEG-4 for portable devices but it's very slow and the quality is not the best, so, for now, it's disabled. In any case all Android-based tablets, as well as the later Apple ones, support WebM natively. Flash to MPEG-4 works well however.)


    The program, imaginatively called "YouTube Downloader" is available for download on the Philippine partner to British Filipino but if you can't bring yourself to venture over to the "sunny side", you can download it from this link (8 Mb). It runs under Windows (XP and later) and is absolutely free.


    It's very simple to use, mouse-over the various controls for help, and when you've installed it, copy-paste this ID /kpZhZAr1cQU into the "YouTube URL" box (make sure you include the leading slash character). Provided you are male and still warm, you won't be disappointed!


    Enjoy my Christmas present to you all.
    Last edited by a moderator: Dec 27, 2012
  2. Methersgate
    Offline

    Methersgate Well-Known Member Lifetime Member

    Thanks! That is really useful! Happy New Year!
  3. Aromulus
    Offline

    Aromulus The Don Staff Member

    I have been trying to get a short 3 minute clip on Youtube but everytime I open it after uploading, there is no sound.
    I have uninstalled and re-installed the latest flash player, as recommended in the help section, a couple of times, but still no joy.:(
  4. Kuya
    Offline

    Kuya The Geeky One Staff Member

    I use Google Chrome and there are a few apps that can be used with Chrome (available from the Chrome store) that allow downloading of flash movies such as YouTube and others. Handy for a bad connection!

    Don't use it so much, but I did with WiFi in Manila earlier this year..
  5. Markham
    Offline

    Markham Guest

    If you used a browser plug-in to download the file, there's a good chance that what was downloaded isn't actually a Flash-encoded video at all but the plug-in has assumed it is and therefore saved it as a Flash file (.flv). Those plug-ins download what YouTube tells them is the "default" version and, until quite recently, the "default" version was invariably a Flash-encoded stream. That's no longer the case and it's now a bit of a lottery as to the container-type of the "default" version will be - it could be WebM, MPEG4 or Flash.

    Needless to say my downloader knows all about such things and gives you the choice of downloading the version (aka "quality") you want.
  6. Markham
    Offline

    Markham Guest

    I've just uploaded a new release to our server and as the changes are quite extensive, rather than call it Version 2.02 (indicating a minor release), the new version number is 2.50.

    There is some limited post-processing available - you can rectify any incorrect video Aspect Ratio and also adjust the volume of the audio track. The post-processing options are on the "Download/Conversion/Player" window.

    Also two "history" lists are maintained: the last 20 downloaded videos, in case you need to re-download them for any reason, and also any videos that you weren't able to download are also kept so that you can download them at a later time.

    The download is here.

    Enjoy!
  7. Markham
    Offline

    Markham Guest

    Sometime yesterday (Valentine's Day), YouTube made some changes to its pages' internal structure which effectively broke "YouTube Downloader" - and all the other similar programs and browser plug-ins. Fortunately I noticed it immediately as I was trying to download some cartoons for my son to watch on his (his mother's) iPad and made the necessary changes.

    You can download the latest version from this link and install it; no need to uninstall any previous version.

    There are a number of new cool features including a simple editing facility (cuts and joins), more format conversions and the ability to create the correct files for use in DVD/VCD/SVCD authoring programs. There's also a dedicated browser - based on the Gecko (Firefox) engine - simply navigate to the video you want and click on the "Download" button.

    Enjoy!
    Last edited by a moderator: Feb 15, 2013
  8. Micawber
    Offline

    Micawber Renowned Lifetime Member

    Markham,

    I seem to be having an issue with your program.
    Is this something you can help with?

    When I attempt to start the program I immediately get a window with this message:-

  9. oss
    Offline

    oss Somewhere Staff Member

    Hi Peter, this is a standard .net error it means that either the path to 'C:\Program Files\You Tube Downloader\You Tube Downloader history' does not exist, or the system security restrictions for your user account do not allow reading from and writing to said folder, probably more likely that it does not exist and that the program is not checking for for the folder.

    You can check if the folder exists by pasting "C:\Program Files\You Tube Downloader\You Tube Downloader history" into the windows explorer address bar (without the double quotes) and pressing enter, if it exists it will navigate to the folder if it does not exist you will get an error dialog telling you so.

    Fixable by creating the folder if it does not exist.
  10. Markham
    Offline

    Markham Guest

    Your error message is a little wrong, Peter ;), the last line should read
    This means that the program's configuration file ('.history') has been locked - in all likelihood by a copy of the program still in memory.

    Please try the following:

    1. Position your mouse cursor on a blank space on the Windows Taskbar and click the right mouse button.
    2. Select "Task Manager" from the menu that appears.
    3. Select the "Applications" Tab
    4. If YouTube Downloader is listed, place your mouse cursor over its name and click left mouse button to select it and the click on "Switch To" button which is towards the bottom of the Task Manager's window. The program should now re-appear.
    5. If Step 4 failed, select the "Processes" Tab.
    6. Scroll down until you locate "YouTube Downloader" in the "Image Name" column.
    7. If you find it, select it and click on the "End Process" Button and then on "End Process" button in the confirmation window that will appear.

    Please let me know if that works. What version are you running?


    Mark
  11. Micawber
    Offline

    Micawber Renowned Lifetime Member

    Thanks oss and Markham for some real quick responses. Appreciated

    oss, I created a folder within C:\Program Files\YouTube Downloader named YouTube Downloader.history
    Still I received the same error message.

    Markham, yes sorry I had to type out the message as it wouldn't copy & paste so missed out the all important dot.

    Anyway I followed your suggested instructions but didn't find that it did anything other than close the program.
    Should there be any program within the .history folder?

    I also tried turning off all virus and security programs but still the same message.

    For interest I'm running (trying) YouTube Downloader V3 under Windows Vista Home Premium Service Pack 2
  12. oss
    Offline

    oss Somewhere Staff Member

    I know it is the standard joke in this industry but just to be 100% sure that any previous instance of the program is dead it would be worth a reboot, easier for most folk than trying to kill existing instances.

    Probably best if you undo that advice I gave you earlier Peter, I have not installed Mark's program so I was just responding from the viewpoint of someone who has written code that generates that error.

    When I get home I will spin up a virtual machine and give Mark's program a try.
    • Like Like x 1
  13. Micawber
    Offline

    Micawber Renowned Lifetime Member

    oss, you really are such a gentleman.
    That's very kind of you. Thank you so much.

    It means a lot to me.
    Here's my story:-

    One of my wife's clients had a 100th birthday on Sunday and of course she attented the celebrations.
    I suggested to put all the photo's into a slide-show with some background music.
    We wanted to put the song 'What a Wonderful World' by Louis Armstrong as a background track.
    That's when I discovered the error.

    BTW I finally managed to overcome the issues by other means but it took ages.
    Seems most of the common free YouTube download programs always came back with an error message on security.

    Anyway thank you for your kindness
  14. Markham
    Offline

    Markham Guest

    Peter,

    Your original problem arose because some process running on your computer locked a file that has the name "YouTube Downloader.history" and, based on your report, I asked you to check to see if there was a copy of my program ("YouTube Downloader.exe") resident in your computer's memory.

    Please delete the folder you created and named "YouTube Downloader.history". You can also safely delete any file by that name - it will be recreated the next time you run the program. But as Oss has said, you may need to reboot your PC first to clear any file locks.

    If you are still experiencing problems and you can wait until 12 noon GMT today (Wednesday), I will be releasing Version 4 which includes its own player:

    Player.jpg

    I will post the new download link once I've uploaded it to the server. Once you've downloaded it, you can delete the entire "C:\Program Files\YouTube Downloader" folder and start again with this new - and greatly improved - version.

    If you have any problems, let me know!
  15. Markham
    Offline

    Markham Guest

  16. Micawber
    Offline

    Micawber Renowned Lifetime Member

    I'm not having much luck.

    Any ideas?
  17. oss
    Offline

    oss Somewhere Staff Member

    4.0.4813.30095 is the version number of the program itself, CLR20r3 is the .Net common language runtime.

    Problem Sigs 07 and 08 tell you where the exception happened however you are missing a Stack Trace which would have helped, I'm guessing that the reason it's missing is that the program is protected by the SmartAssembly obfuscator which means that the program's internals have been mangled beyond the point where any sane programmer would try to reverse engineer how it actually works, which is fair enough programmers have to protect their intellectual property rights.

    The app appears to rely on COM Interop so it's possible that it's got a dependency on a component you don't have on your computer although saying that it works fine on Windows XP, the only other thing is that it installs a load of hidden system level files in the LAV and Xulrunner folders which you don't get to see, unless you specifically untick "Hide protected operating system files" in the Windows Explorer 'Folder Options' 'View' tab, so maybe it is either having trouble installing these files hence when it goes looking for them it gets a System.IO.FileNotFoundException or maybe you have a problem with the .Net framework installation on your computer Peter, very hard to tell or to help further as the program is obfuscated and appears to work on other machines.

    Ah I spoke too soon, it's just blown up with exactly the same problem on my testbed virtual machine.
  18. oss
    Offline

    oss Somewhere Staff Member

    Mark it's got a dependency on

    Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

    which I don't have installed on my system and which you probably have "Copy Local" set to false in your project or in your setup project, it would appear that it's an early bound reference hence the reason it blows up in the loader.

    I take back the reference to COM Interop, you just appear to be relying on the some interop with the hidden dll's and javascript stuff in the Xulrunner folder.
    Last edited: Mar 6, 2013
  19. Micawber
    Offline

    Micawber Renowned Lifetime Member

    oss, thank you for your efforts.

    If only I could understand what it all means.............................:eek:
  20. Markham
    Offline

    Markham Guest

    Firstly, thank you Oss for so accurately diagnosing the problem! It was indeed caused by a reference to the PowerPacks file and I had completely overlooked the fact that it was installed on my development machine by Visual Studio. What's weird though is that nobody else has reported this and I know of at least one Expat who uses this program regularly and is most unlikely to have Visual Studio installed.

    I have now removed the reference, recompiled and tested on another machine that has never had Visual Studio on it and it's all working as advertised: the updated link is at the foot of this message.

    The program is developed in C# and uses a component, delightfully called "Leapin' Lizard", which provides Interop with xul which provides the Mozilla "Gecko" web browser object - xul and its support modules are all written in C++ unmanaged code. Now you may be wondering why I'm using an external web browser object rather than the standard managed interface to IE's COM object; the answer is, it's all to do with threads and timing.

    IE's browser object appears to be single-threaded and what I found was this: when a YouTube video page is loaded - one that contains the Flash player - IE processes the links in turn and would wait until the Flash Player had loaded and initialised before continuing processing the remaining links. This meant that none of the video thumbnails would appear until after the Flash Player started and it was then in competition with the IE object for bandwidth. IE would time-out and thus the thumbnails never got loaded. The Gecko browser that replaces it doesn't have this problem as it is multi-threaded and consequently pages load much, much faster. But it comes with a cost - all that "stuff" in the xulrunner folder.

    In fact I'm targeting a fairly early release of Gecko - version 3 to be exact which appeared in November 2011 - and there's a good reason for that. The later releases of the managed code interfaces to Gecko all require Net 4 to be installed whereas the version I'm using targets Net 2 which is included in all OSes from XP on. Many people still on XP - and many of the Expats I talk with are - are unlikely to have Net 4 installed.

    You mentioned that my program has been obfuscated by SmartAssembly which indeed it has been. But that's not the only reason for using SmartAssembly: it also merges and prunes other assemblies that the main assembly relies on, compresses strings and resources thereby reducing the program's load footprint by around 35%. The main assembly does contain some quite sensitive code that I'd rather not be copied by others seeking to produce similar programs.

    YouTube developers do their best to make life difficult for people like me wishing to build downloaders. For every video title hosted on the service, there can be up to 21 versions available and these all differ by container type (MP4, WebM, Flash or 3GP) and resolution; that includes seven 3D stereoscopic variants. Each version has its own unique URL - comprising around 500-600 characters - but these are not provided as simple "href" links, that'd be too easy: they have to be constructed from information contained in a Javascript data block and this is where the fun begins. To construct a URL, we need 3 bits of information extracted from 7 "tags" but these tags aren't given in a pre-defined order, they are shuffled and the end point of each tag differs according to order in the record. That's a recipe for very complex RegEx parsing! Oh and just to add to the fun, each URL has to include a field that's not even in the data block but is located elsewhere in the HTML markup. I've been working with another independent developer and together we have devised a totally generic mechanism which identifies all the variants offered for any given video and should continue to do so if YouTube makes more changes to its markup (which it does quite regularly). That code we want to protect, hence the obfuscation.

    Anyway, here's the link for the updated version which should now work flawlessly.


    Mark

Share This Page