|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jimischopp.jyoutube.JYouTube
public class JYouTube
JYouTube A utility for uploading (and downloading) video content from YouTube programmatically. This class is a direct Java port of PHPTube by Michael Kamleitner (michael.kamleitner@gmail.com or http://www.kamleitner.com/code) Note that this class depends on: commons-httpclient (developed with version 3.1) commons-logging (developed with version 1.1) commens-codec (dependency of logging; developed with version 1.3) Quite often these files are quite large, so if you implement the "ProgressListener" interface, and add it to the listen of listeners on the JYouTube instance, you can receive updates about the upload progress. This is extremely useful. Also, in the interim, you can set the JYouTube instance itself as its own listener, since it implements the listener and logs to its logger (ie. myJYTube.addListener(myJYTube))
Nested Class Summary | |
---|---|
static class |
JYouTube.Catgeory
A list of video content categories as recognized by YouTube. |
static class |
JYouTube.ProgressReportingFilePart
ProgressReportingFilePart issues events to listeners updating them about the progress of a multi-part file upload of an HTTP request. |
Field Summary | |
---|---|
static java.lang.String |
USER_AGENT
|
static java.lang.String |
YT_COOKIE_LOGININFO
|
static java.lang.String |
YT_URL_GET
|
static java.lang.String |
YT_URL_LOGIN
|
static java.lang.String |
YT_URL_LOGIN_PASSWORD_KEY
|
static java.lang.String |
YT_URL_LOGIN_USERNAME_KEY
|
static java.lang.String |
YT_URL_MYVIDEOS
|
static java.lang.String |
YT_URL_PUT_MYVIDEOUPLOAD
|
static java.lang.String |
YT_URL_ROOT
|
static java.lang.String |
YT_URL_VIDEOID_KEY
|
static java.lang.String |
YT_URL_VIDEOIDTEMP_KEY
|
static java.lang.String |
YT_URL_VIEW
|
Constructor Summary | |
---|---|
JYouTube()
Create a new JYouTube object with no user/pass. |
|
JYouTube(java.lang.String username,
java.lang.String password)
Create a new JYouTube object with the specified username/password. |
Method Summary | |
---|---|
void |
addListener(JYouTube.ProgressReportingFilePart.ProgressListener listener)
Add a new ProgressListener to the list of listeners to receive HTTP upload progress updates |
void |
download(java.lang.String videoId,
java.lang.String videoFilename)
Download existing video content to the specified local filename. |
void |
progressUpdate(JYouTube.ProgressReportingFilePart.ProgressUpdateEvent event)
Default implementation of the ProgressListener interface, useful for logging when the calling app has not yet implemented the listener interface. |
boolean |
removeListener(JYouTube.ProgressReportingFilePart.ProgressListener listener)
Remove a listener from the list of HTTP upload progress update listeners |
void |
setProxy(java.lang.String proxyHostName,
int proxyPort)
Set a proxy host for the underlying HttpClient object. |
java.lang.String |
upload(java.lang.String videoFilename,
java.lang.String videoTitle,
java.lang.String videoTags,
java.lang.String videoDescription,
JYouTube.Catgeory cat,
java.lang.String videoLanguage,
boolean isPublic)
Upload new video content. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String YT_COOKIE_LOGININFO
public static final java.lang.String YT_URL_LOGIN_USERNAME_KEY
public static final java.lang.String YT_URL_LOGIN_PASSWORD_KEY
public static final java.lang.String YT_URL_VIDEOID_KEY
public static final java.lang.String YT_URL_VIDEOIDTEMP_KEY
public static final java.lang.String YT_URL_ROOT
public static final java.lang.String YT_URL_LOGIN
public static final java.lang.String YT_URL_VIEW
public static final java.lang.String YT_URL_GET
public static final java.lang.String YT_URL_PUT_MYVIDEOUPLOAD
public static final java.lang.String YT_URL_MYVIDEOS
public static final java.lang.String USER_AGENT
Constructor Detail |
---|
public JYouTube() throws java.lang.Exception
java.lang.Exception
public JYouTube(java.lang.String username, java.lang.String password) throws java.lang.Exception
username
- password
-
java.lang.Exception
Method Detail |
---|
public void setProxy(java.lang.String proxyHostName, int proxyPort)
proxyHostName
- proxyPort
- public void download(java.lang.String videoId, java.lang.String videoFilename) throws java.lang.Exception
videoId
- videoFilename
-
java.lang.Exception
public java.lang.String upload(java.lang.String videoFilename, java.lang.String videoTitle, java.lang.String videoTags, java.lang.String videoDescription, JYouTube.Catgeory cat, java.lang.String videoLanguage, boolean isPublic) throws java.lang.Exception
videoFilename
- name of the local file to be uploadedvideoTitle
- Video-Title on YouTubevideoTags
- blank-separated list of keywords to tag the video content with for later searchvideoDescription
- description of the videocat
- category of the video content (sports, comedy, etc...)videoLanguage
- language of the video (DE, EN, etc...)isPublic
- if this video is viewable by the general public or not
java.lang.Exception
public void addListener(JYouTube.ProgressReportingFilePart.ProgressListener listener)
listener
- public boolean removeListener(JYouTube.ProgressReportingFilePart.ProgressListener listener)
listener
-
public void progressUpdate(JYouTube.ProgressReportingFilePart.ProgressUpdateEvent event)
progressUpdate
in interface JYouTube.ProgressReportingFilePart.ProgressListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |