sid_com
sid_com

Reputation: 25117

Mojo::DOM: Do some characters need special escaping?

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

Answers (1)

Marcus Ramberg
Marcus Ramberg

Reputation: 401

Because media: is the namespace? if you change the last line to at('group') it returns 'media:group'

Upvotes: 5

Related Questions