linkedIn learning video download

Allows to download learning videos you see on LinkedIn. Must be logged in.

目前為 2018-03-22 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         linkedIn learning video download
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Allows to download learning videos you see on LinkedIn. Must be logged in.
// @author       rightDroid
// @include      https://www.linkedin.com/learning/*
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==


$('body').ready(function(){
(function() {
    var download_button = `<li class="course-banner__action-item download_video_button">
<button title="Download video" class="disabled add-menu-dropdown__trigger btn-tertiary btn-large dropdown-trigger ember-view"><li-icon aria-hidden="true" type="ribbon-icon" size="large"><svg class="svg-icon" viewBox="0 0 20 20">
<path d="M17.064,4.656l-2.05-2.035C14.936,2.544,14.831,2.5,14.721,2.5H3.854c-0.229,0-0.417,0.188-0.417,0.417v14.167c0,0.229,0.188,0.417,0.417,0.417h12.917c0.229,0,0.416-0.188,0.416-0.417V4.952C17.188,4.84,17.144,4.733,17.064,4.656M6.354,3.333h7.917V10H6.354V3.333z M16.354,16.667H4.271V3.333h1.25v7.083c0,0.229,0.188,0.417,0.417,0.417h8.75c0.229,0,0.416-0.188,0.416-0.417V3.886l1.25,1.239V16.667z M13.402,4.688v3.958c0,0.229-0.186,0.417-0.417,0.417c-0.229,0-0.417-0.188-0.417-0.417V4.688c0-0.229,0.188-0.417,0.417-0.417C13.217,4.271,13.402,4.458,13.402,4.688"></path>
</svg> </li-icon>
<span class="text" aria-hidden="true">Download</span>
<span class="visually-hidden">Download Video</span>
</button></li>`;
    addDownloadButton = function(){
        $('.course-banner__actions').prepend(download_button);
        $('li.download_video_button > button').wrap('<a href="#"></a>');
        $('li.download_video_button').off();
        $('li.download_video_button').unbind();
        $('li.download_video_button').children().off();
        $('li.download_video_button').children().unbind();
    };
    checkIfReadyToLoad = function(){
        if($('.course-banner__actions').length && $('.download_video_button').length == 0){
            addDownloadButton();
        }
        else{
            setTimeout(checkIfReadyToLoad,2000);
        }
    };
    checkIfReadyToLoad();
    checkForVideoPlayer = function(){
        if($('.video-body video.player').length){
            var vid_source = $('video.player').attr('src');
            $('.download_video_button > a').attr('href', vid_source);
            var vid_name = vid_source;
            $('.download_video_button > a').attr('download', vid_name);
            $('.download_video_button > a > button').removeClass('disabled');
        }
        else
        {
            $('.download_video_button > a > button').addClass('disabled');
        }
    };
    $('body').on('mouseover', 'li.download_video_button', function(){
        checkForVideoPlayer();
    });
    $('body').on('mouseover', '.course-body__content', function(){
        checkIfReadyToLoad();
    });

})();

});