youtube api download video doesn´t work

Showing 1-2 of 2 messages
youtube api download video doesn´t work Alan Keller 12/10/10 7:30 PM
Hi,
I have a java application that allows user to search and download
video from youtube and now it returns error
java.io.FileNotFoundException:
http://www.youtube.com/get_video?video_id=5qm8PH4xAss&t=vjVQa1PpcFM-M1tgkrqgayfnFXk94RUWgeBS4mTx9Eo%3D&eurl=&el=&ps=&asv=&fmt=34
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)

from the method below:

public static String getVideoStreamPath(String videoID){
                       String infoPath = "http://www.youtube.com/
get_video_info?&video_id=
"+videoID
+"&el=detailpage&ps=default&eurl=&gl=US&hl=en";
                String token = null;
                try {
                        InputStreamReader isr = new InputStreamReader(new
URL(infoPath).openStream());
                        BufferedReader bis = new BufferedReader(isr);

                        String fullInfo = bis.readLine();
                        StringTokenizer st1 = new StringTokenizer(fullInfo, "&");
                        while(st1.hasMoreTokens()){
                                String next = st1.nextToken();
                                StringTokenizer st2 = new StringTokenizer(next, "=");
                                if (st2.nextToken().contentEquals("token")){
                                        System.out.println(next + " - " + st2.toString() +
st2.hasMoreTokens());
                                        token = st2.nextToken();
                                }
                        }

                } catch (MalformedURLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }


                if (token != null){
                        String videoPath = "http://www.youtube.com/get_video?
video_id="+videoID + "&t="+ token +"&eurl=&el=&ps=&asv=&fmt=34";
                        return videoPath;
                }
                else{
                        return null;
                }
        }


Please, somebody can help me??
Thanks a lot...
Re: youtube api download video doesn´t work Jeffrey Posnick 12/15/10 11:06 AM
Hello Alan,

 What you're describing is not part of any public API. Additionally,
please familiarize yourself with the YouTube API Terms of Service

  http://code.google.com/apis/youtube/terms.html

and ensure that any code you write that interfaces with YouTube is in
compliance with what that document requires.

Cheers,
-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ http://google.com/jobs/workyoutube ~


On Dec 10, 10:30 pm, Alan Keller <alankel...@gmail.com> wrote:
> Hi,
> I have a java application that allows user to search and download
> video from youtube and now it returns error
> java.io.FileNotFoundException:http://www.youtube.com/get_video?video_id=5qm8PH4xAss&t=vjVQa1PpcFM-M...