为什么 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
最佳答案
因为media:是命名空间吗?如果将最后一行更改为 at('group') 它将返回 'media:group'
关于perl - Mojo::DOM:某些字符需要特殊转义吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10349727/