Uh-oh! This technique no longer works since Noovo changed how it uses Brightcove's API. Please use the new method by following this link: Easily download Noovo.ca videos in two clicks
The goal: download noovo.ca video files to your hard drive so you can watch them offline later
I'm going to walk through the trial-and-error process I used to figure out how to download video files from the V Télé and MusiquePlus web platform so you can take them wherever you want. We'll do the whole thing using Chrome alone with no extra tools required. Why Chrome? Because it's the most popular browser right now. Personally, I prefer Firefox for this kind of digging, but hey, who really cares.
Keep in mind that the hidden goal is also to automate this whole process later on. So we're going to dig a little deeper than strictly necessary to understand how the developers structured their app.
Alright, let's dive in!
Find a video and get set up
- Let's pick a show I like: http://noovo.ca/emissions/ca-va-brasser/episodes.
- Now let's pick a short clip to make testing faster, right-click it, and select
Open link in incognito window. That gives us a private tab with this URL loaded: http://noovo.ca/videos/ca-va-brasser/mousse-chocolat-et-the-kruhnen-dtpa_82975. - Make sure no browser extensions (like AdBlock) are running.
- Next, let's disable Flash so the site is forced to serve video over plain HTTP only.
- Open chrome://plugins/ in another tab.
- Click
Disable.
Flash can use other streaming protocols like RTMP, which is a bit trickier to download.
Inspecting network requests to see how noovo.ca delivers video
Reload with the console open:
- Switch back to the tab with our chosen episode.
- Open the developer console with
F12. - Refresh the page and wait for the video to start playing.
- We can now see every network request the page makes right in the console.
Digging through the requests to see what's going on:
- We're looking for video, so it makes sense to check if the browser is downloading a standard video file over HTTP directly. Type
.mp4into theFilterbox to isolate HTTP requests for MP4 files. Huh, nothing at all. Let's try.flv,.mpeg,.mpg. Still nothing. - So now we know the site isn't loading full video files directly... it's probably streaming them over a protocol like HLS or Dash.
- Let's start with HLS and look for a playlist by filtering on
m3u8this time. Aha! Requests show up, which means it uses HLS by default. Now we're getting somewhere! - Let's inspect the full URL and contents of the first file by right-clicking it and choosing
Open link in new tab, then break it down:- The URL
http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=4293298759001&pubId=618566855001tells us that noovo.ca uses the video streaming platform Brightcove, a very common choice among TV broadcasters who don't want to build that infrastructure themselves. - That URL also includes a videoId:
4293298759001. No idea where that comes from yet. - Inside the file, we see the same videoId
4293298759001, a few assetId values, and, best of all, that the video is available in 4 different resolutions and bitrates:
- The URL
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000,RESOLUTION=416x232
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293365253001&pubId=618566855001&videoId=4293298759001
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293364503001&pubId=618566855001&videoId=4293298759001
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000,RESOLUTION=416x232
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293365786001&pubId=618566855001&videoId=4293298759001
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=664000,RESOLUTION=640x360
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293388608001&pubId=618566855001&videoId=4293298759001
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1064000,RESOLUTION=960x540
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293379212001&pubId=618566855001&videoId=4293298759001
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1664000,RESOLUTION=1280x720
http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=4293375897001&pubId=618566855001&videoId=4293298759001Digging a little deeper to locate the actual files:
- Let's see how the page gets that Brightcove videoId in the first place, because that ID is almost certainly our ticket to finding the full MP4 files.
You can always download HLS segments and stitch them back together with FFmpeg, but it's way simpler to grab the full MP4 files directly. Laziness is a great driver for automation.
- Let's view the page's HTML source using
CTRL-Uand search for4293298759001. Nothing.
If the page source doesn't contain the videoId, JavaScript is probably fetching it from an API. Developers love making their lives easier by building standardized APIs that feed data to multiple frontends from a single backend.
- So let's search the console for a request containing
api, filter by that text, and look atxhr(XMLHttpRequest). Ooh, here's an interesting URL: http://api.noovo.ca/api/v1/pages/single-episode/ca-va-brasser/mousse-chocolat-et-the-kruhnen-dtpa_82975. - First, what jumps right out is that the end of the URL matches the page we're currently on. Awesome! That'll make automation a breeze later.
- Second, looking at its JSON response, we spot our videoId
4293298759001, here named brightcoveId:
{
"status":"success",
"data":{
"createdAt":"2016-09-09T20:07:39.338Z",
"slug":"mousse-chocolat-et-the-kruhnen-dtpa_82975",
"show":{
"slug":"ca-va-brasser",
"title":"Ça va brasser!",
"productionType":"produite",
"url":"",
"webtv":false,
"id":"57c0a8c45f26ffcc4312653b"
},
"publishDate":"2015-06-15T19:51:00.000Z",
"contentType":2,
"title":"Mousse chocolat et thé | Kruhnen (DTPA)",
"brightcoveId":"4293298759001",
"description":"",
"duration":147,
"source":"vtele",
"image":{
"width":680,
"height":382,
"mediaType":"image",
"trackingPixel":"",
"credits":"",
"caption":"",
"url-home-slideshow":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg/home-slideshow",
"url-web-avatar":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg/web-avatar",
"url-page-header":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg/page-header",
"url-list-thumbnail":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg/list-thumbnail",
"url-list":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg/list",
"url":"http://api.noovo.ca/api/v1/medias/57d3168b898c0d9d322e259e.jpg",
"id":"57d3168b898c0d9d322e259e"
},
"themes":[
{
"title":"Cuisine",
"slug":"cuisine",
"subthemes":[],
"color":"#01665e",
"id":"56defbc7ee05300c05caddd4"
}
],
"viewsCount":148,
"featuredDate":null,
"featured":false,
"popularity":-1,
"popularity_monthly":-1,
"moods":[
"571e73efc2a8524e30b93481",
"56def5664b4804c660c6bd80",
"56def5664b4804c660c6bd7c"
],
"tags":[],
"publishState":"prod",
"expireSoon":false,
"deletedFromBrightcove":false,
"id":"57d3168bc9a67a8d32428d0c"
}
}We now know how the video is streamed, which provider serves it, and how to look up its unique ID. That should be plenty to ask Brightcove for what we really want.
Figuring out how to get the raw video files
Brightcove provides an API to its customers, like pretty much every SaaS provider out there. A quick Google search for brightcove api brings up their docs right away. One particularly interesting page is this one: Accessing Video Content with the Media API.
In that section of the docs, we learn that we can query video metadata using a URL structured like this:
http://api.brightcove.com/services/library?command=find_video_by_id&video_id=1520880903001&video_fields=name,length,FLVURL&media_delivery=http&token=jskS1rEtQHy9exQKoc14IcMq8v5x2gCP6yaB7d0hraRtO__6HUuxMg..
Great, we already have the videoId. What we don't have yet is the token. Let's see if we can get lucky with Google:
- Search for
noovo api.brightcove.com find_video_by_id media_delivery token. Nothing. - Hmm, maybe try the network's old name,
vtélé. Let's search forvtele api.brightcove.com find_video_by_id media_delivery token. Still nothing. - Let's check GitHub. Maybe someone already built an add-on for a media centre like Kodi that we can borrow from: https://github.com/search?utf8=%E2%9C%93&q=noovo+brightcove. Hmm, nope.
Kodi, formerly known as XBMC, is famous for its huge ecosystem of unofficial add-ons that let you stream from all kinds of platforms without leaving its interface. Everything is open source and written in Python, making it a goldmine when you're hunting for API details.
- Wait... let's try GitHub again with vtele this time: https://github.com/search?utf8=%E2%9C%93&q=vtele+brightcove. Aha! No code results, but someone opened an Issue: https://github.com/spmjc/plugin.video.freplay/issues/52.
- Opening up that Issue reveals this glorious token:
2sgr1KCsKKJXcqUFQdti_mXZAhdNB-wCFwCbGW6lz5atwI1QTrElxQ..BINGO!
How that person found the token doesn't really matter right now, but if you're curious: you can usually sniff it by running a mobile device (like an iPad) through a debugging proxy. Mobile app developers often skip server-to-server proxy calls and hit the API directly from the device for performance, leaving tokens right out in the open.
Grabbing the video files
Now that we have both the token and the videoId, we should in theory be able to ask Brightcove for the available video files.
Let's try this URL:
http://api.brightcove.com/services/library?command=find_video_by_id&video_id=4293298759001&video_fields=name,length,FLVURL&media_delivery=http&token=2sgr1KCsKKJXcqUFQdti_mXZAhdNB-wCFwCbGW6lz5atwI1QTrElxQ..
Oh yeah! Now we're talking:
{
"name":"Mousse chocolat et thé | Kruhnen (DTPA)",
"length":146588,
"FLVURL":"http:\/\/uds.ak.o.brightcove.com\/618566855001\/618566855001_4293368125001_4293298759001.mp4"
}So we have an API call that gives us a direct HTTP link to download the MP4. That said, it only gives us one quality instead of the 4 bitrates/resolutions we saw earlier. We just need to figure out which parameter to pass to Brightcove's API to get all of them.
Looking a bit closer at the docs (http://docs.brightcove.com/en/video-cloud/media/references/reference.html#Video_Read), we see that you can choose which fields are returned, and one of them is renditions.
That's exactly what we need, so let's try this URL:
Attaboy!! Finally, we get all 4 MP4 choices right in the JSON response:
{
"renditions":[
{
"audioOnly":false,
"controllerType":"DEFAULT",
"displayName":"CVB150615_11h00_s04e03.mov",
"encodingRate":1148856,
"frameHeight":404,
"frameWidth":720,
"id":4293368136001,
"referenceId":null,
"remoteStreamName":null,
"remoteUrl":null,
"size":21214406,
"uploadTimestampMillis":1434138086274,
"url":"http:\/\/uds.ak.o.brightcove.com\/618566855001\/618566855001_4293368136001_4293298759001.mp4",
"videoCodec":"H264",
"videoContainer":"MP4",
"videoDuration":146588
},
{
"audioOnly":false,
"controllerType":"DEFAULT",
"displayName":"CVB150615_11h00_s04e03.mov",
"encodingRate":780856,
"frameHeight":360,
"frameWidth":640,
"id":4293368125001,
"referenceId":null,
"remoteStreamName":null,
"remoteUrl":null,
"size":14468970,
"uploadTimestampMillis":1434138082765,
"url":"http:\/\/uds.ak.o.brightcove.com\/618566855001\/618566855001_4293368125001_4293298759001.mp4",
"videoCodec":"H264",
"videoContainer":"MP4",
"videoDuration":146588
},
{
"audioOnly":false,
"controllerType":"DEFAULT",
"displayName":"CVB150615_11h00_s04e03.mov",
"encodingRate":1748856,
"frameHeight":720,
"frameWidth":1280,
"id":4293368099001,
"referenceId":null,
"remoteStreamName":null,
"remoteUrl":null,
"size":32161904,
"uploadTimestampMillis":1434138079650,
"url":"http:\/\/uds.ak.o.brightcove.com\/618566855001\/618566855001_4293368099001_4293298759001.mp4",
"videoCodec":"H264",
"videoContainer":"MP4",
"videoDuration":146588
},
{
"audioOnly":false,
"controllerType":"DEFAULT",
"displayName":"CVB150615_11h00_s04e03.mov",
"encodingRate":512856,
"frameHeight":268,
"frameWidth":480,
"id":4293368106001,
"referenceId":null,
"remoteStreamName":null,
"remoteUrl":null,
"size":9565066,
"uploadTimestampMillis":1434138079982,
"url":"http:\/\/uds.ak.o.brightcove.com\/618566855001\/618566855001_4293368106001_4293298759001.mp4",
"videoCodec":"H264",
"videoContainer":"MP4",
"videoDuration":146588
}
]
}Let's download
We're pretty much done. Now we can just download whichever HTTP link we want. For instance, if we open this URL:
http://uds.ak.o.brightcove.com/618566855001/618566855001_4293368106001_4293298759001.mp4
We can just hit CTRL-S to save it and close the tab once the download starts.
