git://git.camperquake.de
/
videosite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change alert box detection
[videosite.git]
/
videosite
/
YouTubeGrabber.pm
diff --git
a/videosite/YouTubeGrabber.pm
b/videosite/YouTubeGrabber.pm
index
83cee59
..
199143e
100644
(file)
--- a/
videosite/YouTubeGrabber.pm
+++ b/
videosite/YouTubeGrabber.pm
@@
-14,6
+14,8
@@
use videosite::GrabberBase;
use LWP::UserAgent;
use HTTP::Cookies;
use HTML::TokeParser;
use LWP::UserAgent;
use HTTP::Cookies;
use HTML::TokeParser;
+use HTML::Entities qw(decode_entities);
+use Encode;
use Data::Dumper;
use videosite::JSArrayParser;
use Data::Dumper;
use videosite::JSArrayParser;
@@
-73,6
+75,8
@@
sub _parse {
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
+ $self->debug("Matched id %s from pattern %s", $2, $pattern);
+
$preflist = $preflist{$quality};
$self->debug("Quality: %s, preflist: [%s]", $quality, join(", ", @{$preflist}));
$preflist = $preflist{$quality};
$self->debug("Quality: %s, preflist: [%s]", $quality, join(", ", @{$preflist}));
@@
-100,6
+104,11
@@
sub _parse {
if ('meta' eq $tag->[0]) {
if ('title' eq $tag->[1]->{'name'}) {
$metadata->{'TITLE'} = $tag->[1]->{'content'};
if ('meta' eq $tag->[0]) {
if ('title' eq $tag->[1]->{'name'}) {
$metadata->{'TITLE'} = $tag->[1]->{'content'};
+ # Convert HTML entities in the title. This is a bit convoluted.
+ $metadata->{'TITLE'} = encode("utf8",
+ decode_entities(
+ decode("utf8", $metadata->{'TITLE'})));
+
$self->debug('Title found: %s', $metadata->{'TITLE'});
}
} elsif ('script' eq $tag->[0]) {
$self->debug('Title found: %s', $metadata->{'TITLE'});
}
} elsif ('script' eq $tag->[0]) {
@@
-184,7
+193,7
@@
sub _parse {
last SWF_ARGS;
}
} elsif ('div' eq $tag->[0]) {
last SWF_ARGS;
}
} elsif ('div' eq $tag->[0]) {
- if (exists($tag->[1]->{'class'}) and ('
errorBox
' eq $tag->[1]->{'class'})) {
+ if (exists($tag->[1]->{'class'}) and ('
yt-alert-content
' eq $tag->[1]->{'class'})) {
$self->error("Could not get video data for youtube %s: %s",
$metadata->{'ID'}, $p->get_trimmed_text());
return undef;
$self->error("Could not get video data for youtube %s: %s",
$metadata->{'ID'}, $p->get_trimmed_text());
return undef;