monsieurvideo / get-flash-videos

Download or play videos from various Flash-based video hosting sites, without having to use the Flash player.
Apache License 2.0
240 stars 68 forks source link

Couldn't extract video | Torontosun.com #210

Open Davidj361 opened 7 years ago

Davidj361 commented 7 years ago

http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque

I know this web page uses CanoeVideoStandalone.

~N~o~ ~p~l~u~g~i~n~s~ ~i~n~s~t~a~l~l~e~d~
~Trying to open plugin C:\Users\dj\AppData\Roaming/get_flash_videos/plugins/Www.pm
Trying to open plugin C:\Users\dj\AppData\Roaming/get_flash_videos/plugins/Torontosun.pm
Trying to open plugin C:\Users\dj\AppData\Roaming/get_flash_videos/plugins/Com.pm
-> GET http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque
<- 200 text/html;charset=UTF-8 (171697): UTF8 on, non-ASCII, 171697 characters 171703 bytes
Using method 'generic' plugin version 0.01 for http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque
Downloading http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque
-> GET http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque
<- 200 text/html;charset=UTF-8 30026 (171697): UTF8 on, non-ASCII, 171697 characters 171703 bytes
Error: No URLs found at get_flash_videos-1.25.92.perl line 10887.

Couldn't extract Flash movie URL. This site may need specific support adding,
or fixing.

Please confirm the site is using Flash video and if you have Flash available
check that the URL really works(!).

Check for updates by running: get_flash_videos-1.25.92.perl --update

If the latest version does not support this please open a bug
at http://code.google.com/p/get-flash-videos/ making sure you include
the output with --debug enabled. Alternatively, fix it yourself and send us
a pull request on Github: https://github.com/monsieurvideo/get-flash-videos
Couldn't download any videos.
pcwalden commented 7 years ago

I am guessing this site will require a plugin to be developed. This could take awhile until someone takes an interest to do it. If you want to give a try, please go ahead. In the meantime, can you change the Issue subject to include the "torontosun.com"?

Davidj361 commented 7 years ago

I managed to get video id and player id, but rtmpdump complains the connection being rejected:

FlashVideo::RTMPDownloader=HASH(0x3536948)
Running rtmpdump --rtmp 'rtmp://cp150446.edgefcs.net/ondemand?videoId=5303589262001&lineUpId=&pubId=1749345207&playerId=767886190001&playerTag=&affiliateId=' --flv 'SMC_-_Sun_Media_EN_-_Ontario_Premier_Kathleen_Wynne_pays_visit_to_a_mosque.flv' --app 'ondemand?videoId=5303589262001&lineUpId=&pubId=1749345207&playerId=767886190001&playerTag=&affiliateId=' --swfUrl 'http://admin.brightcove.com/viewer/federated/f_012.swf?bn=590&pubId=1749345207' --verbose --pageUrl 'http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque' --playpath 'mp4:1749345207/1749345207_5303656659001_5303589262001.mp4?__nn__=1497926354001' --auth 'mp4:1749345207/1749345207_5303656659001_5303589262001.mp4?__nn__=1497926354001&slist=1749345207/&auth=daEabaybDbsb4ccaTdeavdPcNagaZaac7aL-byOiAa-hca-llBBAqzx_ACxr_ECwB_FvB&aifp=bcosuds' --tcUrl 'rtmp://cp150446.edgefcs.net:1935/ondemand?videoId=5303589262001&lineUpId=&pubId=1749345207&playerId=767886190001&playerTag=&affiliateId='
RTMPDump v2.4
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
rtmpdump: DEBUG: Protocol : RTMP
_5303656659001_5303589262001.mp4?__nn__=1497926354001
DEBUG: tcUrl    : rtmp://cp150446.edgefcs.net:1935/ondemand?videoId=5303589262001&lineUpId=&pubId=1749345207&playerId=767886190001&playerTag=&affiliateId=
DEBUG: swfUrl   : http://admin.brightcove.com/viewer/federated/f_012.swf?bn=590&pubId=1749345207
DEBUG: pageUrl  : http://www.torontosun.com/2017/01/30/premier-kathleen-wynne-displays-grace-at-mosque
DEBUG: app      : ondemand?videoId=5303589262001&lineUpId=&pubId=1749345207&playerId=767886190001&playerTag=&affiliateId=
DEBUG: auth     : mp4:1749345207/1749345207_5303656659001_5303589262001.mp4?__nn__=1497926354001&slist=1749345207/&auth=daEabaybDbsb4ccaTdeavdPcNagaZaac7aL-byOiAa-hca-llBBAqzx_ACxr_ECwB_FvB&aifp=bcosuds
DEBUG: live     : no
DEBUG: timeout  : 30 sec
DEBUG: Setting buffer time to: 36000000ms
Connecting ...
rtmpdump: DEBUG: RTMP_Connect1, ... connected, handshaking
rtmpdump: DEBUG: HandShake: Type Answer   : 03
rtmpdump: WARNING: HandShake: client signature does not match!
DEBUG: Invoking connect
INFO: Connected...
rtmpdump: DEBUG: RTMP_ClientPacket, received: invoke 134 bytes
operty: <Name:              level, STRING:  error>
DEBUG: Property: <Name:               code, STRING: NetConnection.Connect.Rejected>
DEBUG: Property: <Name:        description, STRING: [ AccessManager.Reject ] : Access denied!>
DEBUG: (object end)
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <_error>
ERROR: rtmp server sent error
DEBUG: RTMP_ClientPacket, received: invoke 18 bytes
DEBUG: (object begin)
DEBUG: Property: NULL
DEBUG: (object end)
DEBUG: HandleInvoke, server invoking <close>
ERROR: rtmp server requested close
DEBUG: Closing connection.
Download failed, no valid file downloaded
Couldn't download any videos.

