- $p->handler(start => \@accum, "tagname, attr");
- $p->handler(text => \@text, "text");
- $p->report_tags(qw(embed div));
- $p->utf8_mode(1);
- $p->parse($content);
-
- # Look for the title in the div tags
- foreach $e (@accum) {
- if ('div' eq $e->[0]) {
- if ((exists($e->[1]->{'class'})) and ('title' eq $e->[1]->{'class'})) {
- $metadata->{'TITLE'} = $e->[1]->{'title'};
+ $p = HTML::TokeParser->new(\$content);
+
+ # Look for the title
+ if ($p->get_tag('title')) {
+ $metadata->{'TITLE'} = $p->get_text();
+ $metadata->{'TITLE'} =~ s/\s?- Google Video$//s;
+ }
+
+ if ($quality eq 'h264') {
+ while ($e = $p->get_tag('a')) {
+ if ((exists($e->[1]{'id'})) and ('ipoddownloadlink' eq $e->[1]{'id'})) {
+ $metadata->{'DLURL'} = $e->[1]{'href'};
+ last;