gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 23:09:31 24 4
gpt4 key购买 nike

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

YouTubeQuery介绍

[英]A helper class that helps building queries for the YouTube feeds. Not all feeds implement all parameters defined on this class. See the documentation to get the list of parameters each feed supports.
[中]帮助为YouTube提要构建查询的助手类。并非所有提要都实现该类上定义的所有参数。请参阅文档以获取每个提要支持的参数列表。

代码示例

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

/**
 * Sets the value of the {@code location-radius} parameter. Format is 
 *   "100km". Valid units of measurement are "ft", "mi", "m", and "km".
 * @return The current search radius.
 */
public String getLocationRadius() {
 return getCustomParameterValue(LOCATION_RADIUS);
}

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

void overwriteCustomParameter(String name, String value) {
 List<CustomParameter> customParams = getCustomParameters();
 // Remove any existing value.
 for (CustomParameter existingValue : getCustomParameters(name)) {
  customParams.remove(existingValue);
 }
 // Add the specified value.
 if (value != null) {
  customParams.add(new CustomParameter(name, value));
 }
}

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

/**
 * Sets the value of the {@code lr} parameter.
 *
 * This parameters restricts the videos that are returned
 * to videos with its title, description and tags mostly
 * in the specified language.
 * It might be different from the language of the video itself.
 *
 * @param languageCode <a
 *   href="http://www.loc.gov/standards/iso639-2/php/code_list.php">
 *   ISO 639-1 2-letter language code</a>. {@code zh-Hans} for simplified
 *   chinese, {@code zh-Hant} for traditional chinese.
 */
public void setLanguageRestrict(String languageCode) {
 overwriteCustomParameter(LANGUAGE_RESTRICT, languageCode);
}

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

/**
 * Sets the value of the {@code location} parameter.
 * @param where A {@link com.google.gdata.data.geo.impl.GeoRssWhere} 
 *  element describing the center of where to search.
 */
public void setLocation(GeoRssWhere where) {
 
 StringBuilder location = new StringBuilder();
 
 if (where != null) {
  location.append(
    where.getLatitude()).append(",").append(where.getLongitude());
 }
 
 if (hasRestrictLocation()) {
  location.append("!");
 }
 
 overwriteCustomParameter(LOCATION,
   location.toString().equals("") ? null : location.toString());
}

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

/**
 * Set/unset the location restrict.
 * @param isRestrictLocation {@code true} if only videos that have 
 *  latitude and longitude information are to be returned,
 *  {@code false} otherwise.
 */
public void setRestrictLocation(boolean isRestrictLocation) {
 
 String location = getCustomParameterValue(LOCATION);
 
 if (location == null) {
  location = "";
 }
 
 if (isRestrictLocation) {
  if (!location.endsWith("!")) {
   overwriteCustomParameter(LOCATION, location + "!");
  }
 } else {
  location = location.replaceAll("!", "");
  //if we have no lat/long then remove the query parameter.
  if (location.length() == 0) {
   location = null;
  }
  overwriteCustomParameter(LOCATION, location);
 }
}

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

/**
 * Gets the language for which relevance ordering is optimized.
 *
 * @return a language code as specified to
 *   {@link #setOrderByRelevanceForLanguage} or {@code null}
 * @throws IllegalStateException if ordering is not set to relevance
 */
public String getOrderByRelevanceForLanguage() {
 String stringValue = getCustomParameterValue(ORDERBY);
 if (stringValue == null) {
  // Default: order by relevance, no specific language
  return null;
 }
 if (getOrderby() != OrderBy.RELEVANCE) {
  throw new IllegalStateException("Not ordering by relevance. Please" 
    + " check with getOrderBy() first");
 }
 if (stringValue == null) {
  return null;
 }
 Matcher matcher = RELEVANCE_LANGUAGE_PATTERN.matcher(stringValue);
 if (matcher.find()) {
  return matcher.group(1);
 }
 return null;
}

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

/**
 * Sets the value of the {@code format} parameter.
 *
 * See the documentation for a description of the
 * different formats that are be available.
 *
 * @param formats integer id of all the formats you are
 *   interested in. Videos will be returned if and only
 *   if they have downloadable content for at least one
 *   of these formats. No formats removes the parameter.
 */
public void setFormats(int... formats) {
 Set<Integer> formatSet = new LinkedHashSet<Integer>();
 for (int format : formats) {
  formatSet.add(format);
 }
 setFormats(formatSet);
}

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

/**
 * Sets the value of the {@code location} parameter.
 * @param where A {@link com.google.gdata.data.geo.impl.GeoRssWhere} 
 *  element describing the center of where to search.
 */
public void setLocation(GeoRssWhere where) {
 
 StringBuilder location = new StringBuilder();
 
 if (where != null) {
  location.append(
    where.getLatitude()).append(",").append(where.getLongitude());
 }
 
 if (hasRestrictLocation()) {
  location.append("!");
 }
 
 overwriteCustomParameter(LOCATION,
   location.toString().equals("") ? null : location.toString());
}

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

