Examples of YouTubeQuery


Examples of com.google.gdata.client.youtube.YouTubeQuery

  public static List<Channel> getMostViewdToday() {
    List<Channel> result = null;
    service.setConnectTimeout(2000);
    try {
      YouTubeQuery query = new YouTubeQuery(
          new URL(
              "https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed?time=all_time&max-results=10&orderby=viewCount&v=2"));
      ChannelFeed channels = service.query(query, ChannelFeed.class);
      result = new ArrayList<Channel>();
      for (ChannelEntry channel : channels.getEntries()) {
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

  public static TubesFeed searchByKey(String key, int page, int type) {
    TubesFeed result = new TubesFeed();
    List<Tube> listTube = new ArrayList<Tube>();
    System.out.println("Searching...");
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/videos"));
      query.setFullTextQuery(key);
      query.setMaxResults(itemPerPage);
      query.setStartIndex(itemPerPage * page);
      query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
      result.setCurrentPage(page);
      List<Tube> listSave2DB = new ArrayList<Tube>();
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

   *                     If the service is unable to handle the request.
   * @throws IOException error sending request or reading the feed.
   */
  private static void searchFeed(YouTubeService service)
      throws IOException, ServiceException {
    YouTubeQuery query = new YouTubeQuery(new URL(VIDEOS_FEED));
    // order results by the number of views (most viewed first)
    query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);

    // do not exclude restricted content from the search results
    // (by default, it is excluded)
    query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);

    System.out.println("\nEnter search terms: ");
    String searchTerms = readLine();

    query.setFullTextQuery(searchTerms);

    printUnderlined("Running Search for '" + searchTerms + "'");
    VideoFeed videoFeed = service.query(query, VideoFeed.class);
    for (VideoEntry ve : videoFeed.getEntries()) {
      printVideoEntry("", ve, false);
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

   *                     If the service is unable to handle the request.
   * @throws IOException error sending request or reading the feed.
   */
  private static void searchFeedWithKeywords(YouTubeService service)
      throws IOException, ServiceException {
    YouTubeQuery query = new YouTubeQuery(new URL(VIDEOS_FEED));
    // order the results by the number of views
    query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
   
    // include restricted content in the search results
    query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);

    // a category filter holds a collection of categories to limit the search
    Query.CategoryFilter categoryFilter = new Query.CategoryFilter();

    String keywordTerm = null;
    String allKeywords = "";

    do {
      System.out.println("\nEnter keyword or empty line when done: ");
      keywordTerm = readLine();
      // creates categories whose scheme is KEYWORD_SCHEME
      Category category = new Category(YouTubeNamespace.KEYWORD_SCHEME,
          keywordTerm);
      categoryFilter.addCategory(category);
      // keeps track of concatenated list of keywords entered so far
      if(!"".equals(keywordTerm))
        allKeywords += keywordTerm + ", ";
    } while(keywordTerm != null && !"".equals(keywordTerm));

    // adds the collection of keyword categories to the query
    query.addCategoryFilter(categoryFilter);

    printUnderlined("Running Search for '" + allKeywords + "'");
    VideoFeed videoFeed = service.query(query, VideoFeed.class);
    for (VideoEntry ve : videoFeed.getEntries()) {
      printVideoEntry("", ve, false);
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

    int startIndex = 1;
    if (page != 1) {
      startIndex = itemPerPage * page;
    }
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?time="
              + time + "&start-index=" + startIndex
              + "&max-results=" + itemPerPage
              + "&orderby=viewCount&v=2"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

  public static List<Tube> getMostPopular(String time) {
    List<Tube> result = new ArrayList<Tube>();
    List<Tube> listSave2DB = new ArrayList<Tube>();
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/standardfeeds/most_popular?time="
              + time + "&max-results=6&orderby=viewCount&v=2"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

  public static List<Tube> getMostRecent() {
    List<Tube> result = new ArrayList<Tube>();
    List<Tube> listSave2DB = new ArrayList<Tube>();
    try {
      YouTubeQuery query = new YouTubeQuery(
          new URL(
              "https://gdata.youtube.com/feeds/api/standardfeeds/most_recent?max-results=9"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

    TubesFeed result = new TubesFeed();
    List<Tube> listTube = new ArrayList<Tube>();
    List<Tube> listSave2DB = new ArrayList<Tube>();
    int startIndex = 1;
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/standardfeeds/most_shared?start-index="
              + startIndex + "&max-results=" + itemPerPage
              + "&orderby=viewCount"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

    int startIndex = 1;
    if (page != 1) {
      startIndex = itemPerPage * page;
    }
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/standardfeeds/most_discussed?time="
              + time + "&start-index=" + startIndex
              + "&max-results=" + itemPerPage
              + "&orderby=viewCount&v=2"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
View Full Code Here

Examples of com.google.gdata.client.youtube.YouTubeQuery

    int startIndex = 1;
    if (page != 1) {
      startIndex = itemPerPage * page;
    }
    try {
      YouTubeQuery query = new YouTubeQuery(new URL(
          "https://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time="
              + time + "&start-index=" + startIndex
              + "&max-results=" + itemPerPage
              + "&orderby=viewCount&v=2"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.