Reputation: 25117
Why does media:group
not work though it occurs in the 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
Upvotes: 2
Views: 176
Reputation: 401
Because media: is the namespace? if you change the last line to at('group') it returns 'media:group'
Upvotes: 5