gpt4 book ai didi

com.google.gdata.client.youtube.YouTubeService类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:35:31 28 4
gpt4 key购买 nike

本文整理了Java中com.google.gdata.client.youtube.YouTubeService类的一些代码示例,展示了YouTubeService类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTubeService类的具体详情如下:
包路径:com.google.gdata.client.youtube.YouTubeService
类名称:YouTubeService

YouTubeService介绍

[英]Java client service for the YouTube GData APIs.
[中]YouTube GData API的Java客户端服务。

代码示例

代码示例来源:origin: stackoverflow.com

String feedUrl = "http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed";
 YouTubeService service = new YouTubeService("youtube", "DEVELOPER_KEY_HERE");
 service.setUserCredentials("LOGIN@gmail.com", "YOUR_PASSWORD_HERE");
 VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
 printVideoFeed(videoFeed, true);

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
 * Returns true if the current YouTube GData API version {@link #getVersion()}
 * is compatible with the given version.
 * 
 * @param version version to check compatibility with.
 * @return true if the current version is compatible with the given version,
 *         false otherwise.
 */
public static boolean isCompatible(Version version) {
 if (version == null) {
  throw new NullPointerException("Version cannot be null.");
 }
 
 return getVersion().isCompatible(version);
}

代码示例来源:origin: stackoverflow.com

public static YouTubeService service;
public static String USER_FEED = "http://gdata.youtube.com/feeds/api/users/";
public static String CLIENT_ID = "...";
public static String DEVELOPER_KEY = "...";

public static int getVideoCountOf(String uploader) {
  try {
    service = new YouTubeService(CLIENT_ID, DEVELOPER_KEY);
    String uploader = "UCK-H1e0S8jg-8qoqQ5N8jvw"; // sample user
    String feedUrl = USER_FEED + uploader + "/uploads";
    VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
    return videoFeed.getTotalResults();
  } catch (Exception ex) {
    Logger.getLogger(YouTubeCore.class.getName()).log(Level.SEVERE, null, ex);
  }
  return 0;
}

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
  * Generate a form-upload token given the XML description of a new media entry.
  *
  * @param url link with rel={@link YouTubeNamespace#GET_UPLOAD_TOKEN_REL} on a user's
  *            upload feed
  * @param entry XML metadata of a new media entry
  */
 @SuppressWarnings("unchecked")
 public <E extends IEntry> FormUploadToken getFormUploadToken(URL url, E entry) 
   throws ServiceException, IOException {

  if (entry == null) {
   throw new NullPointerException("Must supply entry");
  }

  Service.GDataRequest request = createInsertRequest(url);
  writeRequestData(request, entry);
  request.execute();

  ParseSource resultEntrySource = request.getParseSource();
  try {
   return FormUploadToken.parse(resultEntrySource.getInputStream());
  } finally {
   request.end();
  }
 }
}

代码示例来源:origin: com.mulesoft.google/google-api-gdata

+ (authBaseUrl.getPort() == -1 ? "" : ":" + authBaseUrl.getPort())
    + authBaseUrl.getPath());
getRequestFactory().setHeader("X-GData-Key", developerId != null ? "key=" + developerId : null);
getRequestFactory().setHeader("X-GData-Client", applicationName);
ExtensionProfile profile = getExtensionProfile();
profile.addDeclarations(new ChannelFeed());
profile.addDeclarations(new ComplaintFeed());
profile.addDeclarations(new VideoFeed());
setStrictValidation(false);

代码示例来源:origin: stackoverflow.com

YouTubeService service = new YouTubeService("project id on console.developer.google.com","androidkey");
 service.setUserCredentials("yourYouTubeAccount@gmail.com", "yourPassword");
 VideoEntry newEntry = new VideoEntry();
 YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
 mg.setTitle(new MediaTitle());
 mg.getTitle().setPlainTextContent("Video Title");
 mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Tech"));
 mg.setKeywords(new MediaKeywords());
 mg.getKeywords().addKeyword("anyKeyword");
 mg.setDescription(new MediaDescription());
 mg.getDescription().setPlainTextContent("VIDEO DESCRIPTION");
 mg.setPrivate(false);
 mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
 mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));
 MediaFileSource ms = new MediaFileSource(videoFileToUpload, "video/quicktime");
 newEntry.setMediaSource(ms);
 VideoEntry createdEntry = service.insert(new URL(Constant.YOUTUBE_UPLOAD_URL), newEntry);
 Log.v("TAG", "VIDEO INSERTED ID : " + createdEntry.getId());

