Package com.google.gdata.data.youtube

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


   * @throws ServiceException
   * @throws IOException
   */
  public String getCurrentUsername() throws IOException, ServiceException {
    try {
      UserProfileEntry profile = service.getEntry(new URL(USER_ENTRY_URL), UserProfileEntry.class);
      return profile.getUsername();
    } catch (MalformedURLException e) {
      log.log(Level.WARNING, "", e);
    } catch (AuthenticationException e) {
      if (e.getResponseBody().contains("NoLinkedYouTubeAccount")) {
        throw new IllegalArgumentException("Your account is not linked to a YouTube account. " +
View Full Code Here


   * @return The current username for the authenticated user.
   */
  public String getCurrentUsername() {
    try {
      log.info("Attempting to get username from YouTube");
      UserProfileEntry profile = service.getEntry(new URL(userEntry),
          UserProfileEntry.class);

      return profile.getUsername();
    } catch (Exception e) {
      log.warning("Fetching username failed: " + e.toString());
      return null;
    }
  }
View Full Code Here

    return result;
  }

  public static Author getUserProfile(Author author) {
    String profileUrl = author.getUri();
    UserProfileEntry profileEntry;
    try {
      profileEntry = service.getEntry(new URL(profileUrl),
          UserProfileEntry.class);
      author.setThumbnail(profileEntry.getThumbnail().getUrl());
      author.setUserId(profileEntry.getId());
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ServiceException e) {
View Full Code Here

        Channel tubChannel = new Channel();
        String[] splittedId = channel.getId().split(":");
        tubChannel
            .setTitle(new Text(channel.getTitle().getPlainText()));
        tubChannel.setAlias(splittedId[splittedId.length - 1]);
        UserProfileEntry profileEntry = service.getEntry(new URL(
            channel.getAuthors().get(0).getUri()),
            UserProfileEntry.class);
        tubChannel.setThumbImageUrl(new Text(profileEntry
            .getThumbnail().getUrl()));
        result.add(tubChannel);
      }
    } catch (MalformedURLException e) {
      System.out.println("Error when get most view channel.");
View Full Code Here

   */
  private static void printUserProfile(YouTubeService service)
      throws IOException, ServiceException {
    String testUser = promptForUser();
    printUnderlined("User Profile for '" + testUser + "'");
    UserProfileEntry userProfileEntry = service.getEntry(new URL(
        USER_FEED_PREFIX + testUser), UserProfileEntry.class);
    System.out.println("Username: " + userProfileEntry.getUsername());
    System.out.println("Age     : " + userProfileEntry.getAge());
    System.out.println("Gender  : " + userProfileEntry.getGender());
    System.out.println("Single? : " + userProfileEntry.getRelationship());
    System.out.println("Books   : " + userProfileEntry.getBooks());
    System.out.println("Company : " + userProfileEntry.getCompany());
    System.out.println("Describe: " + userProfileEntry.getAboutMe());
    System.out.println("Hobbies : " + userProfileEntry.getHobbies());
    System.out.println("Hometown: " + userProfileEntry.getHometown());
    System.out.println("Location: " + userProfileEntry.getLocation());
    System.out.println("Movies  : " + userProfileEntry.getMovies());
    System.out.println("Music   : " + userProfileEntry.getMusic());
    System.out.println("Job     : " + userProfileEntry.getOccupation());
    System.out.println("School  : " + userProfileEntry.getSchool());
  }
View Full Code Here

TOP

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

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.