/**
 * Set/unset the location restrict.
 * @param isRestrictLocation {@code true} if only videos that have 
 *  latitude and longitude information are to be returned,
 *  {@code false} otherwise.
 */
public void setRestrictLocation(boolean isRestrictLocation) {
 
 String location = getCustomParameterValue(LOCATION);
 
 if (location == null) {
  location = "";
 }
 
 if (isRestrictLocation) {
  if (!location.endsWith("!")) {
   overwriteCustomParameter(LOCATION, location + "!");
  }
 } else {
  location = location.replaceAll("!", "");
  //if we have no lat/long then remove the query parameter.
  if (location.length() == 0) {
   location = null;
  }
  overwriteCustomParameter(LOCATION, location);
 }
}

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

/**
 * Gets the language for which relevance ordering is optimized.
 *
 * @return a language code as specified to
 *   {@link #setOrderByRelevanceForLanguage} or {@code null}
 * @throws IllegalStateException if ordering is not set to relevance
 */
public String getOrderByRelevanceForLanguage() {
 String stringValue = getCustomParameterValue(ORDERBY);
 if (stringValue == null) {
  // Default: order by relevance, no specific language
  return null;
 }
 if (getOrderby() != OrderBy.RELEVANCE) {
  throw new IllegalStateException("Not ordering by relevance. Please" 
    + " check with getOrderBy() first");
 }
 if (stringValue == null) {
  return null;
 }
 Matcher matcher = RELEVANCE_LANGUAGE_PATTERN.matcher(stringValue);
 if (matcher.find()) {
  return matcher.group(1);
 }
 return null;
}

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

/**
 * Sets the value of the {@code format} parameter.
 *
 * See the documentation for a description of the
 * different formats that are be available.
 *
 * @param formats integer id of all the formats you are
 *   interested in. Videos will be returned if and only
 *   if they have downloadable content for at least one
 *   of these formats. No formats removes the parameter.
 */
public void setFormats(int... formats) {
 Set<Integer> formatSet = new LinkedHashSet<Integer>();
 for (int format : formats) {
  formatSet.add(format);
 }
 setFormats(formatSet);
}

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

/**
 * Gets the value of the {@code lr} parameter.
 *
 * @return value of the {@code lr} parameter; a language code
 */
public String getLanguageRestrict() {
 return getCustomParameterValue(LANGUAGE_RESTRICT);
}

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

/**
 * Sets the value of the {@code lr} parameter.
 *
 * This parameters restricts the videos that are returned
 * to videos with its title, description and tags mostly
 * in the specified language.
 * It might be different from the language of the video itself.
 *
 * @param languageCode <a
 *   href="http://www.loc.gov/standards/iso639-2/php/code_list.php">
 *   ISO 639-1 2-letter language code</a>. {@code zh-Hans} for simplified
 *   chinese, {@code zh-Hant} for traditional chinese.
 */
public void setLanguageRestrict(String languageCode) {
 overwriteCustomParameter(LANGUAGE_RESTRICT, languageCode);
}

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

void overwriteCustomParameter(String name, String value) {
 List<CustomParameter> customParams = getCustomParameters();
 // Remove any existing value.
 for (CustomParameter existingValue : getCustomParameters(name)) {
  customParams.remove(existingValue);
 }
 // Add the specified value.
 if (value != null) {
  customParams.add(new CustomParameter(name, value));
 }
}

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

/**
 * Gets the value of the {@code lr} parameter.
 *
 * @return value of the {@code lr} parameter; a language code
 */
public String getLanguageRestrict() {
 return getCustomParameterValue(LANGUAGE_RESTRICT);
}

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

/**
 * Sets the value of the {@code vq} parameter.
 *
 * The {@code vq} parameter is exactly equivalent to the
 * {@code q} parameter.
 *
 * @param query query string, {@code null} to remove the parameter
 * @deprecated Please use {@link Query#setFullTextQuery()} instead.
 */
@Deprecated
public void setVideoQuery(String query) {
 overwriteCustomParameter(VQ, query);
}

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

String getCustomParameterValue(String parameterName) {
 List<CustomParameter> customParams = getCustomParameters(parameterName);
 if (customParams.isEmpty()) {
  return null;
 }
 return customParams.get(0).getValue();
}

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

/**
 * Sets the value of the {@code location-radius} parameter. Format is 
 *   "100km". Valid units of measurement are "ft", "mi", "m", and "km".
 * @return The current search radius.
 */
public String getLocationRadius() {
 return getCustomParameterValue(LOCATION_RADIUS);
}

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

/**
 * Sets the value of the {@code vq} parameter.
 *
 * The {@code vq} parameter is exactly equivalent to the
 * {@code q} parameter.
 *
 * @param query query string, {@code null} to remove the parameter
 * @deprecated Please use {@link Query#setFullTextQuery()} instead.
 */
@Deprecated
public void setVideoQuery(String query) {
 overwriteCustomParameter(VQ, query);
}

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

String getCustomParameterValue(String parameterName) {
 List<CustomParameter> customParams = getCustomParameters(parameterName);
 if (customParams.isEmpty()) {
  return null;
 }
 return customParams.get(0).getValue();
}

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