Logo Search packages:      
Sourcecode: gdata-sharp version File versions  Download package

Google::GData::YouTube::YouTubeQuery Class Reference

Inheritance diagram for Google::GData::YouTube::YouTubeQuery:

Google::GData::Client::FeedQuery Google::GData::Client::ISupportsEtag

List of all members.


Detailed Description

A subclass of FeedQuery, to create an YouTube query URI. The YouTube Data API supports the following standard Google Data query parameters. Name Definition alt The alt parameter specifies the format of the feed to be returned. Valid values for this parameter are atom, rss and json. The default value is atom and this document only explains the format of Atom responses. author The author parameter restricts the search to videos uploaded by a particular YouTube user. The Videos uploaded by a specific user section discusses this parameter in more detail. max-results The max-results parameter specifies the maximum number of results that should be included in the result set. This parameter works in conjunction with the start-index parameter to determine which results to return. For example, to request the second set of 10 results i.e. results 11-20 set the max-results parameter to 10 and the start-index parameter to 11. The default value of this parameter for all Google Data APIs is 25, and the maximum value is 50. However, for displaying lists of videos, we recommend that you set the max-results parameter to 10. start-index The start-index parameter specifies the index of the first matching result that should be included in the result set. This parameter uses a one-based index, meaning the first result is 1, the second result is 2 and so forth. This parameter works in conjunction with the max-results parameter to determine which results to return. For example, to request the second set of 10 results i.e. results 11-20 set the start-index parameter to 11 and the max-results parameter to 10. Please see the Google Data APIs Protocol Reference for more information about standard Google Data API functionality or about these specific parameters. Custom parameters for the YouTube Data API In addition to the standard Google Data query parameters, the YouTube Data API defines the following API-specific query parameters. These parameters are only available on video and playlist feeds. Name Definition orderby The orderby parameter specifies the value that will be used to sort videos in the search result set. Valid values for this parameter are relevance, published, viewCount and rating. In addition, you can request results that are most relevant to a specific language by setting the parameter value to relevance_lang_languageCode, where languageCode is an ISO 639-1 two-letter language code. (Use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese.) In addition, please note that results in other languages will still be returned if they are highly relevant to the search query term. The default value for this parameter is relevance for a search results feed. For a playlist feed, the default ordering is based on the position of each video in the playlist. For a user's playlists or subscriptions feed, the default ordering is arbitrary. client The client parameter is an alphanumeric string that identifies your application. The client parameter is an alternate way of specifying your client ID. You can also use the X-GData-Client request header to specify your client ID. Your application does not need to specify your client ID twice by using both the client parameter and the X-GData-Client request header, but it should provide your client ID using at least one of those two methods. format The format parameter specifies that videos must be available in a particular video format. Your request can specify any of the following formats: Value Video Format 1 RTSP streaming URL for mobile video playback. H.263 video (up to 176x144) and AMR audio. 5 HTTP URL to the embeddable player (SWF) for this video. This format is not available for a video that is not embeddable. Developers commonly add format=5 to their queries to restrict results to videos that can be embedded on their sites. 6 RTSP streaming URL for mobile video playback. MPEG-4 SP video (up to 176x144) and AAC audio lr The lr parameter restricts the search to videos that have a title, description or keywords in a specific language. Valid values for the lr parameter are ISO 639-1 two-letter language codes. You can also use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese. This parameter can be used when requesting any video feeds other than standard feeds. restriction The restriction parameter identifies the IP address that should be used to filter videos that can only be played in specific countries. By default, the API filters out videos that cannot be played in the country from which you send API requests. This restriction is based on your client application's IP address. To request videos playable from a specific computer, include the restriction parameter in your request and set the parameter value to the IP address of the computer where the videos will be played e.g. restriction=255.255.255.255. To request videos that are playable in a specific country, include the restriction parameter in your request and set the parameter value to the ISO 3166 two-letter country code of the country where the videos will be played e.g. restriction=DE. time The time parameter, which is only available for the top_rated, top_favorites, most_viewed, most_discussed, most_linked and most_responded standard feeds, restricts the search to videos uploaded within the specified time. Valid values for this parameter are today (1 day), this_week (7 days), this_month (1 month) and all_time. The default value for this parameter is all_time.

Definition at line 104 of file youtubequery.cs.


Public Types

enum  SafeSearchValues { None, Moderate, Strict }
 describing the possible safe search values
See also:
YouTubeQuery.SafeSearch

More...
enum  UploadTime {
  UploadTimeUndefined, Today, ThisWeek, ThisMonth,
  AllTime
}
 describing the requested video format More...
enum  VideoFormat { FormatUndefined, RTSP, Embeddable, Mobile }
 describing the requested video format More...

Public Member Functions

 YouTubeQuery (string queryUri)
 base constructor, with initial queryUri
 YouTubeQuery ()
 base constructor

Static Public Member Functions

static string CreateContactsUri (string userID)
 convienience method to create an URI based on a userID for the contacts of an user
static string CreateFavoritesUri (string userID)
 convienience method to create an URI based on a userID for the favorites of an user
static string CreateMessagesUri (string userID)
 convienience method to create an URI based on a userID for the messages of an user
static string CreatePlaylistsUri (string userID)
 convienience method to create an URI based on a userID for the playlists of an user
static string CreateSubscriptionUri (string userID)
 convienience method to create an URI based on a userID for the subscriptions
static string CreateUserUri (string userID)
 convienience method to create an URI based on a userID for the uploaded videos of an user
static string CreateVideoUri (string videoID)
 assuming you have a video ID, returns the video feed uri as a string
static string CreateVideoWatchUri (string videoID)
 assuming you have a video ID, returns the watch uri as a string
static AtomCategoryCollection GetCategories (Uri uri, AtomBase owner)
static AtomCategoryCollection GetYouTubeCategories ()
 retrieves the youtubecategories collection from the default location at http://gdata.youtube.com/schemas/2007/categories.cat
static void Parse (Uri uri, out Service service, out FeedQuery query)
 Passing in a complete URI, we strip all the GData query-related things and then treat the rest as the base URI. For this we create a service.

Public Attributes

const string BaseUserUri = "http://gdata.youtube.com/feeds/api/users/"
 base uri for user based feeds
const string BatchVideoUri = "http://gdata.youtube.com/feeds/api/videos/batch"
 youTube base video URI for batch operations
const string DefaultUploads = "http://gdata.youtube.com/feeds/api/users/default/uploads"
 default users upload account
const string DefaultVideoUri = "http://gdata.youtube.com/feeds/api/videos"
 youTube base video URI
const string FavoritesVideo = YouTubeQuery.StandardFeeds +"top_favorites"
 youTube base standard favorites video URI
const string MobilePhonesVideo = YouTubeQuery.StandardFeeds +"watch_on_mobile"
 youTube base standard mobile phones video URI
const string MobileVideoUri = "http://gdata.youtube.com/feeds/mobile/videos"
 youTube base mobile video URI
const string MostDiscussedVideo = YouTubeQuery.StandardFeeds +"most_discussed"
 youTube base standard most discussed video URI
const string MostLinkedVideo = YouTubeQuery.StandardFeeds +"most_linked"
 youTube base standard most linked video URI
const string MostPopular = YouTubeQuery.StandardFeeds +"most_popular"
 youTube base standard most popular video URI
const string MostRecentVideo = YouTubeQuery.StandardFeeds +"most_recent"
 youTube base standard most recent video URI
const string MostRespondedVideo = YouTubeQuery.StandardFeeds +"most_responded"
 youTube base standard most responded video URI
const string MostViewedVideo = YouTubeQuery.StandardFeeds +"most_viewed"
 youTube base standard most viewed video URI
const string RecentlyFeaturedVideo = YouTubeQuery.StandardFeeds +"recently_featured"
 youTube base standard recently featured video URI
const string StandardFeeds = "http://gdata.youtube.com/feeds/api/standardfeeds/"
 the standard feeds URL
const string TopRatedVideo = YouTubeQuery.StandardFeeds + "top_rated"
 youTube base standard top rated video URI

Protected Member Functions

override string CalculateQuery (string basePath)
 Creates the partial URI query string based on all set properties.
char InsertionParameter (string basePath)
 checks if the passed in string contains a "?" and if so returns the & as the insertion char
Uri ParseUri (string target)
 protected void ParseUri
override Uri ParseUri (Uri targetUri)
 protected void ParseUri
virtual void Reset ()
 Resets object state to default, as if newly created.

Static Protected Member Functions

static char AppendQueryPart (DateTime value, string parameterName, char connect, StringBuilder builder)
 helper to format a DateTime parameter into the query
static char AppendQueryPart (uint value, uint defValue, string parameterName, char connect, StringBuilder builder)
static char AppendQueryPart (int value, int defValue, string parameterName, char connect, StringBuilder builder)
 helper to format an inteer parameter into the query
static char AppendQueryPart (string value, string parameterName, char connect, StringBuilder builder)
 helper to format a string parameter into the query
static string FormatToString (AlternativeFormat format)
 Converts an AlternativeFormat to a string for use in the query string.
static void ValidateUri (Uri uriToTest)
 Checks to see if the URI is valid to be used for an Atom query.

Protected Attributes

string baseUri
 the base URI

Properties

string Author [get, set]
 Accessor method public string Author.
string BaseAddress [get, set]
 this will simply return/set the baseUri without any parsing as a string this is the same as using the constructor for most cases, it is here to allow the creation of template methods.
QueryCategoryCollection Categories [get]
 Accessor method public string Category.
bool CategoryQueriesAsParameter [get, set]
 accessor method public bool CategoryQueriesAsParameter
string Client [get, set]
 The client parameter is an alphanumeric string that identifies your application. The client parameter is an alternate way of specifying your client ID. You can also use the X-GData-Client request header to specify your client ID. Your application does not need to specify your client ID twice by using both the client parameter and the X-GData-Client request header, but it should provide your client ID using at least one of those two methods. Note that you should set this normally on the YouTubeService object, this property is only included for completeness.
DateTime EndDate [get, set]
 set's the maximum daterange value for the updated element
string Etag [get, set]
 the Etag value that should be used in the query. Setting this will create an if-match or if-not match header
string ExtraParameters [get, set]
 ExtraParameters holds a string that just get's added to the query string per se. The parameter should honor URL encoding, the library will not touch it's value, but just append it to the existing query. The URL parameter characters will be inserted by the FeedQuery object.
AlternativeFormat FeedFormat [get, set]
 Accessor method public AlternativeFormat FeedFormat.
List< VideoFormatFormats [get]
 format The format parameter specifies that videos must be available in a particular video format. Your request can specify any of the following formats: Value Video Format 1 RTSP streaming URL for mobile video playback. H.263 video (up to 176x144) and AMR audio. 5 HTTP URL to the embeddable player (SWF) for this video. This format is not available for a video that is not embeddable. Developers commonly add format=5 to their queries to restrict results to videos that can be embedded on their sites. 6 RTSP streaming URL for mobile video playback. MPEG-4 SP video (up to 176x144) and AAC audio
string Location [get, set]
 The location parameter restricts the search to videos that have a geographical location specified in their metadata. The parameter can be used in either of the following contexts:

The parameter value can specify geographic coordinates (latitude,longitude) that identify a particular location. In this context, the location parameter operates in conjunction with the location-radius parameter to define a geographic area. The API response will then contain videos that are associated with a geographical location within that area.

Note that when a user uploads a video to YouTube, the user can associate a location with the video by either specifying geographic coordinates (-122.08427,37.42307) or by providing a descriptive address (Munich, Germany). As such, some videos may be associated with a location within the area specified in a search query even though those videos are not associated with specific coordinates that can be plotted on a map.

To exclude videos from the API response if those videos are associated with a descriptive address but not with specific geographic coordinates, append an exclamation point ("!") to the end of the parameter value. This practice effectively ensures that all videos in the API response can be plotted on a map.

The following examples show sample uses of this parameter:

location=37.42307,-122.08427&location-radius=100km

location=37.42307,-122.08427!&location-radius=100km

location=37.42307,-122.08427&location-radius=100km

In an API response, feed entries that are associated with specific coordinates will contain the georss:where tag and may also contain the yt:location tag. Feed entries that are associated with a descriptive address but not with specific geographic cooordinates specify the address using the yt:location tag.

The parameter value can be a single exclamation point. In this context, the parameter does not require a value and its presence serves to restrict the search results to videos that have a geographical location, but it does not enable you to find videos with a specific geographical location. This parameter can be used with all video feeds. A video that has a geographical location will have a georss:where tag in its metadata.

.

string LocationRadius [get, set]
 The location-radius parameter, in conjunction with the location parameter, defines a geographic area. If the geographic coordinates associated with a video fall within that area, then the video may be included in search results.

The location-radius parameter value must be a floating point number followed by a measurement unit. Valid measurement units are m, km, ft and mi. For example, valid parameter values include "1500m", "5km", "10000ft" and "0.75mi". The API will return an error if the radius is greater than 1000 kilometers.

See also:
YouTubeQuery.Location

.
string LR [get, set]
 The lr parameter restricts the search to videos that have a title, description or keywords in a specific language. Valid values for the lr parameter are ISO 639-1 two-letter language codes. You can also use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese. This parameter can be used when requesting any video feeds other than standard feeds.
DateTime MaxPublication [get, set]
 set's the maximum daterange value for the publication element
DateTime MinPublication [get, set]
 set's the mininum daterange value for the publication element
DateTime ModifiedSince [get, set]
 set's the ModifiedSince date. If this is set to something different than DateTime.MinValue, and the FeedQuery object is used for a Service.Query call, this will cause an ifmodified Since header to be created.
