WWW::YoutubeViewer(3)

NAME
WWW::YoutubeViewer - A very easy interface to YouTube.

VERSION
Version 0.05

SYNOPSIS
    use WWW::YoutubeViewer;

    my $yv_obj = WWW::YoutubeViewer->new();
    ...

SUBROUTINES/METHODS

  new(%opts)
Returns a blessed object.

  set_prefer_https($bool)
Will use https:// protocol instead of http://.

  get_prefer_https()
Will return the value of prefer_https.

  get_start_index_var($page, $results)
Returns the start_index value for the specific variables.

  get_start_index()
Returns the start_index based on the page number and results.

  back_page_is_available($url)
Returns true if a previous page is available.

  escape_string($string)
Escapes a string with URI::Escape and returns it.

  list_to_gdata_arguments(%options)
Returns a valid string of arguments, with defined values.

  default_gdata_arguments()
Returns a string with the default gdata arguments.

  set_lwp_useragent()
Intializes the LWP::UserAgent module and returns it.

  get_accounts_oauth_url()
Creates an OAuth URL with the 'code' response type. (Google's authorization server)

  oauth_refresh_token()
Refresh the access_token using the refresh_token. Returns a JSON string or undef.

  oauth_login($code)
Returns a JSON string with the access_token, refresh_token and some other info.

The $code can be obtained by going to the URL returned by the "get_accounts_oauth_url()" method.

  prepare_key()
Returns a string, used as header, with the developer's key.

  prepare_access_token()
Returns a string. used as header, with the access token.

  lwp_get($url)
Get and return the content for $url.

  lwp_post($url, [@args])
Post and return the content for $url.

  lwp_mirror($url, $output_file)
Downloads the $url into $output_file. Returns true on success.

  get_content($url;%opts)
Returns a hash reference containing the URL and RESULTS:
    {url => '...', results => [...]}

Valid %opts:
    playlists => 1, comments => 1, videos => 1,
    channels => 1, channel_suggestions => 1,
    courses => 1,

  prepare_url($url)
Accepts a URL without arguments, appends the "default_arguments()" to it, and returns it.

  get_videos_from_category($cat_id)
Returns a list of videos from a categoryID.

  get_courses_from_category($cat_id)
Get the courses from a specific category ID. $cat_id can be any valid category ID from the EDU categories.

  get_video_lectures_from_course($course_id)
Get the video lectures from a specific course ID. $course_id can be any valid course ID from the EDU categories.

  get_video_lectures_from_category($cat_id)
Get the video lectures from a specific category ID. $cat_id can be any valid category ID from the EDU categories.

  get_movies($movieID)
Get movie results for $movieID.

  get_video_tops(%opts)
Returns the video tops for a specific feed_id. Valid %opts:
    (feed_id=>'...',cat_id=>'...',region_id=>'...',time_id=>'...')

  get_categories()
Returns the YouTube categories.

  get_educategories()
Returns the EDU YouTube categories.

  get_streaming_urls($videoID)
Returns a list of streaming URLs for a videoID. ({itag=>...}, {itag=>...}, {has_cc=>...})

  get_channel_suggestions()
Returns a list of channel suggestions for the current logged user.

  search(@keywords)
Search and return the video results.

  search_channels(@keywords)
Search and return the channel results.

  search_for_playlists(@keywords)
Search and return the playlist results.

  full_gdata_arguments(;%opts)
Returns a string with all the GData arguments.

Optional, you can specify in $opts{ignore} an ARRAY_REF with the keys that should be ignored.

  send_rating_to_video($videoID, $rating)
Send rating to a video. $rating can be either 'like' or 'dislike'.

  send_comment_to_video($videoID, $comment)
Send comment to a video. Returns true on success.

  subscribe_channel($username)
Subscribe to a user's channel.

  favorite_video($videoID)
Favorite a video. Returns true on success.

  like_video($videoID)
Like a video. Returns true on success.

  dislike_video($videoID)
Dislike a video. Returns true on success.

  get_video_comments($videoID)
Returns a list of comments for a videoID.

  get_disco_videos(\@keywords)
Search for a disco playlist and return its videos, if any. Undef otherwise.

  get_video_info($videoID)
Returns informations for a videoID.

  next_page($url;%opts)
Returns the next page of results. %opts are the same as for get_content().

  previous_page($url;%opts)
Returns the previous page of results. %opts are the same as for get_content().

  get_related_videos($videoID)
Returns the related videos for a videoID.

  get_favorites(;$user)
Returns the latest favorited videos for the current logged user.

  get_recommendations()
Returns a list of videos, recommended for you by Youtube.

  get_watch_history(;$user)
Returns the latest videos watched on Youtube.

  get_newsubscriptionvideos(;$user)
Returns the videos from the subscriptions for the current logged user.

  get_favorited_videos_from_username($username)
Returns the latest favorited videos for a given username.

  get_playlists_from_username($username)
Returns a list of playlists created by $username.

  get_videos_from_playlist($playlistID)
Returns a list of videos from playlistID.

  get_videos_from_username($username)
Returns the latest videos uploaded by a username.

  set_app_name($appname)
Set the application name.

  get_app_name()
Returns the application name.

  set_app_version($version)
Set the application version.

  get_app_version()
Returns the application version.

  get_v()
Returns the current version of GData implementation.

  set_key($dev_key)
Set the developer key.

  get_key()
Returns the developer key.

  set_client_id($client_id)
Set the OAuth 2.0 client ID for your application.

  get_client_id()
Returns the client_id.

  set_client_secret($client_secret)
Set the client secret associated with your client_id.

  get_client_secret()
Returns the client_secret.

  set_redirect_uri($redirect_uri)
A registered redirect_uri for your client ID.

  get_redirect_uri()
Returns the redirect_uri.

  set_access_token($token)
Set the 'Bearer' token type key.

  get_access_token()
Get the 'Bearer' access token.

  set_refresh_token($refresh_token)
Set the refresh_token. This value is used to refresh the access_token after it expires.

  get_refresh_token()
Returns the refresh_token

  get_www_content_type()
Returns the Content-Type header value used for GData.

  set_author($username)
Set the author value.

  get_author()
Returns the author value.

  set_duration($duration_id)
Set duration value. (ex: long)

  get_duration()
Returns the duration value.

  set_orderby()
Set the order-by value. (ex: published)

  get_orderby()
Returns the orderby value.

  set_hd($value)
Set hd value. $value can be either 'true' or undef.

  get_hd()
Returns the hd value.

  set_caption($value)
Set the caption value. ('true', 'false' or undef)

  get_caption()
Returns caption value.

  set_category($cat_id)
Set a category value. (ex: 'Music')

  get_category()
Returns the category value.

  set_safe_search($value)
Set the safe search sensitivity. (ex: strict)

  get_safe_search()
Returns the safe_search value.

  set_region($region_ID)
Set the regionID value for video tops. (ex: JP)

  get_region()
Returns the region value.

  set_time($time_id)
Set the time value. (ex: this_week)

  get_time()
Returns the time value.

  set_results([1-50])
Set the number of results per page. (max 50)

  get_results()
Returns the results value.

  set_page($i)
Set the page number value.

  get_page()
Returns the page value.

  set_categories_language($cat_lang)
Set the categories language. (ex: en-US)

  get_categories_language()
Returns the categories language value.

  get_categories_url()
Returns the YouTube categories URL.

  get_educategories_url()
Returns the EDU YouTube categories URL.

  set_debug($level_num)
Set the debug level. (valid: 0, 1, 2)

  get_debug()
Returns the debug value.

  set_config_dir($dir)
Set a configuration directory.

  get_config_dir()
Get the configuration directory.

  set_escape_utf8($bool)
If true, it escapes the keywords using uri_escape_utf8.

  get_escape_utf8()
Returns true if escape_utf8 is used.

  get_feeds_url()
Returns the GData feeds URL.

  set_http_proxy($value)
Set http_proxy value. $value must be a valid URL or undef.

  get_http_proxy()
Returns the http_proxy value.

  set_lwp_agent($agent)
Set a user agent for the LWP module.

  get_lwp_agent()
Returns the user agent value.

  set_lwp_env_proxy($bool)
Set the env_proxy value for LWP.

  get_lwp_env_proxy()
Returns the env_proxy value.

  set_lwp_keep_alive($bool)
Set the keep_alive value for LWP.

  get_lwp_keep_alive()
Returns the keep_alive value.

  set_lwp_timeout($sec).
Set the timeout value for LWP, in seconds. Default: 60

  get_lwp_timeout()
Returns the timeout value.

  get_oauth_url()
Returns the OAuth URL.

  get_video_info_url()
Returns the video_info URL.

  get_video_info_args()
Returns the video_info arguments.

AUTHOR
Trizen, "<trizenx at gmail.com>"

SEE ALSO
https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters

LICENSE AND COPYRIGHT
Copyright 2012-2013 Trizen.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

<http://www.perlfoundation.org/artistic_license_2_0>

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.