diff options
author | Tomáš Čech <sleep_walker@suse.cz> | 2013-04-04 23:55:28 +0200 |
---|---|---|
committer | Tomáš Čech <sleep_walker@suse.cz> | 2013-04-04 23:55:28 +0200 |
commit | 9536516c757df88573d991662cf089af8ee288bf (patch) | |
tree | 6bf2bbf56035a557d02773f8d3e5f7eb8b9845ae | |
parent | 06e376b1ea692f0bb2df2d228fc87a53d028e19f (diff) | |
download | get-flash-videos-9536516c757df88573d991662cf089af8ee288bf.tar.gz |
let there be support for video44.net
-rw-r--r-- | lib/FlashVideo/Site/Video44.pm | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/FlashVideo/Site/Video44.pm b/lib/FlashVideo/Site/Video44.pm new file mode 100644 index 0000000..4218bcd --- /dev/null +++ b/lib/FlashVideo/Site/Video44.pm @@ -0,0 +1,51 @@ +# Part of get-flash-videos. See get_flash_videos for copyright. +package FlashVideo::Site::Video44; + +use strict; +use FlashVideo::Utils; +use URI::Escape; + +our $VERSION = '0.01'; +sub Version() { $VERSION; } + +sub find_video { + my ($self, $browser, $embed_url) = @_; + + my $flashvars = ""; + my $file = ""; + my $url = ""; + my $name = ""; + + + $browser->get($embed_url); + # get configuration passed to flash player + if ($browser->content =~ /\s*<param name="flashvars"\s*value="([^"]+)" \/>/) { + $flashvars = $1; + } else { + # if we can't get it, just leave as the video URL is there + debug("Can't find flashvars"); + return; + } + + debug ("Flashvars: " . $flashvars); + + # in the configuration there is also URL we're looking for + if ($flashvars =~ /&file=(http[^&]+)&/) { + $file = $1; + } else { + debug("Can't find file"); + return; + } + + debug("File: " . $file); + + $url = uri_unescape($file); + debug("URL: '" . $url . "'"); + + # URL ends with filename + $name = $url; + $name =~ s/.*\/([^\/]+)/$1/; + return $url, title_to_filename($name); +} + +1; |