int NumberToRetrieve [get, set]
 Accessor method public int NumberToRetrieve.
string OAuthRequestorId [get, set]
 set's the OAuth Requestor Identifier. Only useful if you are using the OAuthFactory as well.
string OrderBy [get, set]
 The orderby parameter, which is only supported for video feeds, specifies the value that will be used to sort videos in the search result set. Valid values for this parameter are relevance, published, viewCount and rating. In addition, you can request results that are most relevant to a specific language by setting the parameter value to relevance_lang_languageCode, where languageCode is an ISO 639-1 two-letter language code. (Use the values zh-Hans for simplified Chinese and zh-Hant for traditional Chinese.) In addition, please note that results in other languages will still be returned if they are highly relevant to the search query term. The default value for this parameter is relevance for a search results feed. accessor method public string OrderBy.
string Query [get, set]
 Accessor method public string Query.
string Racy [get, set]
 The racy parameter allows a search result set to include restricted content as well as standard content. Valid values for this parameter are include and exclude. By default, restricted content is excluded. Feed entries for videos that contain restricted content will contain the media:rating element.
string Restriction [get, set]
 The restriction parameter identifies the IP address that should be used to filter videos that can only be played in specific countries. We recommend that you always use this parameter to specify the end user's IP address. (By default, the API filters out videos that cannot be played in the country from which you send API requests. This restriction is based on your client application's IP address.) To request videos playable from a specific computer, include the restriction parameter in your request and set the parameter value to the IP address of the computer where the videos will be played e.g. restriction=255.255.255.255. To request videos that are playable in a specific country, include the restriction parameter in your request and set the parameter value to the ISO 3166 two-letter country code of the country where the videos will be played e.g. restriction=DE.
SafeSearchValues SafeSearch [get, set]
 The safeSearch parameter indicates whether the search results should include restricted content as well as standard content. YouTube will determine whether content is restricted based on the user's IP address or location, which you specify in your API request using the restriction parameter. If you do request restricted content, then feed entries for videos that contain restricted content will contain the >media:rating< element.

The following values are valid for this parameter:

ValueDescription noneYouTube will not perform any filtering on the search result set.</iterm> moderateYouTube should try to exclude the most explicit content from the search result set. Based on their content, search results could be removed from search results or demoted in search results.</iterm> strictYouTube should try to exclude all restricted content from the search result set. Based on their content, search results could be removed from search results or demoted in search results</iterm> para>The default value for this parameter is moderate.

para>SafeSearch filtering for the YouTube Data API is designed to function similarly to SafeSearch Filtering for Google WebSearch results. Please note that YouTube makes every effort to remove restricted content from search results in accordance with the SafeSearch setting that you specify. However, filters may not be 100% accurate and restricted videos may occasionally appear in search results even if you have specified strict SafeSearch filtering. If this happens, please flag the video by filing a complaint, which will help us to better identify restricted content.

para>Note: The safeSearch parameter was introduced in version 2.0 of the YouTube Data API and replaced the racy parameter, which was used in version 1.0.

DateTime StartDate [get, set]
 set's the mininum daterange value for the updated element
int StartIndex [get, set]
 Accessor method public int StartIndex.
UploadTime Time [get, set]
 accessor method public UploadTime Time
string Uploader [get, set]
 The uploader parameter, which is only supported for search requests, lets you restrict a query to YouTube partner videos. A YouTube partner is a person or organization that has been accepted into and participates in the YouTube Partner Program.

In an API response, a feed entry contains a partner video if the entry contains a media:credit tag for which the value of the yt:type attribute is partner.

.

Uri Uri [get, set]
 We do not hold on to the precalculated Uri. It's safer and cheaper to calculate this on the fly. Setting this loses the base Uri. Note that the result of this is effected by the UseSSL flag. so if you created this with a NON ssl string, but the flag states you want to use SSL, this will result in an HTTPS URI.
bool UseSSL [get, set]
 indicates if constructed feed URIs should use http or https
  • if you pass in a full URI, this one will get changed from http to https or the other way round. This is mostly relevant for hosted domains.

string VQ [get, set]
 The vq parameter, which is only supported for video feeds, specifies a search query term. YouTube will search all video metadata for videos matching the term. Video metadata includes titles, keywords, descriptions, authors' usernames, and categories.

Static Private Member Functions

static string CreateCustomUri (string userID, string path)

Private Attributes

string client
List< VideoFormatformats
string location
string locationRadius
string lr
string orderBy
string racy
string restriction
SafeSearchValues safeSearch
string uploader
UploadTime uploadTime = UploadTime.UploadTimeUndefined
string videoQuery

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index