|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.client.Query
com.google.gdata.client.youtube.YouTubeQuery
public class 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.
Nested Class Summary | |
---|---|
static class |
YouTubeQuery.OrderBy
Standard values for the orderby parameter. |
static class |
YouTubeQuery.SafeSearch
Standard values for the safeSearch parameter. |
static class |
YouTubeQuery.Time
Standard values for the time parameter. |
static class |
YouTubeQuery.Uploader
Standard values for the uploader parameter. |
Nested classes/interfaces inherited from class com.google.gdata.client.Query |
---|
Query.CategoryFilter, Query.CustomParameter, Query.ResultFormat |
Field Summary |
---|
Fields inherited from class com.google.gdata.client.Query |
---|
UNDEFINED |
Constructor Summary | |
---|---|
YouTubeQuery(java.net.URL feedUrl)
Constructs a new YouTubeQuery object that targets a feed. |
Method Summary | |
---|---|
java.lang.String |
getCountryRestriction()
Retrieves the country restriction set on the current query, if any. |
java.util.Set<java.lang.Integer> |
getFormats()
Gets the value of the format parameter. |
boolean |
getIncludeRacy()
Deprecated. Please use getSafeSearch() instead. |
java.lang.String |
getIpRestriction()
Retrieves the IP restriction set on the current query, if any. |
java.lang.String |
getLanguageRestrict()
Gets the value of the lr parameter. |
GeoRssWhere |
getLocation()
Returns the value of the location parameter. |
java.lang.String |
getLocationRadius()
Sets the value of the location-radius parameter. |
YouTubeQuery.OrderBy |
getOrderby()
Gets the value of the orderby parameter. |
java.lang.String |
getOrderByRelevanceForLanguage()
Gets the language for which relevance ordering is optimized. |
YouTubeQuery.SafeSearch |
getSafeSearch()
Gets the value of the safeSearch parameter. |
YouTubeQuery.Time |
getTime()
Gets the value of the time parameter. |
YouTubeQuery.Uploader |
getUploader()
Gets the value of the uploader parameter. |
java.lang.String |
getVideoQuery()
Deprecated. Please use Query.getFullTextQuery() instead. |
boolean |
hasRestrictLocation()
Returns true if the query only wants results that have latitude
and longitude information. |
void |
setCountryRestriction(java.lang.String countryCode)
Sets the restriction parameter to a country code. |
void |
setFormats(int... formats)
Sets the value of the format parameter. |
void |
setFormats(java.util.Set<java.lang.Integer> formats)
Sets the value of the format parameter. |
void |
setIncludeRacy(java.lang.Boolean includeRacy)
Deprecated. Please use #setSafeSearch(String) instead. |
void |
setIpRestriction(java.lang.String ip)
Sets the restriction parameter to an IP v4 address. |
void |
setLanguageRestrict(java.lang.String languageCode)
Sets the value of the lr parameter. |
void |
setLocation(GeoRssWhere where)
Sets the value of the location parameter. |
void |
setLocationRadius(java.lang.String locationRadius)
Sets the value of the location-radius parameter. |
void |
setOrderBy(YouTubeQuery.OrderBy orderBy)
Sets the value of the orderby parameter. |
void |
setOrderByRelevanceForLanguage(java.lang.String languageCode)
Sets order by relevance with results optimized for a specific language. |
void |
setRestrictLocation(boolean isRestrictLocation)
Set/unset the location restrict. |
void |
setSafeSearch(YouTubeQuery.SafeSearch safeSearch)
Sets the value of the safeSearch parameter. |
void |
setTime(YouTubeQuery.Time time)
Sets the value of the time parameter. |
void |
setUploader(YouTubeQuery.Uploader uploader)
Sets the value of the uploader parameter. |
void |
setVideoQuery(java.lang.String query)
Deprecated. Please use Query#setFullTextQuery() instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public YouTubeQuery(java.net.URL feedUrl)
feedUrl
- the URL of the feed against which queries will be
executed.Method Detail |
---|
@Deprecated public java.lang.String getVideoQuery()
Query.getFullTextQuery()
instead.
vq
parameter.
@Deprecated public void setVideoQuery(java.lang.String query)
Query#setFullTextQuery()
instead.
vq
parameter.
The vq
parameter is exactly equivalent to the
q
parameter.
query
- query string, null
to remove the parameterpublic YouTubeQuery.Time getTime()
time
parameter.
time
parameter
java.lang.IllegalStateException
- if a time value was found in the
query that cannot be transformed into YouTubeQuery.Time
public void setTime(YouTubeQuery.Time time)
time
parameter.
time
- time value, null
to remove the parameterpublic java.util.Set<java.lang.Integer> getFormats()
format
parameter.
java.lang.NumberFormatException
- if the current value is
invalid.public void setFormats(int... formats)
format
parameter.
See the documentation for a description of the
different formats that are be available.
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(java.util.Set<java.lang.Integer> formats)
format
parameter.
See the documentation for a description of the
different formats that are be available.
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. null
or an empty set removes the parameterpublic void setLanguageRestrict(java.lang.String languageCode)
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.
languageCode
-
ISO 639-1 2-letter language code. zh-Hans
for simplified
chinese, zh-Hant
for traditional chinese.public java.lang.String getLanguageRestrict()
lr
parameter.
lr
parameter; a language codepublic YouTubeQuery.OrderBy getOrderby()
orderby
parameter.
orderby
parameter.
java.lang.IllegalStateException
- if a time value was found in the
query that cannot be transformed into YouTubeQuery.OrderBy
public void setOrderBy(YouTubeQuery.OrderBy orderBy)
orderby
parameter.
orderBy
- value of the orderby
parameter,
null
to remove the parameterpublic void setOrderByRelevanceForLanguage(java.lang.String languageCode)
languageCode
- null
or
ISO 639-1 2-letter language code. zh-Hans
for simplified
chinese, zh-Hant
for traditional chinese.public java.lang.String getOrderByRelevanceForLanguage()
setOrderByRelevanceForLanguage(java.lang.String)
or null
java.lang.IllegalStateException
- if ordering is not set to relevancepublic YouTubeQuery.SafeSearch getSafeSearch()
safeSearch
parameter.
safeSearch
parameter.
java.lang.IllegalStateException
- if a value was found in the
query that cannot be transformed into YouTubeQuery.SafeSearch
public void setSafeSearch(YouTubeQuery.SafeSearch safeSearch)
safeSearch
parameter.
safeSearch
- value of safeSearch
parameter,
null
to remove the parameter@Deprecated public boolean getIncludeRacy()
getSafeSearch()
instead.
racy
parameter.
racy=include
parameter is present@Deprecated public void setIncludeRacy(java.lang.Boolean includeRacy)
#setSafeSearch(String)
instead.
racy
parameter.
includeRacy
- true
to include racy content, false
to exclude it, null
to remove the parameterpublic void setLocation(GeoRssWhere where)
location
parameter.
where
- A GeoRssWhere
element describing the center of where to search.public GeoRssWhere getLocation()
location
parameter.
GeoRssWhere
element
describing the center of where to search.public void setLocationRadius(java.lang.String locationRadius)
location-radius
parameter. Format is
"100km". Valid units of measurement are "ft", "mi", "m", and "km".
locationRadius
- The requested search radius.
InvalidArgumentException
- if the given string is not a properly
formatted location radius.public java.lang.String getLocationRadius()
location-radius
parameter. Format is
"100km". Valid units of measurement are "ft", "mi", "m", and "km".
public void setRestrictLocation(boolean isRestrictLocation)
isRestrictLocation
- true
if only videos that have
latitude and longitude information are to be returned,
false
otherwise.public boolean hasRestrictLocation()
true
if the query only wants results that have latitude
and longitude information.
true
if the query is restricted by location, false
otherwise.public java.lang.String getCountryRestriction()
null
if no country restriction is set.getIpRestriction()
public void setCountryRestriction(java.lang.String countryCode)
restriction
parameter to a country code.
This parameter restricts the returned results to content available for clients in the specified country.
Only one of the setCountryRestriction(String)
or
setIpRestriction(String)
should be used, using both will only take
into consideration the last used.
countryCode
- a two letter ISO-3166 country code, may be null
to mean no restriction at all.
java.lang.IllegalArgumentException
- if the given country code is not a well
formated two letter country code.public java.lang.String getIpRestriction()
null
if no IP restriction
is set.getCountryRestriction()
public void setIpRestriction(java.lang.String ip)
restriction
parameter to an IP v4 address.
This parameter restricts the returned results to content available for clients in the country that the provided IP address belongs to.
Only one of the setCountryRestriction(String)
or
setIpRestriction(String)
should be used, using both will only take
into consideration the last used.
ip
- a v4 IP address and may be null
to mean no restriction at
all.
java.lang.IllegalArgumentException
- if the given address is not a well
formated IP v4 address.public YouTubeQuery.Uploader getUploader()
uploader
parameter.
uploader
parameter.
java.lang.IllegalStateException
- if a value was found in the
query that cannot be transformed into YouTubeQuery.Uploader
public void setUploader(YouTubeQuery.Uploader uploader)
uploader
parameter.
uploader
- value of the uploader
parameter,
null
to remove the parameter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |