/usr/share/perl5/FlashVideo/Site/Nicovideo.pm is in get-flash-videos 1.25~git2012.06.27-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Nicovideo;
use strict;
use FlashVideo::Utils;
use URI::Escape;
sub find_video {
my ($self, $browser, $embed_url) = @_;
my $id = ($embed_url =~ /([ns]m\d+)/)[0];
die "No ID found\n" unless $id;
my $base = "http://ext.nicovideo.jp/thumb_watch/$id";
if($embed_url !~ /ext\.nicovideo\.jp\/thumb_watch/) {
$embed_url = "$base?w=472&h=374&n=1";
}
$browser->get($embed_url);
my $playkey = ($browser->content =~ /'thumbPlayKey': '([^']+)/)[0];
die "No playkey found\n" unless $playkey;
my $title = ($browser->content =~ /title: '([^']+)'/)[0];
$title =~ s/\\u([a-f0-9]{1,5})/chr hex $1/eg;
$browser->get($base . "/$playkey");
my $url = uri_unescape(($browser->content =~ /url=([^&]+)/)[0]);
return $url, title_to_filename($title, $id =~ /^nm/ ? "swf" : "flv");
}
1;
|