Guest User

theync.user.js

a guest
Mar 29th, 2015
4,722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name yncUndeground
  3. // @description userjs for downloading theync undeground video
  4. // @author anon
  5. // @license no
  6. // @version 1.0
  7. // @include http://theync.com/*
  8. // ==/UserScript==
  9.  
  10. (function(window, undefined) {
  11.     var w;
  12.     if (unsafeWindow != "undefined") {
  13.         w = unsafeWindow;
  14.     } else {
  15.         w = window;    
  16.     }
  17.  
  18.     if (w.self != w.top) {
  19.         return;
  20.     }
  21.  
  22.     var refs = document.getElementsByClassName('yncHPThumbLink');
  23.  
  24.     for (var i = 0; i < refs.length; i++) {
  25.         var img = refs[i].style['backgroundImage'];
  26.         var vid = (img.match(/pageTN([0-9]+)/))[1];
  27.  
  28.         var ref = refs[i].href;
  29.         var file = (ref.match(/.+\/([^\.]+)/))[1];
  30.  
  31.         refs[i].href = 'http://media.theync.com/vids/video' + vid + '.mp4';
  32.         refs[i].download = file + '.mp4';
  33.     }
  34.  
  35. })(window);
Advertisement
Add Comment
Please, Sign In to add comment