aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzakflash <zakflashvideo@gmail.com>2013-01-02 12:29:20 -0800
committerzakflash <zakflashvideo@gmail.com>2013-01-02 12:29:20 -0800
commitf63bf761cee5d51cba286903481a35e90d3acb3f (patch)
tree7f960876ddba5aaaddd43e381be103606ef92a39
parent146dfdc48bd28f86064ad9bceeac53db7a9b9600 (diff)
parent188f1450a2d227d5863a454fdf45222257a5e511 (diff)
downloadget-flash-videos-f63bf761cee5d51cba286903481a35e90d3acb3f.tar.gz
Merge pull request #86 from acronymized/master
Fixed Liveleak
-rw-r--r--lib/FlashVideo/Site/Liveleak.pm45
1 files changed, 7 insertions, 38 deletions
diff --git a/lib/FlashVideo/Site/Liveleak.pm b/lib/FlashVideo/Site/Liveleak.pm
index 07c48e2..6465c21 100644
--- a/lib/FlashVideo/Site/Liveleak.pm
+++ b/lib/FlashVideo/Site/Liveleak.pm
@@ -7,47 +7,16 @@ use FlashVideo::Utils;
sub find_video {
my ($self, $browser, $embed_url) = @_;
- # Get file embed tag
- my $file_embed_tag;
- if ($browser->content =~ /file_embed_tag(?:%3D|=)(\w+)\W/) {
- $file_embed_tag = $1;
- }
- else {
- die "Unable to get file_embed_tag";
- }
-
- $browser->get("http://www.liveleak.com/playlist_new.php?file_embed_tag=$file_embed_tag");
-
- if (!$browser->success) {
- die "Couldn't download LiveLeak playlist: " . $browser->response->status_line();
- }
-
- # Response is XML but using XML::Simple is overkill.
- my $video_url;
- if ($browser->content =~ m'<location>(http://.*?)</location>') {
- $video_url = $1;
- }
- else {
- die "Unable to extract LiveLeak video URL";
- }
-
- # URL might be a redirect
- if (my $redirected_url = $browser->head($video_url)->header('Location')) {
- $video_url = $redirected_url;
+ my $url;
+ if ($browser->content =~ /file: "([^"]+)"/) {
+ $url = $1;
+ } else {
+ die "Unable to extract video url";
}
- $browser->back();
-
- # Figure out title
- my $title;
- if ($browser->content =~ m'<h4 id="s_hd">(.*?)</h4>') {
- $title = $1;
- }
- else {
- $title = extract_title($browser);
- }
+ (my $title = extract_title($browser)) =~ s/LiveLeak\.com - //;
- return $video_url, title_to_filename($title);
+ return $url, title_to_filename($title, "mp4");
}
1;