2

为什么media:group它发生在dom中不起作用?

#!/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 回答