2

i am creating a cross platform mobile app in which i need to download the video from YouTube, when i pass the URL to download the video by file-transfer plugin, its downloading 40 to 50 KB only and showing complete status. so anyone who can help me to download the video from YouTube.

var fileTransfer = new FileTransfer();
                                   var inputUri = encodeURI("https://www.youtube.com/watch?v=iQbBBOL2BBE");



                                   var outputPath = videocreateFileSource1;


                            fileTransfer.download(
                                  inputUri,
                                  outputPath,
                                    function (entry) {

                                },
                                function (error) {

                                    alert("download error: source=" + error.source + ", target=" + error.target + ", error code=" + error.code);
                                });
DK3
  • 403
  • 2
  • 10
  • I think that you are downloading the html page, not the video itself. – Víctor Mar 30 '16 at 13:46
  • if i need to download that video id then how could i do because the whole things is couldn't able to download the video from youtube links, if you can help me, it will be great help – DK3 Mar 31 '16 at 08:56
  • I think this is going to be hard, as google blocks any try to download their videos. Look this link (and comments) http://coding-everyday.blogspot.com.es/2012/10/download-youtube-video-files-with.html – Víctor Mar 31 '16 at 09:00

2 Answers2

2

i solved this issue using youtube-dl, if anybody stuck on this issue then use node-youtube-dl then hit the requst and you are able to start the downloading, i hope this will helpful for the others.here am sharing the steps.

  1. create a node server

  2. install node-youtube-dl

  3. make an api which takes id of the youtube video and pass to the youtube-dl function, it generate a link to download the video so that link send back to that call.

  4. using filetransfer plugin in your real application pass that url in download function.

  5. video will start and stored the path given in output.

    i hope it will helps

Community
  • 1
  • 1
DK3
  • 403
  • 2
  • 10
0

Possibly this can help you:

Storing video for offline use in PhoneGap/Chrome Apps

The hard thing here is finding your own way to get video from youtube page. The video won't be simply accessible like in the above given link. Maybe try using a api...

Note: I have to warn that according to TOS of youtube it's not allowed to download video, only if the option is available.

Community
  • 1
  • 1
Izoman
  • 51
  • 5