flvcdNoAd

硕鼠解析页面自动跳过广告

Stan na 29-11-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         flvcdNoAd
// @namespace    ishang
// @version      0.1
// @description  硕鼠解析页面自动跳过广告
// @author       ishang
// @match        http://www.flvcd.com/*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';


var youkuUrl = getParameterByName('kw');
// 非解析页面
if(!youkuUrl) {
  return;
}

var html = document.documentElement.innerHTML;
// 解析成功
var isParsed = /下载地址:/.test(html);
if(isParsed) {
  return;
}
// 已经解析, 但解析失败
if(getCookie('youkuUrl')) {
  return;
}

// 设置为已经解析过了,不再进行解析
setCookie('youkuUrl', youkuUrl);

var key = ((html.match(/\='\w{32,32}'\;/) || [])[0] || '').replace('=\'', '').replace('\';', '');
var time = ((html.match(/\=\d{13,13}/) || [])[0] || '').replace('=', '');

parseCookie(key, time);

function parseCookie(key, time) {
  function createSc(a, t) {
    var b = '24227945943216730751837054267565';
    t = Math.floor(t / (600 * 1000));
    var ret = '';
    for(var i = 0; i < a.length; i++) {
      var j = a.charCodeAt(i) ^ b.charCodeAt(i) ^ t;
      j = j % 'z'.charCodeAt(0);
      var c;
      if(j < '0'.charCodeAt(0)) {
        c = String.fromCharCode('0'.charCodeAt(0) + j % 9);
      }
      else if(j >= '0'.charCodeAt(0) && j <= '9'.charCodeAt(0)) {
        c = String.fromCharCode(j);
      }
      else if(j > '9'.charCodeAt(0) && j < 'A'.charCodeAt(0)) {
        c = '9';
      }
      else if(j >= 'A'.charCodeAt(0) && j <= 'Z'.charCodeAt(0)) {
        c = String.fromCharCode(j);
      }
      else if(j > 'Z'.charCodeAt(0) && j < 'a'.charCodeAt(0)) {
        c = 'Z';
      }
      else if(j >= 'z'.charCodeAt(0) && j <= 'z'.charCodeAt(0)) {
        c = String.fromCharCode(j);
      }
      else {
        c = 'z';
      }
      ret += c;
    }
    return ret;
  }


  var g = createSc(key, time);
  var date = new Date();
  date.setTime(date.getTime() + 300 * 1000);
  document.cookie = 'go=' + g + ';expires=' + date.toGMTString();
  document.cookie = 'avdGggggtt=' + time + ';expires=' + date.toGMTString();

  window.setTimeout(function() {
    window.location.reload();
  }, 16);
}


function getParameterByName(name) {
  name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
  var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
    results = regex.exec(window.location.search);
  return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}

function getCookie(name) {
  var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  if(arr = document.cookie.match(reg)) {
    return decodeURIComponent(arr[2]);
  }
  else {
    return null;
  }
}

function setCookie(name, value) {
  var date = new Date();
  date.setTime(date.getTime() + 300 * 1000);
  document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + date.toGMTString();
}