Advertisement
Guest User

Redirect to SSYoutube

a guest
May 15th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        SSYoutube Redirect
  3. // @namespace   http://www.semicolonsoftware.de
  4. // @description Redirect unavailable youtube videos to ssyoutube.com
  5. // @include     /^https?://(?:.*\.)?youtube.com\/watch\?v=.+$/
  6. // @version     1.0.0
  7. // @grant       none
  8. // ==/UserScript==
  9.  
  10. var $notfound = document.getElementById('watch7-player-unavailable');
  11.  
  12. if($notfound) {
  13.  
  14.   var m = /youtube.com\/watch\?v=([^&]+)(?:&.*)?/.exec(document.URL);
  15.  
  16.   if(m) {
  17.     var id = m[1];
  18.     console.log(id);
  19.  
  20.     var $a = document.createElement('a');
  21.  
  22.     $a.innerHTML = "Try on savefrom.net";
  23.     $a.setAttribute('href', 'http://ssyoutube.com/watch?v=' + id);
  24.     $a.setAttribute('style', 'position: absolute; bottom: 10px; right: 10px; font-size: 12pt; padding: 10px; background-color: #5BB75B; background-image: linear-gradient(to bottom, #62C462, #51A351); color: #FFF; text-decoration: none; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border-radius: 4px;');
  25.  
  26.  
  27.     $notfound.appendChild($a);
  28.   }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement