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

Make your own Youtube automator!

Discussion in 'General Programming Chat' started by headspin, Sep 9, 2008.

  1. headspin

    headspin Regular Member

    Joined:
    Jun 3, 2008
    Messages:
    234
    Likes Received:
    140
    Home Page:
    I've been busy the last week or so building an app to download a set of videos of youtube, watermark, and re-upload with given title, description, etc.

    Surprisingly, it's not that hard once you know what APIs to use. In case anyone else wants to try the same thing, here's how the process goes for one video (how to adapt it for several is obvious):

    1) Download video: This is easy. It's just about replacing some stuff in the URL. Google "vb .net download youtube video" and you'll see just how easy this is. If you look on planet-source-code.com, some guy even posted a full working version of a youtube downloader which I copied and used.

    2) Decoding FLV: ffmpeg works wonders, even under Windows. Find the version that's compiled into one 6MB exe file with no external dependencies. Again, Google "download ffmpeg.exe" and it should come up.

    3) Watermarking FLV: This took me a while because ffmpeg's vhook is a pain in the a$$ to get working with cygwin. So I gave up on it and chose to use AviSynth instead. I kicked myself when I realized how easy it was to create an AVS file and dynamically modify it in runtime. And you can feed the AVS file directly to ffmpeg to convert the unwatermarked file to a watermarked video.

    Note: On my machine this whole thing will only work if you encode the FLV to WMV format. MPG leaves out the sound and AVI crashes ffmpeg. I still have no idea why and I don't care since WMV works just as well.

    4) Re-uploading: Use the Y0utube Data API. It's VERY straightforward to use, although you have to be careful with all the formatting requirements for the description and keyword tags (especially keywords) or you'll get some very frustrating 400 errors.

    The great thing about the Y0utube Data API is that you can also use it to search for videos by keyword and order by most viewed etc, so you can automatically select which videos to download, which saves a lot of time.

    .NET also makes it easy to switch between proxies , although I haven't coded this yet because there's nothing bannable about my videos (apart from the blatant copyright infringement :D).
     
  2. dpalat

    dpalat Regular Member

    Joined:
    Aug 14, 2008
    Messages:
    378
    Likes Received:
    69
    Occupation:
    IM
    Location:
    Kramsterdam
    Home Page:
    Did you also code increasing rating and favorite?
     
  3. headspin

    headspin Regular Member

    Joined:
    Jun 3, 2008
    Messages:
    234
    Likes Received:
    140
    Home Page:
    They're both really easy to do actually. You can either use the Google Data API with proxies (there is a proxy object exposed at the interface level of the YoutubeService class), or you can simply look at the source code of a youtube video page and you'll realize that to forge an HTTP request for a rating/favorite isn't that hard. Just remember to use proxies.
     
  4. apekillape

    apekillape Senior Member Premium Member

    Joined:
    Dec 13, 2007
    Messages:
    1,077
    Likes Received:
    1,441
    Occupation:
    Basically, I just walk the Earth.
    Location:
    The Layer Cake
    You have no idea how badly I wish I understood what you're talking about.

    N
     
  5. dpalat

    dpalat Regular Member

    Joined:
    Aug 14, 2008
    Messages:
    378
    Likes Received:
    69
    Occupation:
    IM
    Location:
    Kramsterdam
    Home Page:
    Yes it's easy to do this. Do you code in .net ?
     
  6. dpalat

    dpalat Regular Member

    Joined:
    Aug 14, 2008
    Messages:
    378
    Likes Received:
    69
    Occupation:
    IM
    Location:
    Kramsterdam
    Home Page:
    You can learn programming! Just read books and test...
     
  7. headspin

    headspin Regular Member

    Joined:
    Jun 3, 2008
    Messages:
    234
    Likes Received:
    140
    Home Page:
    Yeah. I do all of my desktop coding in VB .NET and my web coding in PHP. If I needed something really specific that couldn't be done in .NET, I'd code it in C++ or assembly, but that's never happened yet.
     
  8. dpalat

    dpalat Regular Member

    Joined:
    Aug 14, 2008
    Messages:
    378
    Likes Received:
    69
    Occupation:
    IM
    Location:
    Kramsterdam
    Home Page:
    Yes .net rocks but i'm using c# java and c++ syntax.
     
    Last edited: Sep 16, 2008
  9. mrichards1984

    mrichards1984 Regular Member

    Joined:
    Feb 2, 2008
    Messages:
    431
    Likes Received:
    52
    Lolz same here! Can anyone make it sound easier for both of us :p
     
  10. headspin

    headspin Regular Member

    Joined:
    Jun 3, 2008
    Messages:
    234
    Likes Received:
    140
    Home Page:
    Learn a .NET language and it WILL sound easy.

    I am working now on a VB .NET programming class that I hope I will be able to teach here in October. You can find it at

    hxxp://www.blackhatworld.com/blackhat-seo/general-programming-chat/20722-thinking-starting-bh-programming-class.html
     
  11. smokes4life

    smokes4life Regular Member

    Joined:
    Dec 21, 2007
    Messages:
    200
    Likes Received:
    59
    Location:
    Marlboroland :)
    As they say......one man's food is another man's poison. I re-read it about 10 times and I still understand nuts :eek: Sorry dude, I kinda sense you are on to something great here but is it possible to explain it in layman terms :rolleyes:??? Thanks in advance! :p
     
  12. headspin

    headspin Regular Member

    Joined:
    Jun 3, 2008
    Messages:
    234
    Likes Received:
    140
    Home Page:
    The post is intended for programmers, so you probably won't get much out of it if you don't have at least some basic knowledge of a programming language.

    If I can sum the method up in a few words: download video as flv, use ffmpeg to convert it to wmv, use AviSynth to add watermark, use ffmpeg to save the watermarked video, and use the Google Data API to re-upload it.

    You can always hire a freelancer to do the programming for you. This method should be a ride in the park for any professional.