#!/usr/local/bin/perl -w
###########################################
# youtube channels
# Mike Schilli, 2015 (cpan@perlmeister.com)
###########################################
use strict;
use lib "../lib";
use OAuth::Cmdline::Youtube;
use LWP::UserAgent;
use JSON qw( from_json );
use URI::Escape;

my $oauth = OAuth::Cmdline::Youtube->new( );

my $ua = LWP::UserAgent->new();
$ua->default_header( $oauth->authorization_headers );

my $resp = $ua->get(
    "https://www.googleapis.com/youtube/v3/channels?part=id&mine=true" );

if( $resp->is_error ) {
    die "Error: ", $resp->message(), $resp->content();
}

print $resp->decoded_content();

__END__

=head1 NAME

    youtube-channels - Display a user's Youtube channels

=head1 SYNOPSIS

    youtube-channels

=head1 DESCRIPTION

Display a user's Youtube channels. Make sure
to read the guide in OAuth::Cmdline::Youtube on how to register the app
and obtain an access token first.

=head1 LEGALESE

Copyright 2016 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 AUTHOR

2016, Mike Schilli <cpan@perlmeister.com>
