Downloading Directly From DailyMotion

Posted at

older notes:

Open a video, open developer-tools (CTRL + SHIFT + I)
mouse-click the play button and look for incoming requests looking like

The .TS (mimetype video/mp2t), a.k.a "MPEG-2 Transport Stream" is preety much similar to mp4 format.

I use Orbitdownloader, adding group of downloads with the following URL:

you can figure out sort-of the length of the segment, since each seg. is ~10 seconds,
and the body of the page (source html) has "buildPlayer({.......})..." which has
the part "client_embedder=&country=IL&length=2723&mode=vod&", divide the number by 10 and you'll get 272,


I've ignored any real-"length" calculation or estimation, and just added to Orbitdownloader the range of 0 to 299,
it have stopped after 273, so I've paused and deleted the rest,

joining the ts files to one mp4 is quite an "go ask google" thing..


another weird solutions..

ffmpeg -i "" -c:v copy -c:a copy -bsf:a aac_adtstoasc 93888629_mp4_h264_aac_hq.mp4
ffmpeg -i "" -c copy t1.ts
ffmpeg -i "" -c copy t2.ts

ffmpeg -i "" -c:v copy -c:a copy -bsf:a aac_adtstoasc 93888629_mp4_h264_aac_hq.mp4

newer notes:

I've I've found out that removing the /frag(...) part and replacing the .ts part with m3u8 works fine with ffmpeg, I've just used:
ffmpeg -i "" d.mp4

which will re-encode video and audio, it might take more time but will render a perfectly working video..

even newer notes:

now.. if you'll try to use copy stream to make things faster, which is a good idea,
ffmpeg -threads 4 -i "" -threads 4 -vcodec copy -acodec copy d2.mp4

you'll get:
[mp4 @ 04b21660] malformated aac bitstream, use -absf aac_adtstoasc
av_interleaved_write_frame(): Operation not permitted

but -absf aac_adtstoasc (by the doc.s -absf audio bitstream_filters) is deprecated,
using the newer directive is better: -bsf:a aac_adtstoasc

so the command should look something like:


even even newer notes:
I was looking over the page's's requests,
and I've noticed a manifest (just as before.. from the download.. stuff..)

looking at the page's source, seems that the body's html (well.. script..) code has it, 100% complete..

so sending a xhr to the address (along with the fact it is cross-domain friendly) should be fairly-reasonable..

opening the url in a new tab works fine too.. so.. minimal auth will work.
here is an example content for that

parsing the EXTM3U format can help you get various qualities the highers were the last two (by BANDWIDTH value).

there are two values, which seems to be two available proxies,
and (operating some logic here..)
I've noticed that the response-time header for the domain is exposed,
so the website may serve the the content from either of those proxies/cdn(s), the decisions is done at client side apparently which is kind'a weird (but still ok...)

so selecting the last one, and running:
ffmpeg -threads 4 -i "" -vcodec copy -acodec copy -bsf:a aac_adtstoasc  "eretz_nehederet_s13e04.mp4"

the #cell=core makes ffmpeg break..

I don't really want to escape stuff.. so I've just removed the "URI-hash" (#cell=core suffix)
and it works ok...


even newer^5 notes:
this code will extract the "main"-manifest, the one which has whole resolutions.

- I've using document.querySelector('html').cloneNode(true) as a trick,
cloning node will give you back the "from HTML source" initial rendering, so even if for some reason, to make things harder, some JavaScript will delete the script element from the page (leaving only the one in memory),
it won't matter, and still be operations.

- another way is fetching the entire page online using xhr, which is (same domain..) cross-domain-safe, and either parsing or text-matching to find it (the "main"-manifest that is..), but this way you'll be using the web again..

new^6 notes:

this is probably a better regex..

resulting with

new^7 notes:


will 'unescape' the backslash and possibly other characters without messing around with any additional regular-expressions and string-replace calls.

all you have to do is use the 'ffmpeg' solution
(download ffmpeg for windows from here, here or here - choose the 'static' version)

ffmpeg -i ___the_m3u8_url___ -threads 8 -vcodec copy -acodec copy -scodec copy output.mp4

you can later follow the guide at iCompile - FFMPEG Fixes Your Video Files to fix the output de-interlace, remove repeating frames and properly encode to play at mobile-devices or to be streamed / uploaded to youtube..