代码示例来源:origin: com.google.gdata/gdata-java-client

+ (authBaseUrl.getPort() == -1 ? "" : ":" + authBaseUrl.getPort())
    + authBaseUrl.getPath());
getRequestFactory().setHeader("X-GData-Key", developerId != null ? "key=" + developerId : null);
getRequestFactory().setHeader("X-GData-Client", applicationName);
ExtensionProfile profile = getExtensionProfile();
profile.addDeclarations(new ChannelFeed());
profile.addDeclarations(new ComplaintFeed());

代码示例来源:origin: openimaj/openimaj

@Override
protected XuggleVideo loadXuggleVideo(String videoEntry) {
  String youtubeId = parseYoutubeID(videoEntry);
  
  if(youtubeId == null) return null;
  String youtubeFLV = YouTube.getLocation(youtubeId);
  
  YouTubeService service = new YouTubeService("thisinthat",developerKey);
  URL gDataURL;
  try {
    gDataURL = new URL(String.format(gDataURLTemplate, youtubeId));
    this.entry = service.getEntry(gDataURL, VideoEntry.class);
    
  } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  } catch (ServiceException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  
  
  return new XuggleVideo(youtubeFLV);
}

代码示例来源:origin: stackoverflow.com

YouTubeService service = new YouTubeService("The name of my application");

代码示例来源:origin: com.mulesoft.google/google-api-gdata

/**
  * Generate a form-upload token given the XML description of a new media entry.
  *
  * @param url link with rel={@link YouTubeNamespace#GET_UPLOAD_TOKEN_REL} on a user's
  *            upload feed
  * @param entry XML metadata of a new media entry
  */
 @SuppressWarnings("unchecked")
 public <E extends IEntry> FormUploadToken getFormUploadToken(URL url, E entry) 
   throws ServiceException, IOException {

  if (entry == null) {
   throw new NullPointerException("Must supply entry");
  }

  Service.GDataRequest request = createInsertRequest(url);
  writeRequestData(request, entry);
  request.execute();

  ParseSource resultEntrySource = request.getParseSource();
  try {
   return FormUploadToken.parse(resultEntrySource.getInputStream());
  } finally {
   request.end();
  }
 }
}

代码示例来源:origin: stackoverflow.com

try
{
  var youtubeService = new YouTubeService(new BaseClientService.Initializer()
  {
    ApiKey = DEVELOPER_KEY,
    ApplicationName = "com.sushihangover.youtubeapi",
  });
  var searchListRequest = youtubeService.Search.List("snippet");
  searchListRequest.Q = "StackOverflow";
  searchListRequest.MaxResults = 50;

  var searchListResponse = await searchListRequest.ExecuteAsync();

  foreach (var searchResult in searchListResponse.Items)
  {
    if (searchResult.Id.Kind.Equals("youtube#video"))
    {
      Console.WriteLine(searchResult.Snippet.Title);
    }
  }
}
catch (Exception ex)
{
  Console.WriteLine(ex.Message);
}

代码示例来源:origin: stackoverflow.com

var youtubeService = new YouTubeService(new BaseClientService.Initializer()

代码示例来源:origin: com.google.gdata/gdata-java-client

/**
 * Returns true if the current YouTube GData API version {@link #getVersion()}
 * is compatible with the given version.
 * 
 * @param version version to check compatibility with.
 * @return true if the current version is compatible with the given version,
 *         false otherwise.
 */
public static boolean isCompatible(Version version) {
 if (version == null) {
  throw new NullPointerException("Version cannot be null.");
 }
 
 return getVersion().isCompatible(version);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com