A Firefox addon and Python script to download videos from CCLE.
- Install the
youtube-dl
library for Python by runningpip install youtube-dl
.
- Copy the
app\windows\ccle_video_downloader.bat.example
file toapp\windows\ccle_video_downloader.bat
. On line 3, change "C:\Path\To\CCLE video downloader\app
" to match the location of the app folder. - Copy the
app\ccle_video_downloader.json.example
file toapp\ccle_video_downloader.json
. Within the file, change thepath
key to the path to theapp\windows\ccle_video_downloader.bat
file. All backslashes (\) in the path must be escaped by using two backslashes (\\). - Copy the
app\windows\set_location.reg.example
file toapp\windows\set_location.reg
. On lines 4 and 7, change "C:\\Path\\To\\CCLE video downloader\\app\\ccle_video_downloader.json
" to match the location of theapp\ccle_video_downloader.json
file. All backslashes (\) in the path must be escaped by using two backslashes (\\). Run the file to install the required registry keys. - Copy the
app\config.example
file toapp\config
. Edit the path option to set where you want to save the files to. - Add all files in the
add-on
folder to a.zip
archive. To do this, select all the files in theadd-on
folder, right click, and selectSend to > Compressed (zipped) folder
. - In Firefox, visit the
about:debugging
page by entering it into the URL bar. SelectThis Firefox
on the left menu, and clickLoad Temporary Add-on...
. Select the.zip
file created in step 5. - At this point, you are all set. Refer to the Usage section on how to download videos.
- Remove the extension after downloading the videos you want.
TODO
On a page with a CCLE video, press the play button of the video you want to download. A notification will appear near the top of the screen. At this point, the video will begin downloading. You may pause the video or close the tab.
The browser add-on is composed of a background and a content-script. The background script listens for URLs that match this filter: https://cdnapisec.kaltura.com/*a.m3u8*
. Those URLs contain the information required to download the video. When a request with a URL that matches that filter is made, the background script executes the content script in the tab from where the request was made. The content script displays a notification (a toast) and looks for the class name and video title. The notification indicates that a video has begun downloading. The class name and video title are derived from the CCLE page by using the navigation links at the top. The content script then sends the class name and video information to the background script, which then bundles that information with the video URL and sends it to the external Python script.
The external Python script receives the video information. From that, it creates (if not existing already) a sub-folder for the class, and downloads the video into that sub-folder. The script uses the Youtube-dl library. The base directory to download videos into can be configured using the config
file in the app directory.
Communication between the Firefox add-on and the Python script is done using the "NativeMessaging" API.
- Test without the
tabs
permission, it might not be necessary - Find a way to avoid using the
<all_urls>
permission - Support pages with multiple videos (only one video will be downloaded if a page has multiple videos)
- Provide more useful notifications
- Support Mac/Linux better
- Write an initialization script that automatically generates the directory-dependent files
- Add option to ask for confirmation before downloading files
- Add warning when add-on cannot communicate with downloader script
- Detect when youtube-dl is not installed and display error in browser window