Skip to content

Easily download videos from Azure Media Services with Python on any platform. ⚡️

License

Notifications You must be signed in to change notification settings

abhiTronix/azure_video_downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Video-Downloader Python Script 📥

A Video-Downloader Python Script that enables us to download videos from any online Azure Media Services on-the-go directly through our commandline.

 

Disclaimer

We are not responsible for any misuse, you must use it for research & educational purposes only, at your own discretion & without representation or warranty of any kind. It is your responsibility to obey laws!

⚠️ CONSIDER YOURSELF WARNED!

Usage:

Info 🕵️: There's also a detailed PDF version of Azure Video-Downloader Python Script Docs.

A. Pre-requisites (one-time steps only)

All following steps you have to perform only one time.

  • Step-1: Download and install latest python-3 with pip: Tutorial video link

  • Step-2: Download script from git hub repository using browser or clone using git software.

    • Watch this video for downloading from browser and from git software
    • Extract the zip at suitable place let's for this document call it script_folder.
  • Step-3: Download and install python dependencies:

    Run these commands in your terminal/command-prompt/ power-shell

    cd script_folder
    python -m pip install -r -U --user requirement.txt
  • Step-4: Download and extract ffmpeg.zip

B. Extracting URL

ISM URL (https URL with .ism extension) is necessary for our python script as input. There are mainly three ways to extract it:

1. Use web-browser: (Recommended) (For all platforms)

  • Go the video page where video is being played.
  • Double check video is being played not paused.
  • Right click on the page and select Inspect or something similar.
  • A menu will open, then on the menu, click Network tab.
  • In Network tab, write Fragments in filter search field.
  • Select that Fragment filter option (if available, otherwise make sure video is still playing in the background)
  • Right click on the selected option and click copy and then Copy link address.
  • The copied URL will look something like this:
    https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism/QualityLevels(551000)/Fragments(video=360000000,format=mpd-time-csf)
  • Just delete everything past .ism and the final value is the required ISM URL, as follows:
    https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism

2. Use IDM: (Windows Only)

  • Download and install IDM with 11 days trial period (Watch this video https://youtu.be/uGct61De_EU).
  • It will install extension on your browser automatically.
  • Now when video is played on website, a Download button will show up at upper-right corner of the video.
  • Click any of the available option and a dialog box will show up.
  • In dialog box, Copy the URL present in the Address text field which will be something like:
    https://streamdiat-inct.streaming.media.azure.net/94e43e68-2592-4866-95d7-52b587e41a9f/Feature%20Engineering%20Dimensionali.ism/manifest(format=mpd-time-csf)&selected_id=1_V_video_4
  • Just delete everything past .ism and the final value is the required ISM URL, as follows:
    https://streamdiat-inct.streaming.media.azure.net/94e43e68-2592-4866-95d7-52b587e41a9f/Feature%20Engineering%20Dimensionali.ism

3. Use XDM (Xtreme Download Manager): (For all platforms)

  • Download and install IDM with 11 days trial period (Watch this video https://youtu.be/uksktuNvKNc).
  • You will be asked to install extension on your browser manually, go ahead do it. When done restart browser.
  • Now when video is being played on website, a DOWNLOAD VIDEO button will show up at down-right corner of the browser.
  • Click any of the available with DIAT.mp4.
  • After clicking downloading will start, Hurry and Go head to cancel it as we don't need this video.
  • Now right-click on Canceled video and Click Copy URL which will be something like:
    https://streamdiat-inct.streaming.media.azure.net/25fcdac8-e577-4f59-acf9-8921887b4159/AI_W1_Bayesian%20Learning%20Part-1.ism/QualityLevels(1880000)/Fragments(video=60000000,format=mpd-time-csf)
  • Just delete everything past .ism and the final value is the required ISM URL, as follows:
    https://streamdiat-inct.streaming.media.azure.net/25fcdac8-e577-4f59-acf9-8921887b4159/AI_W1_Bayesian%20Learning%20Part-1.ism

C. Download Video with Script

Tip:💡 You can view help by running python azure_downloader.py -h command to get familiar with all the available options.

  • Open a terminal/command-prompt/power-shell of your choice.

  • Give extracted ISM URL (explained above) to the input -i/--input of the python script as following and video start downloading:

    python azure_downloader.py -i https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism

    OR give TXT file path containing multiple URLs(line-by-line):

    python azure_downloader.py -i URLs.txt

    OR give string of muliple URLs seperated by , or +:

    python azure_downloader.py -i "https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism,https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/DL1.ism,https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/DL2.ism"  
  • [Optional] By default, our python script automatically assigns file name of the output video file using ISM URL and downloads it to output directory of script_folder. But you can also specify the output filename/file-directory using -out/--output command as follows:

    ⚠️ Note: This option does not works with input(-i) with multiple URLs.

    python azure_downloader.py -i https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism -o Overview.mp4

    OR give full output path:

    python azure_downloader.py -i https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism -o C:/Overview.mp4
  • [Optional/Only for developers] By default python script uses FFmpeg(used to merge audio and video) provided in the ffmpeg folder of script_folder, that we downloaded and extracted previously, but you can assign your own FFmpeg binaries too using -f/--ffmpeg option as follows:

    python azure_downloader.py -i https://streamdiat-inct.streaming.media.azure.net/f12251d4-d8e8-43f1-8202-737f7a186b34/Overview%20of%20AI%20ML.ism -o Overview.mp4 -f C:/ffmpeg/bin/ffmpeg.exe

 

Copyright

AZURE VIDEO-DOWNLOADER - Downloads videos from Azure Media Services.

Copyright (C) 2020 Abhishek Thakur @abhiTronix [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses.