Adding PearVideo Video Download Support

in utopian-io •  7 years ago 

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 pearvideo.com

Check the HTML source from:

http://www.pearvideo.com/video_1050733

We can see that the video source is in the text of Javascript code:

image.png

Therefore, we can customize the search using Regular expression, the JS code has been added to the plugin:

    if (domain.includes("pearvideo.com")) {
        if (!ValidURL(video_url)) {
            var re = /srcUrl="([^"\']+)"/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/e8df6a821efa27c06b1d242e6abdfba843c4ed22#diff-337d9b5b4942fb84e0ca186f8db40d15
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 PearVideo Downloader

It works!

image.png

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi, I Upvote You, Please Upvote Me Back ,Thanks

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

Thank you for the contribution. It has been approved.

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

Hi, I Upvote You, Please Upvote Me Back ,Thanks