Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git@github.com:monsieurvideo/get-flash-videos

  • Loading branch information...
commit bba2e1b21f6364c5176e50f188d8caf88ba1d425 2 parents 443af43 + dcfedaa
@monsieurvideo monsieurvideo authored
Showing with 48 additions and 1 deletion.
  1. +44 −0 FlashVideo/Site/Tva.pm
  2. +1 −1  get_flash_videos
  3. +3 −0  t/urls
View
44 FlashVideo/Site/Tva.pm
@@ -0,0 +1,44 @@
+# Part of get-flash-videos. See get_flash_videos for copyright.
+=pod
+ Uses TVA/Canoe-Specific way to get the brightcove metadata,
+ then forwards to the brightcove module.
+
+ TVA/Canoe live streaming
+ expects URL of the form
+ http://tva.canoe.ca/dws/?emission=xxxxxxx
+=cut
+package FlashVideo::Site::Tva;
+
+use strict;
+use FlashVideo::Utils;
+use base 'FlashVideo::Site::Brightcove';
+
+sub find_video {
+ my ($self, $browser, $embed_url) = @_;
+
+ # look inside script that generates CanoeVideoStandalone object
+ my $video_id = ($browser->content =~ /CanoeVideoStandalone.SetVideo.(\d+)/i)[0];
+ my $player_id = ($browser->content =~ /CanoeVideoStandalone.SetPlayer.(\d+)/i)[0];
+
+ debug "Extracted playerId: $player_id, videoId: $video_id"
+ if $player_id or $video_id;
+
+ if(!$video_id) {
+ # Some pages use more complex video[x][3] type code..
+ my $video_offset = ($browser->content =~ /CanoeVideoStandalone.SetVideo.\w+\[(\d+)/i)[0];
+ $video_id = ($browser->content =~ /videos\[$video_offset\].+'(\d+)'\s*\]/)[0];
+ }
+
+ die "Unable to extract Brightcove IDs from page"
+ unless $player_id and $video_id;
+
+ return $self->amfgateway($browser, $player_id, { videoId => $video_id, } );
+}
+
+sub can_handle {
+ my($self, $browser, $url) = @_;
+
+ return $browser->content =~ /CanoeVideoStandalone\.GeneratePlayer\(\);/i;
+}
+
+1;
View
2  get_flash_videos
@@ -4,7 +4,7 @@
#
# http://code.google.com/p/get-flash-videos/
#
-# Copyright 2009, zakflash and MonsieurVideo
+# Copyright 2009, 2010 zakflash, MonsieurVideo and contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain a
View
3  t/urls
@@ -168,6 +168,9 @@ http://www.tou.tv/en-audition-avec-simon/S01E07
# Seesaw
http://www.seesaw.com/TV/Comedy/b-8559-Fonejacker
+# TVA
+http://tva.canoe.ca/emissions/dieumerci/video/52471.html?id=1
+
## Generic
# Creativity-online - link expired
Please sign in to comment.
Something went wrong with that request. Please try again.