Video download project.
Created by Daniil Gentili.
This project is licensed under the terms of the AGPLv3 license.
The programs included in this project can be used to download videos from any generic site including the Italian Rai Television website (including rai replay and iframe videos), the italian Mediaset website (including iframes like the ones on the Witty TV website), the LA7 website, and the Dplay website. And thanks to youtube-dl now they support lots of other websites!
This project features:
-
A Bash script that can be installed on
-
iOS and even on
-
An API!
-
An Android app!
-
And even a web version!
-
That can be incorporated in other websites!
Both the API and the web version use a database.
This project also features a web version.
The source code of the page can be viewed here.
I used the following programs in the web version:
And used the following theme as a base:
You can incorporate this script in your website!
Just include jquery and the video-dl script with:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//daniil.it/video-dl/video-dl.min.js"></script>
Or install it using npm.
npm install video-dl
Here's a list of the functions and the usage instructions.
video_dl(output, inputurl, dlsupport, messageoutput)
example: #result.
example: $("input#urljs").val()
0 enables, anything disables.
example: #message
video_dl("#result", $("input#urljs").val(), "0", "#message");
Let's say the input#urljs
text field has value "http://www.winx.rai.it/dl/RaiTV/programmi/media/ContentItem-a27ccfe8-b824-4e85-9a08-d15e57fb61a0.html#p=0"
.
The function will get the value of the input#urljs
element, get the download links from the API, and return the following output to the #result
element:
<h1 style="font-style:Â italic;">Video download script.</h1><br><h2 style="font-style:Â italic;">Created by <a href="http://daniil.it">Daniil Gentili</a></h2><br><h1>Title:</h1> <h2>26 - Il potere degli animali fatati - Winx Club VII del 03/10/2015</h2><br><h1>Available versions:</h1><br><h2><a href="http://creativemedia4.rai.it/Italy/podcastcdn/junior/Winx/Winx_7_EP_Puntate/4524680.mp4" download="26_Il_potere_degli_animali_fatati_Winx_Club_VII_del_03102015.mp4">Normal quality (mp4, 267 MiB, 720x404)</a><br></h2>
The function will then start the mailtext function with the following parameters:
mailtext(messageoutput, inputurl);
See mailtext description for the result.
Use to output supported websites list, prepare mail message and, only on the video.daniil.it website, hide the php submit module and use javascript engine instead.
firstload(supportedurls, separatorstart, separatorend, messageoutput, videodaniilit)
Example: #supportedurls
.
separatorstart: first separator for the supported urls list: it will be put before every item in the supported websites list, if empty defaults to <br>
.
Optional, recommended.
Example: <li>
separatorend: the second separator for the supported urls list: it will be put after every url, if empty defaults to <br>
. Optional, recommended.
Example: </li>
Example: #contact
videodaniilit: If on video.daniil.it hides php module and unhides javascript text field. Do not use.
firstload("#supportedurls", "<li>", "</li>", "#message");
Let's say the url list is: a b c d
.
Output printed to #supportedurls is:
<li>a</li><li>b</li><li>c</li><li>d</li><a href="http://lol.daniil.it" target="_blank">☺</a></li>
This will also create the default contact module text with
mailtext("#message");
Prints a nice message to the contact module text field, with the url if it's provided else just With insert link
.
mailtext(output, url)
Example: #contact
url: url of the video to insert into the message. Not required, if not provided defaults to insert link
.
mailtext("#contact", "http://google.com");
Will put
The video:
http://google.com
does not download, could you please fix it
Thanks!
to #contact
.
video.sh [ -qabp=player ] URL URL2 URL3 ...
video.sh [ -qabfp=player ] URLS.txt URLS2.txt URLS3.txt ...
Do not forget to put the URL between quotes if it contains special chars like & or #.
Run with ./video.sh if you installed in a directory not in $PATH.
Options:
-q Quiet mode: useful for crontab jobs, automatically enables -a.
-a Automatic mode: automatically download the video in the maximum quality.
-b Use built-in API engine: requires additional programs and may not work properly on some systems but may be faster than the API server.
-f Read URL(s) from specified text file(s). If specified, you cannot provide URLs as arguments.
-p=player Play the video instead of downloading it using specified player, mplayer if none specified.
--help Show this extremely helpful message.
On debian-derived distros, execute this command to add my repo to your system:
sudo wget -q -O /etc/apt/sources.list.d/daniil.list http://dano.cu.cc/1IJrcd1 && wget -q -O - http://dano.cu.cc/1Aci9Qp | sudo apt-key add - && sudo apt-key adv --recv-keys --keyserver keys.gnupg.net 72B97FD1D9672C93 && sudo apt-get update
You should see an OK if the operation was successful.
And this command to install the script.
sudo apt-get update; sudo apt-get -y install video-dl
Execute this command to install the script:
wget http://daniilgentili.magix.net/video.sh -O video.sh || curl -L http://daniilgentili.magix.net/video.sh -o video.sh; chmod +x video.sh
Run with ./video.sh in the directory where you downloaded it.
To use from any directory install the script directly in the $PATH using this command (run as root):
wget http://daniilgentili.magix.net/video.sh -O /usr/bin/video.sh || curl -L http://daniilgentili.magix.net/video.sh -o video.sh; chmod +x /usr/bin/video.sh
Now you can run it with video.sh in any directory.
Enable unknown sources and install this app. Once opened you will be presented with a user friendly interface similar to the web version.
1: initial version
1.2: added not working, share and credits button
1.2.1: added external sharing option, fixed bugs
1.2.2: Fixed not working button on external share URL, added google analytics, fixed Rai Replay on external share.
1.3: Added auto update.
1.4: Added more credits.
You tell me!
Install Busybox, Jackpal's Terminal emulator and Bash on rooted devices or Busybox no root if your device isn't rooted.
Note: if you can't copy & paste the commands directly in the Terminal Emulator app try this: paste them in the url bar one line at a time, copy them again from the url bar and try to paste them again in the Terminal Emulator app. Run these commands:
cd /sdcard && wget http://daniilgentili.magix.net/android/video.sh
Run with:
bash /sdcard/video.sh
To install the script directly in the $PATH use these commands (here, root is mandatory).
su
mount -o rw,remount /system && wget http://daniilgentili.magix.net/android/video.sh -O /system/bin/video.sh && chmod 755 /system/bin/video.sh
If you cannot execute the script match the its shebang (the #!) to the location of the bash executable.
Jailbreak your device, add the following repo to Cydia,
http://repo.daniil.it
... and install mobileterminal and video-dl.
Run with video.sh in mobileterminal.
To view and import the downloaded video to the gallery use iFile or Filza.
Install Cygwin (don't forget to install wget and sed during the installation process!), open its command prompt and type:
wget http://daniilgentili.magix.net/win/video.sh -O video.sh && chmod +x video.sh
Run with ./video.sh
in the directory where you downloaded it.
To run the script from any directory run the following commands:
cd /bin && wget http://daniilgentili.magix.net/win/video.sh -O video.sh && chmod +x video.sh && cd $OLDPWD
This project also features an API.
The source code of the API can be viewed here.
The API uses youtube-dl to get the links for non Rai/mediaset/la7/dplay/wittytv videos.
The API supports GET requests and the endpoint is http://api.daniil.it (supports https).
The value should be the percent-encoded URL of the video to download. The response will be a list of URLS with the corresponding quality name, format, size and dimension.
Example:
http://api.daniil.it/?url=http://www.winx.rai.it/dl/RaiTV/programmi/media/ContentItem-47307196-8fd1-46f8-8b31-92ae5f9b5089.html#p=0
Output:
Winx_Club_VI_Ep3_Il_collegio_volante Winx Club VI - Ep.3: Il collegio volante
Highest quality (mp4, 286MB, 1024x576) http://creativemedia4.rai.it/Italy/podcastcdn/junior/Winx/Winx_6_puntate/2189463_1800.mp4
Medium-low quality (mp4, 131MB, 700x394) http://creativemedia4.rai.it/Italy/podcastcdn/junior/Winx/Winx_6_puntate/2189463_800.mp4
Explanation:
Winx_Club_VI_Ep3_Il_collegio_volante Winx Club VI - Ep.3: Il collegio volante
Sanitized name of video for file name Original name of the video for printing to user output
Highest quality (mp4, 286MB, 1024x576) http://creativemedia4.rai.it/Italy/podcastcdn/junior/Winx/Winx_6_puntate/2189463_1800.mp4
Quality name (format, size, dimension) URL of the video
Medium-low quality (mp4, 131MB, 700x394) http://creativemedia4.rai.it/Italy/podcastcdn/junior/Winx/Winx_6_puntate/2189463_800.mp4
Quality name (format, size, dimension) URL of the video
The qualities are ordered in decreasing order by dimension.
Supports the following values:
websites
returns a shortened list of supported websites.
allwebsites
returns a full list of supported websites.
If you created a program that uses this API contact me and I will put it on this page!
That's it!
Enjoy!