Results 1 to 20 of 22

Thread: Downloading a video from youtube

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Downloading a video from youtube

    When I follow the link you pasted using the browser, I get a blank page.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Downloading a video from youtube

    It doesn't work for me either. Maybe when Faster posts a link that works, we can help him

  3. #3
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a video from youtube

    The link doesn't work because is session-sensitive. Here I told that I have written a code that generates a link to download an mp4 file from youtube. So i can't post a link that works! The problem is that I can download this video with Firefox but not with qhttp!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Downloading a video from youtube

    Maybe the reason is that you are logged in to youtube in firefox and not when using QHttp?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a video from youtube

    I'm not logged to youtube with firefox! I also tried to download the generated link with the qt4's http example (in examples/network/http) but this program downloads the same redirection page and not the video!

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Downloading a video from youtube

    Why don't you take a network sniffer and compare the traffic that goes from firefox to youtube and from your application to youtube and tell us what the difference is? Right now we're trying to guess some reasons with you only telling us "it works with firefox". We already know that, you don't have to repeat yourself. Or give us a working download link or tell us how to get one.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a video from youtube

    I'm posting my current project! This program generates a link to download a video from youtube that works. Click on the "Start download" and paste the generated url on a browser. The url should work!

    The link work also with other browsers!
    Attached Files Attached Files
    Last edited by Faster; 27th November 2009 at 21:38.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Downloading a video from youtube

    Ok, I've tried it. The browser downloads the mp4 file.

    HOWEVER, The browser gets a redirect page exactly the same as your program does. In fact, it gets two:

    http://youtube.com/get_video?video_id=...
    REDIRECTED TO: http://www.youtube.com/get_video?video...
    REDIRECTED TO: http://v15.lscache4.c.youtube.com/...

    Which makes perfect sense. You request a video, and the server redirects your browser to the least loaded server to provide you with that video.

  9. The following user says thank you to squidge for this useful post:

    Faster (28th November 2009)

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Downloading a video from youtube

    Which also means that if you used QNetworkAccessManager, you would probably instantly get the proper output - as far as I remember QNetworkAccessManager handles redirects by itself. If not, you need to handle them yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #10
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a video from youtube

    Thanks a lot fatjuicymole and wysota! I don't understand how redirects works so I don't know how I can modify my program to manage redirects with qhttp... If QNetworkAccessManager handles redirects by itself, where can I find some examples about downloading with QNetworkAccessManager?

  12. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Downloading a video from youtube

    Quote Originally Posted by Faster View Post
    Thanks a lot fatjuicymole and wysota! I don't understand how redirects works so I don't know how I can modify my program to manage redirects with qhttp...
    http://en.wikipedia.org/wiki/URL_redirection
    If QNetworkAccessManager handles redirects by itself, where can I find some examples about downloading with QNetworkAccessManager?
    In the docs.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #12
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Downloading a video from youtube

    Ok I will try with QNetworkAccessManager. Thanks for helping me!

  14. #13
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Downloading a video from youtube

    Quote Originally Posted by Faster View Post
    The link doesn't work because is session-sensitive. Here I told that I have written a code that generates a link to download an mp4 file from youtube. So i can't post a link that works!
    Fine, ok. Instead of posting a working link, post the code to your program that creates a working link so we can create our own (and what was the point of posting the link in your first message if you knew it wouldn't work for anyone else?)

    You may also wish to delete all off-line data from your browser, or maybe even install a different browser to check if your link works there. You may find it doesn't work until you have visited and logged into the site.

Similar Threads

  1. open a video file in a new window...
    By jiapei100 in forum Qt Programming
    Replies: 0
    Last Post: 19th September 2009, 14:53
  2. Replies: 3
    Last Post: 5th July 2009, 17:22
  3. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 08:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.