Package com.google.gdata.data.youtube

Examples of com.google.gdata.data.youtube.VideoFeed


          "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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        listTube.add(tub);
      }
    } catch (MalformedURLException e) {
View Full Code Here


          "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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        listTube.add(tub);
      }
    } catch (MalformedURLException e) {
View Full Code Here

   * @throws ServiceException Problem communicating with the server.
   */
  public static void countUniques(YouTubeService service, String searchTerm) throws MalformedURLException, IOException, ServiceException {
   
    YouTubeQuery query = null;
    VideoFeed videoFeed = null;
    HashSet<String> uniques = null;
     
    uniques = new HashSet<String>(1000);
   
    query = new YouTubeQuery(
        new URL("http://gdata.youtube.com/feeds/api/videos"));
   
    System.out.print("Querying for " + searchTerm);
   
    query.setVideoQuery(searchTerm);
    query.setMaxResults(25);
   
    String queryUrl = query.getUrl().toString();
   
   
    do {
   
      videoFeed = service.getFeed(new URL(queryUrl), VideoFeed.class);
     
      for(VideoEntry entry : videoFeed.getEntries() ) {
        uniques.add(entry.getId());
      }
     
      //check if we have more results
      Link nextLink = videoFeed.getLink("next", "application/atom+xml");
      if(nextLink != null) {
        queryUrl = nextLink.getHref();
      }
      else {
        queryUrl = null;
View Full Code Here

    String username = getParam("username");
    if (util.isNullOrEmpty(username)) {
      throw new IllegalArgumentException("Required parameter 'username' is null or empty.");
    }

    VideoFeed uploadsFeed = apiManager.getUploadsFeed(username);
    if (uploadsFeed != null) {
      if (uploadsFeed.getEntries().size() > 0) {
        HashMap<String, Map<String, String>> videoIdToMetadata = new HashMap<String, Map<String, String>>();
        for (VideoEntry videoEntry : uploadsFeed.getEntries()) {
          if (!videoEntry.isDraft()) {
            HashMap<String, String> metadata = new HashMap<String, String>();
            YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();

            metadata.put("title", mediaGroup.getTitle().getPlainTextContent());
View Full Code Here

          "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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        listTube.add(tub);
      }
    } catch (MalformedURLException e) {
View Full Code Here

            YouTubeQuery query = new YouTubeQuery(url);
            query.setMaxResults(MAX_RESULTS);
            int i = 1;
            while (true) {
                query.setStartIndex(i);
                VideoFeed feed = serv.getFeed(query, VideoFeed.class);
                for (VideoEntry upload : feed.getEntries()) {
                    uploads.add(upload.getTitle().getPlainText());
                }
                i += MAX_RESULTS;
                if (i > feed.getTotalResults()) {
                    break;
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

            YouTubeQuery query = new YouTubeQuery(url);
            query.setMaxResults(MAX_RESULTS);
            int i = 1;
            while (true) {
                query.setStartIndex(i);
                VideoFeed feed = serv.getFeed(query, VideoFeed.class);
                for (VideoEntry fav : feed.getEntries()) {
                    favs.add(fav.getTitle().getPlainText());
                }
                i += MAX_RESULTS;
                if (i > feed.getTotalResults() || i > 1000) {
                    break;
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
View Full Code Here

  }

  public static void searchByListId(List<String> tubeIds, boolean fullContent) {
    try {
      listResult = new ArrayList<Tube>();
      VideoFeed batchFeed = new VideoFeed();
      BatchUtils.setBatchOperationType(batchFeed,
          BatchOperationType.QUERY);

      for (String videoId : tubeIds) {
        VideoEntry videoEntry = new VideoEntry(
            String.format(
                "http://gdata.youtube.com/feeds/api/videos/%s",
                videoId));
        batchFeed.getEntries().add(videoEntry);
      }
      VideoFeed batchResponse;
      batchResponse = service.batch(new URL(
          "http://gdata.youtube.com/feeds/api/videos/batch"),
          batchFeed);
      for (VideoEntry videoEntry : batchResponse.getEntries()) {
        if (BatchUtils.isSuccess(videoEntry)) {
          Tube obj = YoutubeService.videoEntryToTube(videoEntry);
          if (obj != null) {
            listResult.add(obj);
          }
View Full Code Here

        String feedUrl = "http://gdata.youtube.com/feeds/api/videos?max-results="
            + limit
            + "&start-index="
            + ((start * limit) + 1)
            + "&orderby=published" + "&author=" + channel;
        VideoFeed videoFeed = service.getFeed(new URL(feedUrl),
            VideoFeed.class);
        totalResult = videoFeed.getTotalResults();
        System.out.println("Found : " + totalResult);
        initCache();
        for (VideoEntry videoEntry : videoFeed.getEntries()) {
          Tube tube = new Tube();
          tube = videoEntryToTube(videoEntry);
          if (tube != null) {
            listResult.add(tube);
          }
View Full Code Here

        query.setStartIndex(limit * start + 1);
        query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
        if (hd) {
          query.setStringCustomParameter("hd", "true");
        }
        VideoFeed videoFeed = service.query(query, VideoFeed.class);
        totalResult = videoFeed.getTotalResults();
        System.out.println("Found : " + totalResult);
        initCache();
        for (VideoEntry videoEntry : videoFeed.getEntries()) {
          Tube tube = videoEntryToTube(videoEntry);
          if (tube != null) {
            listResult.add(tube);
          }
        }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.youtube.VideoFeed

Copyright © 2018 www.massapicom. 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.