Ended up using Canoe.pm and made it as Torontosun.pm but changed a couple lines.

# Part of get-flash-videos. See get_flash_videos for copyright.
=pod
   Torontosun

   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::Torontosun;

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
  # Changed video_id to look at showVideo
  my $video_id  = ($browser->content =~ /showVideo.(\d+)/i)[0];
  my $player_id = ($browser->content =~ /player.SetPlayer.(\d+)/i)[0];

  debug "Extracted playerId: $player_id, videoId: $video_id"
    if $player_id or $video_id;

    # Might not be needed
    # if(!$video_id) {
    # if# Some pages use more complex video[x][3] type code..
    # ifmy $video_offset = ($browser->content =~ /player.SetVideo.\w+\[(\d+)/i)[0];
    # if$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 =~ /player = CanoeVideoStandalone\.create\(\);/i;
}

1;

I think the problem is the client signature? I have no idea how to see if it is nor how to fix it.

Maybe it's due to setPublisher from this?

// Selon le site, on retrouve le publisher id du site dans la configuration par site
        player.setPublisher(1749345207);

According to the site, the publisher id of the site can be found in the site configuration

Here's the javascript for the video & player:


    function showVideo(brightcodeId){

        // Effacer les anciens player
        $('#player_box').text('');

        var player = CanoeVideoStandalone.create();

        // Selon le site, on retrouve le publisher id du site dans la configuration par site
        player.setPublisher(1749345207);

        // Retrouver le chanel en fonction de la story
        player.setPlayer(767886190001);

        // Obtenir l'id du video
        player.setVideo(brightcodeId);

        // The video will always start when the player is loaded
        player.setAutoStart('false');

        if(Sunrise.Dfp.pageDfpTags) {
            var cmsid = 2314;
            var scp = '';

            for (var key in dfpcvarr) {
                var dfpcvval = dfpcvarr[key];
                scp += key + '%3D' + dfpcvval + '%26';
            }

            // Remove %26 at the end
            scp = scp.substring(0, scp.length-3);

            var preRollUrl = 'http://pubads.g.doubleclick.net/gampad/ads?iu=' + Sunrise.Dfp.Mapping.url
            + '&sz=640x480|320x240|321x241&ciu_szs=300x250,728x90&unviewed_position_start=1&output=xml_vast2&impl=s'
            + '&env=vp&gdfp_req=1&ad_rule=1&vad_type=linear&vpos=preroll&pod=1&min_ad_duration=0'
            + '&scp='+ scp + '&url='+ window.location.href 
            + '&max_ad_duration=30000&ppos=1&lip=true&cmsid='+ cmsid +'&videoID=' + brightcodeId;

            player.setAdServer(preRollUrl);
        }

        player.setStyle({width: 650, height: 360, bgcolor:  '#000000' });

        player.setContainer('#player_box');

        player.generatePlayer();
    }

    showVideo(5303589262001);

    $(function(){
        $('.video_canoe').click(function() {
            showVideo($(this).attr('rel'));
        });
    });