2

media:groupdomで発生するのに動かないのはなぜ?

#!/usr/bin/env perl
use warnings;
use 5.12.0;
use Mojo::UserAgent;

my $ua = Mojo::UserAgent->new();

my $id = 'E7511681ABEA8635';
my $url = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?v=2';
my $tx = $ua->get( $url );

say $tx->res->dom->at( 'category' )->type;
say $tx->res->dom->at( 'media:group' )->type;

# category
# Can't call method "type" on an undefined value at ./perl.pl line 13
4

1 に答える 1

5

media: は名前空間なので? 最後の行を at('group') に変更すると、'media:group' が返されます

于 2012-04-27T11:42:52.730 に答える