本文整理汇总了Java中com.google.gdata.data.youtube.VideoFeed类的典型用法代码示例。如果您正苦于以下问题:Java VideoFeed类的具体用法?Java VideoFeed怎么用?Java VideoFeed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoFeed类属于com.google.gdata.data.youtube包,在下文中一共展示了VideoFeed类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: youTubeSearch
import com.google.gdata.data.youtube.VideoFeed; //导入依赖的package包/类
/** returns an Item object given a keyword */
private Item youTubeSearch(String kw) throws Exception {
// init service
YouTubeService service = new YouTubeService(APP_NAME);
YouTubeQuery query = new YouTubeQuery(new URL(FEED_URL));
// order results by the relevance
query.setOrderBy(ORDER_BY_PARAM);
// search for keyword
query.setFullTextQuery(kw);
query.setMaxResults(MAX_SEARCH_RESULTS);
query.setSafeSearch(SAFE_SEARCH_PARAM);
// retrieve results
VideoFeed videoFeed = service.query(query, VideoFeed.class);
String content = localizeVideoFeed(videoFeed);
return new Item(kw, content);
}
开发者ID:wzhishen,项目名称:youtube-cache,代码行数:20,代码来源:YouTubeClient.java
示例2: retrieveVideos
import com.google.gdata.data.youtube.VideoFeed; //导入依赖的package包/类
public List<YouTubeVideo> retrieveVideos(String textQuery, int maxResults, boolean filter, int timeout, int startIndex) throws Exception {
YouTubeService service = new YouTubeService(clientID);
service.setConnectTimeout(timeout); // millis
YouTubeQuery query = new YouTubeQuery(new URL(YOUTUBE_URL));
query.setOrderBy(YouTubeQuery.OrderBy.RELEVANCE);
query.setFullTextQuery(textQuery);
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
query.setMaxResults(maxResults);
query.setStartIndex(startIndex);
query.addCustomParameter(new Query.CustomParameter("hd", "true"));
VideoFeed videoFeed = service.query(query, VideoFeed.class);
List<VideoEntry> videos = videoFeed.getEntries();
return convertVideos(videos);
}
开发者ID:hamdikavak,项目名称:youtube-search-tool,代码行数:20,代码来源:YouTubeManager.java
示例3: localizeVideoFeed
import com.google.gdata.data.youtube.VideoFeed; //导入依赖的package包/类
/** converts a VideoFeed object to XML-style document */
private String localizeVideoFeed(VideoFeed videoFeed) {
String content = "<m:Entries>";
for(VideoEntry videoEntry : videoFeed.getEntries() ) {
content += localizeVideoEntry(videoEntry);
}
content += "</m:Entries>";
return content;
}
开发者ID:wzhishen,项目名称:youtube-cache,代码行数:10,代码来源:YouTubeClient.java
示例4: execute
import com.google.gdata.data.youtube.VideoFeed; //导入依赖的package包/类
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Facade facade = Facade.getInstance();
int idActivity = Integer.valueOf(request.getParameter("idActivity"));
VideoIriz video = facade.getVideoByID(idActivity);
String status = "activities.video.status.ok";
String okStatus = "activities.video.status.ok";
String watchLink = "";
if (video.isUploaded()) {
YouTubeService service = new YouTubeService(
"ytapi-Amadeus-Amadeus-31t3bfbl-0",
"AI39si4lPYVDXG8xROx-bAoe-vIODvTOcucDwRb-"
+ "_2Ty6pesAsS3R2ybTp6D44a4FZy3Wi0dqls44Cur0-qiuDLCNdihPYBRmw");
service.setAuthSubToken("CIyFvq-NDRCrmPDjBQ", null);
String feedUrl = "http://gdata.youtube.com/feeds/api/users/amadeuslms/uploads";
VideoFeed videoFeed;
VideoEntry entry = null;
try {
videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
for (VideoEntry videoInstance : videoFeed.getEntries()) { //search for the video entry
if (UtilActivities.getVideoId(videoInstance.getId())
.equals(video.getYoutubeId())) {
entry = videoInstance;
}
}
if(entry == null){
status = "activities.video.status.invalidURL";
}
if (entry.isDraft()) {
YtPublicationState pubState = entry.getPublicationState();
if (pubState.getState() == YtPublicationState.State.PROCESSING) {
status = "activities.video.status.processing";
} else if (pubState.getState() == YtPublicationState.State.REJECTED) {
status = "activities.video.status.rejected";
//System.out.println(pubState.getDescription()); // why it was rejected
//System.out.print("For help visit: ");
//System.out.println(pubState.getHelpUrl());
} else if (pubState.getState() == YtPublicationState.State.FAILED) {
status = "activities.video.status.failed";
//System.out.println(pubState.getDescription()); //why it failed
//System.out.print("For help visit: ");
//System.out.println(pubState.getHelpUrl());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(status.equals("activities.video.status.ok")){
watchLink = "<a onclick='watchVideo" +
"('"+ request.getContextPath() +"/jsp/course/content_management" +
"/activities/video/iriz.jsp?idVideo="+ video.getYoutubeId() +"');' href='javascript" +
":void(0);' ><bean:message key='activities.video.watch' /></a>";
}else{
watchLink = "<bean:message key='activities.video.watch' />";
}
request.setAttribute("watchLink", watchLink);
request.setAttribute("video", video);
request.setAttribute("status", status);
request.setAttribute("okStatus", okStatus);
return mapping.findForward(FORWARD_VIDEO_STATUS);
}
开发者ID:ProjetoAmadeus,项目名称:AmadeusLMS,代码行数:78,代码来源:ShowVideoIrizStatusAction.java
示例5: lookupVideo
import com.google.gdata.data.youtube.VideoFeed; //导入依赖的package包/类
public List<String> lookupVideo(String searchTerm) throws IOException, ServiceException {
List<String> results = new ArrayList<String>();
YouTubeService service = new YouTubeService("savetheenvironment");
YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
query.setFullTextQuery(searchTerm);
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
VideoFeed videoFeed = service.query(query, VideoFeed.class);
for (VideoEntry videoEntry : videoFeed.getEntries()) {
results.add(videoEntry.getTitle().getPlainText());
}
return results;
}
开发者ID:joshlong,项目名称:adaptive-spring,代码行数:21,代码来源:VideoSearchYouTube.java
注:本文中的com.google.gdata.data.youtube.VideoFeed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论