예제 #1
0
 public static List<VideoEntry> getUserEntries()
     throws MalformedURLException, IOException, ServiceException {
   VideoFeed videoFeed = null;
   String feedUrl = StatCol.BASEURL.concat(StatCol.username).concat(StatCol.UPLOADS);
   videoFeed = StatCol.myService.getFeed(new URL(feedUrl), VideoFeed.class);
   return videoFeed.getEntries();
 }
예제 #2
0
 public static List getLatestFeed() throws Exception {
   YouTubeService service = new YouTubeService("MangaWire");
   YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
   query.setAuthor("Ulquiorra43");
   query.setOrderBy(OrderBy.PUBLISHED);
   query.setSafeSearch(SafeSearch.STRICT);
   VideoFeed feed = service.query(query, VideoFeed.class);
   System.out.println("Number of entries: " + feed.getEntries().size());
   LinkedList<VideoEntry> videoList = new LinkedList<VideoEntry>();
   if (feed.getEntries().size() < MAX_RESULTS) {
     for (int i = 0; i < feed.getEntries().size(); i++) {
       if (feed.getEntries().get(i).getMediaGroup().getYouTubeContents().isEmpty()) {
         // DO NOTHING
       } else {
         videoList.add(feed.getEntries().get(i));
       }
     }
   } else {
     for (int i = 0; i < MAX_RESULTS; i++) {
       if (feed.getEntries().get(i).getMediaGroup().getYouTubeContents().isEmpty()) {
         // DO NOTHING
       } else {
         videoList.add(feed.getEntries().get(i));
       }
     }
   }
   return videoList;
 }
예제 #3
0
 public void run() {
   try {
     videoFeed = service.query(query, VideoFeed.class);
     videoEntries = (LinkedList) videoFeed.getEntries();
     setChanged();
     notifyObservers();
   } catch (IOException e) {
     e.printStackTrace();
     return;
   } catch (ServiceException e) {
     e.printStackTrace();
     return;
   }
 }
예제 #4
0
  public static String FeedToXml(VideoFeed videoFeed) {
    String Xml = "<video_feed>";
    List<VideoEntry> videoEntries = videoFeed.getEntries();

    // In case videoFeed is empty
    if (videoEntries.size() == 0) {
      return Xml;
    }
    int count = 1;
    for (VideoEntry ve : videoEntries) {
      Xml += "<entry>";
      Xml += XmlEntries("(Video #" + String.valueOf(count) + ")", ve);
      Xml += "</entry>";
      count++;
    }
    Xml += "</video_feed>";

    return Xml;
  }