WorldStar replace video with direct mp4

WorldStar replace flash video player with direct mp4

当前为 2016-01-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         WorldStar replace video with direct mp4
// @namespace    kmcdeals.com
// @version      1
// @description  WorldStar replace flash video player with direct mp4
// @author       You
// @match        http://www.worldstarhiphop.com/videos/*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';

var flashObj = $("#NAPPdiv embed"),
    flashVars = flashObj.attr('flashvars').split('&'),
    directMP4Link;

for(var i = 0; i < flashVars.length; i++){
    if(flashVars[i].indexOf(".mp4") > 0) {
        var directMP4Link = flashVars[i].replace("file=", "");
        flashObj.replaceWith('<video width="640" height="390" controls="controls">\
                             <source src="' + directMP4Link + '" type="video/mp4">\
                             </video>');
    }
}