Adding ted.com Video Download Support

in #utopian-io7 years ago (edited)

Previously, the Chrome Extension Video Download Helper has been accepted by Google Web Store and Utopian. Today, I have spent some time adding the support of parsing the video URLs from ted.com

Let's check how the video URLs are stored in ted.com HTML source code:
image.png

We just need to parse it using regular expressions, the JS code is:

    if (domain.includes("ted.com")) {
        if (!ValidURL(video_url)) {
            var re = /{"uri":"([^"\']+)"/gi;
            var found = re.exec(html);                        
            var video_url_arr = [];
            while (found != null) {
                var tmp_url = CheckURL(found[1]);
                if (ValidURL(tmp_url)) {
                    video_url_arr.push(tmp_url);    
                }                            
                found = re.exec(html);
            }
            if (valid_domain) {                
                if (video_url_arr.length > 0) {
                    chrome.runtime.sendMessage({
                        action: "getSource",
                        source: JSON.stringify(video_url_arr)
                    });                          
                } else {
                    chrome.runtime.sendMessage({
                        action: "getSource",
                        source: JSON.stringify(CheckURL(video_url))
                    });                              
                }
            }
        }
    }   

The github: https://github.com/DoctorLai/VideoDownloadHelper
The commit: https://github.com/DoctorLai/VideoDownloadHelper/commit/134bb7948a37d904946fd75343fd3e9f4dfbc50a
The Google Webstore: https://chrome.google.com/webstore/detail/simple-video-download-hel/ilcdiicigjaccgipndigcenjieedjohj
It has also been implemented in Server's API - Online Universal Video Downloader and TED Downloader

It works!

Proof of Work

My github id is doctorlai and you can find my steemit URL at profile page: https://github.com/DoctorLai/



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

除了敬仰,我还能说啥。。

其实挺羡慕YY大神的,你可以自己写工具,写软件,写插件,我要是有这样的本领就好了!

不是本领,就是混口饭吃……

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @justyy I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x