#!/usr/bin/env perl
use strict;
use warnings;

use Data::Dumper;
use WebService::YTSearch;

my $key = shift || $ENV{YOUTUBE_API_KEY} || die "Usage: perl $0 12345abcde query num max\n";
my $id  = shift || 'QhD_OT4wvX0';

my $ws = WebService::YTSearch->new(key => $key);

my $query = { videoId => $id, cmd => 'commentThreads', textFormat => 'plainText' };

my $r = $ws->search(%$query);
print Dumper $r;
# for my $item (@{ $r->{items} }) {
#     print $item->{snippet}{textOriginal}, "\n\n";
# }
