Hi all,
I m going to make a Youtube Video Downloader in JAVA, but i dont know where to start and how to do this... i have googled a lot to find any help in this case but i didn't find any helpful material...
Thanx
ARUZ
10 18278
First you need to have the swf file then use URL class API then i think you can get the help.
If you want to incorporate the Java file with the Youtube player then i think it's not possible ;)
Ok i m also trying, let's see what happens with URL class ;)
See i tested this code but i could not able to download ..i able to save the SWF file but it's not playing and even not saying that this is an invalid file.
My code goes here. -
-
import java.io.BufferedInputStream;
-
import java.io.BufferedOutputStream;
-
import java.io.FileOutputStream;
-
import java.net.InetAddress;
-
import java.net.InetSocketAddress;
-
import java.net.Proxy;
-
import java.net.SocketAddress;
-
import java.net.URL;
-
-
/*
-
* To change this template, choose Tools | Templates
-
* and open the template in the editor.
-
*/
-
import java.net.URLConnection;
-
-
/**
-
*
-
* @author Admin
-
*/
-
public class SWfDowloader {
-
public static void main(String a[]) throws Exception{
-
String swf_path = "http://s.ytimg.com/yt/swf/watch_v8-vfl87635.swf";
-
URL swf_url = new URL(swf_path);
-
byte address[] = {(byte)144,(byte)16,(byte)192,(byte)245};
-
SocketAddress socket_address = new InetSocketAddress(InetAddress.getByAddress(address),8080);
-
Proxy proxy = new Proxy(Proxy.Type.HTTP,socket_address);
-
URLConnection url_conn = swf_url.openConnection(proxy);
-
url_conn.connect();
-
BufferedInputStream swf_in_stream = new BufferedInputStream(url_conn.getInputStream());
-
FileOutputStream swf_file = new FileOutputStream("d:/test.swf");
-
BufferedOutputStream swf_out_stream = new BufferedOutputStream(swf_file);
-
byte bytes[] = new byte[512];
-
int read_bytes = 0;
-
while((read_bytes=swf_in_stream.read(bytes))!=-1)
-
swf_out_stream.write(bytes, 0,read_bytes);
-
-
swf_in_stream.close();
-
swf_file.close();
-
swf_out_stream.close();
-
}
-
}
-
I think the part of the SWF file downloaded.you know when you play a video in Youtube then it takes time to play the full one ...but i am not sure that the whole content i am getting here .. you also try ...i also keep searching. Le's see what happens ;)
The swf file you are downloading is the flv player while we need the flv file not the swf file...
ARUZ
but they havnt included the feature for download :)
I have a youtube downloader on vb i m thinking to convert that into java.... may be that logic works for java too....
@EYE4U
I didn't get you what you meant ;)
What you need ..Flash View Player?
I need to download videos from youtube.. this is what i want.
I didnt want to build a youtube client application...
How do you incorporate your Java code into the Youtube player?
What i did that's not downloading the full one.
Let's try with another file..what my code says ;)
See..Just now i tried with one link.
"http://www.java2s.com/Code/JavaDownload/EJB-servlet-stateless-ear.zip"
I tried to download it using my code.
But it's not working :(
When i tried to unzip it then it said "unexpected end of archive" but it shown me the proper file structure.
Could anyone tell me what happened? ;)
One more thing .. The file was 17K and my calculations was also 17.48 K on the basis of read bytes :) I don't what went wrong?
I tried with one more link "http://www.prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js"
That's the plain text file so that i could check the easily how much left to download.
Right now i saw that some of the bytes left to download ... the same thing happened with ZIP file ;) What would be the reason? Where i did wrong so that it behaved like this?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: kn0ckturnal |
last post by:
when i try to view video on youtube or other type video, it wont load and it saids:
(from youtube)
Hello, you either have JavaScript turned off or an old version of Macromedia's Flash Player....
|
by: anil2005 |
last post by:
Hi Everyone,
i am developing one portal, in which i need to integrate youtube website's video. youtube is providing one ifame code if i use that , i can successfully emmebed the video's in...
|
by: kevin |
last post by:
If you go here http://www.youtube.com/ how do they put the plus button over
the image? Also is it possible to include more the one button.
Thanks...
----== Posted via Newsfeeds.Com -...
|
by: Jassim Rahma |
last post by:
is there anyway to download the youtube videos into windows media format
using c#?
|
by: ahmad |
last post by:
New youtube video
http://www.youtube.com/watch?v=2R31xnFeL2Q
http://www.youtube.com/watch?v=tWxFZRgh664
http://www.youtube.com/watch?v=K20FaUQpCEk
...
|
by: alexus |
last post by:
what's the best way to "extract" videos from youtube?
|
by: jeddiki |
last post by:
Hi,
As I am in Turkey at present, I can not see vidoes on
youtube. So I have tried a few proxies but keep finding them slow or
not working.
So I have installed myphpProxy on my server under...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |