Introducing to Simple Video Downloader
The Video Downloader is a Chrome Extension that helps you save your favorite videos. It can be installed via Chrome Webstore:
https://chrome.google.com/webstore/detail/ilcdiicigjaccgipndigcenjieedjohj/
Total Number of Current Users
Install on Firefox or other browsers?
It should work, but not fully tested on Firefox via Chrome Extension Foxified
Changes v3.0.4
Pull Requests Merged: https://github.com/DoctorLai/VideoDownloadHelper/pull/4
- using ES6 and webpack -
npm run build
- unit tests via mocha and chai -
npm run test
- adding ParseVideo class that analyses HTML
- handles pearvideo.com
- handles miaopai.com
Class of ParseVideo
/* jshint -W097 */
/* jshint -W117 */
"use strict";
const { ValidURL, extractDomain, FixURL } = require( '../js/functions' ) ;
class ParseVideo {
constructor(url, html = "") {
// e.g. https://www.dailymotion.com/video/x2bu0q2
this.url = url;
// e.g. ....
this.html = html;
}
// entry of video parser
Parse() {
let domain = extractDomain(this.url);
let video_url = "";
if (domain.includes("miaopai.com")) {
video_url = ParseVideo.parse_miaopai_com(this.url, this.html);
if (ValidURL(video_url)) {
return video_url;
}
}
if (domain.includes("pearvideo.com")) {
video_url = ParseVideo.parse_pearvideo_com(this.url, this.html);
if (ValidURL(video_url)) {
return video_url;
}
}
video_url = ParseVideo.extract_all_video_urls(this.url, this.html);
if (video_url !== null) {
return video_url;
}
video_url = ParseVideo.extract_all_mp4_urls(this.url, this.html);
if (video_url !== null) {
return video_url;
}
return null;
}
// parse miaopai.com video e.g. https://miaopai.com/show/abcde.html
// this is one of the simplest form and we can get it from URL
static parse_miaopai_com(url, html) {
let re = /.*miaopai\.com\/show\/(.*)\.html?$/i;
let found = re.exec(url);
if (found !== null) {
return "http://gslb.miaopai.com/stream/" + found[1] + ".mp4";
}
return null;
}
// extract all video_url in html e.g. "video_url": "https://aaaabbb.com/"
static extract_all_video_urls(url, html) {
let re = /['"]?video_url['"]?:\s*(['"])(https?:[^\s'",]+)\1/ig;
let found = re.exec(html);
let video_url = [];
while (found !== null) {
let url = FixURL(found[2]);
if (ValidURL(url)) {
video_url.push(url);
}
found = re.exec(html);
}
return (video_url.length === 0) ? null :
( (video_url.length === 1) ? video_url[0] : video_url);
}
// parse pearvideo.com e.g. http://www.pearvideo.com/video_1050733
static parse_pearvideo_com(url, html) {
let video_url = [];
let re = /([hsl]d|src)Url\s*=\s*[\"\']([^\"\']+)[\'\"]/ig;
let found = re.exec(html);
while (found !== null) {
let tmp_url = FixURL(found[2]);
if (ValidURL(tmp_url)) {
video_url.push(tmp_url);
}
found = re.exec(html);
}
return (video_url.length === 0) ? null :
( (video_url.length === 1) ? video_url[0] : video_url);
}
// extract all MP4 in html e.g. "mp4","url":"https://aabb.com"
static extract_all_mp4_urls(url, html) {
let re = /mp4[\'\"]\s*,\s*[\'\"]url[\'\"]\s*:\s*[\'\"]([^\"\']+)[\'\"]/ig;
let found = re.exec(html);
let video_url = [];
while (found !== null) {
let url = FixURL(found[1]);
if (ValidURL(url)) {
video_url.push(url);
}
found = re.exec(html);
}
return (video_url.length === 0) ? null :
( (video_url.length === 1) ? video_url[0] : video_url);
}
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = {
ParseVideo
};
}
Screenshot
Roadmap
- Use async/await to replace Promise/Then
- Fix broken video parser due to video site changes e.g. ted.com
- Add more unit tests (increase code coverage)
- Support vimeo and other video sites
- Merge video segments (ts)
VIP Key Exclusive to Utopian
Please note, you can enter the VIP Key which allows you to call the server API in case the client video parser fails locally - this greatly unlocks video parser to many many other video sites.
The KEY is iamutopian
Enjoy and Steem On!
Vote for me or Set me as a witness Proxy - Every vote counts! - Thank you!
Your Vote is much appreciated, and every vote counts.
Check out My Witness Page
Support me and my work as a witness - witness thread by
- voting me here, or
- voting me as a witness proxy - let @justyy represent you.
Thank you! Some of My Contributions: SteemYY.com - SteemIt Tutorials, Robots, Tools and APIs and VPS Search Tool
Relevant Video Download Posts
- VideoDownloader Update: New UI, d.tube and steemit video URL parser, code refactoring!
- VideoDownloader Update: VIP Feature of Server Video Parser
- How to Download Tumblr Posts?
- A Home-made Video Download Helper (Client + Server)
- The Simple Video .m3u8 Downloader/Parser in PHP and Javascript
- How to Download Instagram Videos using PHP and Javascript?
- How to Download Video via Workflow APP?
- The TED Video Downloader
- Adding `Image Download List` to the Popular `VideoDownloadHelper` Chrome Extension