Package com.google.gdata.client.youtube

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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
View Full Code Here


  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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
View Full Code Here

   * @throws IOException Problem communicating with the server.
   * @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);
View Full Code Here

  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);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
View Full Code Here

    public String[] export() {
        List<String> uploads = new ArrayList<String>();
        try {
            URL url = createURL();
            YouTubeService serv = new YouTubeService(null);
            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;
View Full Code Here

    public String[] export() {
        List<String> playlists = new ArrayList<String>();
        try {
            URL url = createURL();
            YouTubeService serv = new YouTubeService(null);
            YouTubeQuery query = new YouTubeQuery(url);
            query.setMaxResults(MAX_RESULTS);
            int i = 1;
            while (true) {
                query.setStartIndex(i);
                PlaylistFeed feed = serv.getFeed(query, PlaylistFeed.class);
                for (PlaylistEntry entry : feed.getEntries()) {
                    playlists.add(entry.getTitle().getPlainText());
                }
                i += MAX_RESULTS;
View Full Code Here

        try {
            URL url = createURL();
            YouTubeService serv = new YouTubeService(null);
            int i = 1;
            while (true) {
                YouTubeQuery query = new YouTubeQuery(url);
                query.setMaxResults(MAX_RESULTS);
                query.setStartIndex(i);
                FriendFeed feed = serv.query(query, FriendFeed.class);
                for (FriendEntry entry : feed.getEntries()) {
                    friends.add(entry.getUsername());
                }
                i += MAX_RESULTS;
View Full Code Here

    public String[] export() {
        List<String> subscriptions = new ArrayList<String>();
        try {
            URL url = createURL();
            YouTubeService serv = new YouTubeService(null);
            YouTubeQuery query = new YouTubeQuery(url);
            query.setMaxResults(MAX_RESULTS);
            int i = 1;
            while (true) {
                query.setStartIndex(i);
                SubscriptionFeed feed = serv.query(query, SubscriptionFeed.class);
                for (SubscriptionEntry entry : feed.getEntries()) {
                    subscriptions.add(entry.getUsername());
                }
                i += MAX_RESULTS;
View Full Code Here

    public String[] export() {
        List<String> favs = new ArrayList<String>();
        try {
            URL url = createURL();
            YouTubeService serv = new YouTubeService(null);
            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;
View Full Code Here

        totalResult = (Integer) cache.get(prefix + "totalResult");
        isCache = true;
        System.out.println("Getting video from cache...");
      } else {
        listResult = new ArrayList<Tube>();
        YouTubeQuery query = new YouTubeQuery(new URL(
            "https://gdata.youtube.com/feeds/api/videos"));
        query.setFullTextQuery(key);
        query.setMaxResults(limit);
        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();
View Full Code Here

TOP

Related Classes of com.google.gdata.client.youtube.YouTubeQuery

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.