Leeching Streaming Videos With Node.js X-ray and FFmpeg

In the last post I've mentioned the The 6th Annual International Cybersecurity Conference and the great videos it have. But, these videos are streamed with RTSP into a Flash video player (JW-Player) and it's not fun to watch it this way. It'll be much better to view it offline in your favorite player. (VLC can play these rtsp directly but does it badly)

I made a simple node.js script that scraps the page using x-ray and download the videos using ffmpeg.

X-ray is a powerful and easy to use web-scrapper for node.js. FFMPEG is the swiss army knife for everything video.

Here x-ray is used to get all the videos for a certain subject (every page holds videos of 1 subject)

xray(link, '.itemContainer.itemContainerLast h3 > a',  
        [{
            file: '',
            src: '@href'
        }]
    )

Than I use the Node's child-process to spawn the ffmpeg with the right params. Mainly the video source url and the name to save it with:
var cmd = 'ffmpeg -i {url} -acodec copy -vcodec copy "{file}"';

I'm sure anyone will enjoy these security videos ;) But, this script can also serve as an example for leeching other types of streaming videos.

Script is in here:
https://github.com/guy-a/cyberweek2016

Guy A

Read more posts by this author.