diff options
author | zakflash <zakflashvideo@gmail.com> | 2012-11-08 11:30:10 -0800 |
---|---|---|
committer | zakflash <zakflashvideo@gmail.com> | 2012-11-08 11:30:10 -0800 |
commit | dc5f34306a3ac7dbd0037d7f16ce737b0686d009 (patch) | |
tree | a8d5446648f5fe11edd3f053b208723afd01fbbe | |
parent | 1538eeae6e6e3c2d7a3689bf4c0431d45759e1f0 (diff) | |
parent | b0ccdd33f5a4682fa25ea88f83fd113c7bebd721 (diff) | |
download | get-flash-videos-dc5f34306a3ac7dbd0037d7f16ce737b0686d009.tar.gz |
Merge pull request #81 from njtaylor/master
Fix issue 446, compile error on Debian, combined generation
-rw-r--r-- | lib/FlashVideo/Mechanize.pm | 21 | ||||
-rw-r--r-- | lib/FlashVideo/Site/Ima.pm | 5 | ||||
-rw-r--r-- | lib/FlashVideo/Site/Kanal5play.pm | 2 | ||||
-rw-r--r-- | lib/FlashVideo/Site/Youtube.pm | 2 | ||||
-rw-r--r-- | utils/combine-head | 2 |
5 files changed, 20 insertions, 12 deletions
diff --git a/lib/FlashVideo/Mechanize.pm b/lib/FlashVideo/Mechanize.pm index bc799db..649a21d 100644 --- a/lib/FlashVideo/Mechanize.pm +++ b/lib/FlashVideo/Mechanize.pm @@ -1,6 +1,7 @@ # Part of get-flash-videos. See get_flash_videos for copyright. package FlashVideo::Mechanize; use WWW::Mechanize; +use LWP::Protocol::https; use FlashVideo::Downloader; use Encode (); @@ -15,23 +16,27 @@ sub new { my $proxy = $App::get_flash_videos::opt{proxy}; if ($proxy) { - if ($proxy =~ /^(\w+):?(\d+)?$/) { + if ($proxy =~ m%^(\w+://)?([.\w-]+)(:\d+)?$%) { # Proxy is in format: # localhost:1337 # localhost + # [socks|http|...]://localhost:8080 # Add a scheme so LWP can use it. # Other formats are passed to LWP directly. - my ($host, $port) = ($1, $2); + my ($scheme, $host, $port) = ($1, $2, $3); - $port ||= 1080; # socks by default + $scheme ||= "socks://"; + my $sndport = ":8080"; + $sndport = ":1080" if ($scheme =~ /socks/); + $port ||= $sndport; # socks by default - $proxy = "socks://$host:$port"; + $proxy = $scheme.$host.$port; - print STDERR "Using proxy server $proxy\n" - if $App::get_flash_videos::opt{debug}; - - $browser->proxy([qw[http https]] => $proxy); } + print STDERR "Using proxy server $proxy\n" + if $App::get_flash_videos::opt{debug}; + + $browser->proxy([qw[http https]] => $proxy); } if($browser->get_socks_proxy) { diff --git a/lib/FlashVideo/Site/Ima.pm b/lib/FlashVideo/Site/Ima.pm index a928e16..54a35c9 100644 --- a/lib/FlashVideo/Site/Ima.pm +++ b/lib/FlashVideo/Site/Ima.pm @@ -24,9 +24,10 @@ sub find_video { } sub can_handle { - my($self, $browser) = @_; + my($self, $browser, $url) = @_; - return $browser->uri->host =~ /ima\.umn\.edu/i; + my $host = URI->new($url)->host; + return $host =~ /ima\.umn\.edu/i; } 1; diff --git a/lib/FlashVideo/Site/Kanal5play.pm b/lib/FlashVideo/Site/Kanal5play.pm index 2b37ea8..b750efe 100644 --- a/lib/FlashVideo/Site/Kanal5play.pm +++ b/lib/FlashVideo/Site/Kanal5play.pm @@ -36,7 +36,7 @@ sub find_video { my ($playpath) = $json->{streams}[0]->{source}; my $i; - foreach $i (keys @{ $json->{streams} }) { + foreach $i (keys %{ $json->{streams} }) { my ($rate) = int($json->{streams}[$i]->{bitrate}); if($bitrates->{$prefs->{quality}} == $rate){ $playpath = $json->{streams}[$i]->{source}; diff --git a/lib/FlashVideo/Site/Youtube.pm b/lib/FlashVideo/Site/Youtube.pm index ce84859..0abcf15 100644 --- a/lib/FlashVideo/Site/Youtube.pm +++ b/lib/FlashVideo/Site/Youtube.pm @@ -67,7 +67,7 @@ sub find_video { my $video_id; if ($browser->content =~ /(?:var pageVideoId =|(?:CFG_)?VIDEO_ID'?\s*:)\s*'(.+?)'/ - || $browser->content =~ /video_id=([^&]+)/ + || $browser->content =~ /[&?]video_id=([^&"]+)/ || $embed_url =~ /v=([^&]+)/ || $browser->content =~ /&video_id=([^&]+)&/) { $video_id = $1; diff --git a/utils/combine-head b/utils/combine-head index 88da0d7..4c70027 100644 --- a/utils/combine-head +++ b/utils/combine-head @@ -13,6 +13,8 @@ use HTTP::Cookies (); use HTTP::Config (); use HTTP::Request::Common (); use LWP::Protocol::http (); +use LWP::Protocol::https (); +use Encode::Locale (); use XML::Simple (); use WWW::Mechanize::Link (); |