Ledger Nano X - The secure hardware wallet
SHARE
TWEET

tvrain.ru video downloader v0.5 UserJS

a guest Apr 22nd, 2015 408 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name tvrain_video_dl
  3. // @description tvrain.ru video downloader
  4. // @author ANT
  5. // @include http://cloud.tvigle.ru/playlist/*
  6. // @include http://cloud.tvigle.ru/video/*
  7. // @include http://cloud.tvigle.ru/static/player/viewer/flash/*
  8. // @include http://tvrain.ru/articles/*
  9. // @include http://tvrain.ru/teleshow/*
  10. // @version 0.5
  11. // @created 22.04.2015
  12. // ==/UserScript==
  13.  
  14. window.addEventListener('DOMContentLoaded', function(e){
  15.     if((document.location.href.indexOf("http://tvrain.ru/articles/") != -1) || (document.location.href.indexOf("http://tvrain.ru/teleshow/") != -1))
  16.         if((tv = document.getElementsByClassName('tv')[0]) || (tv = document.getElementsByClassName('tv multiplayer')[0]))
  17.             if(player != iframe) tv.innerHTML = iframe;
  18. }, false);
  19.  
  20. if((document.location.href.indexOf("http://cloud.tvigle.ru/") != -1))
  21. {
  22.     document.getElementsByTagName('head')[0].innerHTML += '<link rel="stylesheet" type="text/css" href="http://tvrain-st.cdn.ngenix.net/static/css/pub/style.css?892-1" />';
  23.  
  24.     var js = document.createElement('script');
  25.     js.src = "http://tvrain-st.cdn.ngenix.net/static/js/pub/jquery.min.js";
  26.     document.getElementsByTagName('body')[0].appendChild(js);
  27.  
  28.     var match = location.href.match(/http:\/\/cloud.tvigle.ru\/((?:playlist|video)\/(?:\d+))\//);
  29.     if(match)
  30.         var vid_id = match[1]
  31.     else
  32.     {
  33.         match = location.href.match(/(?:playlistID=(\d+))?&id=(\d+)/);
  34.         if(match) var vid_id = (match[1] ? 'playlist/'+match[1] : 'video/'+match[2]);
  35.     }
  36.  
  37.     if(vid_id)
  38.     {
  39.         var dl_links = "";
  40.         $.getJSON('http://cloud.tvigle.ru/api/play/'+vid_id, function(data) {
  41.             for(i in data.playlist.items)
  42.             {
  43.                 var tmp = "";
  44.                 var vid_avail_res = [];
  45.                 $.each(data.playlist.items[i].videos.mp4, function(key, value){ vid_avail_res.push(key); });
  46.                 vid_avail_res.sort();
  47.                 for(a in vid_avail_res)
  48.                 {
  49.                     tmp += '<a href="'+data.playlist.items[i].videos.mp4[vid_avail_res[a]]+'">'+vid_avail_res[a]+'</a> ';
  50.                 }
  51.                 dl_links += ((data.playlist.items.length > 1) ? "Часть " + (parseInt(i) + 1) + ": " + tmp : "Скачать: " + tmp) + ((a < vid_avail_res.length) ? "<br>" : "");
  52.             }
  53.             var child = document.createElement('div');
  54.             child.innerHTML = '<div style="float:left" id="my_links">'+dl_links+'</div><div style="float:right;padding-right:5px"><a href="#" onclick="FindVideos(vid_range, vid_filter);" title="Искать видеоролики"><b>Найти</b></a> | <a href="'+location.href+'" title="Текущий URL">URL</a> | <a href="#" onclick=\'var answ=prompt("Диапазон для поиска:", vid_range); (answ ? vid_range=answ : null); var answ=prompt("Применить фильтр:", vid_filter); (answ != null ? vid_filter=answ : null);\' title="Настройки">[*]</a></div>';
  55.             document.getElementsByTagName('body')[0].appendChild(child);
  56.             document.getElementById('tvPlayerObj0').height = document.body.offsetHeight - (child.childNodes[0].clientHeight + 3);
  57.  
  58.             var js = document.createElement('script');
  59.             js.text = "var vid_range = '-500,10'; var vid_filter = ''; var vid_rightholder=" + data.playlist.items[0].rightholder;
  60.             document.getElementsByTagName('body')[0].appendChild(js);
  61.  
  62.             var js = document.createElement('script');
  63.             js.text = base64.decode('ICAgIGZ1bmN0aW9uIEZpbmRWaWRlb3MocmFuZ2UsIGZpbHRlcikNCiAgICB7DQogICAgICAgIHZhciBtYXRjaCA9IGxvY2F0aW9uLmhyZWYubWF0Y2goL2h0dHA6XC9cL2Nsb3VkLnR2aWdsZS5ydVwvdmlkZW9cLyhcZCspXC8vKTsNCiAgICAgICAgaWYobWF0Y2gpDQogICAgICAgIHsNCiAgICAgICAgICAgIHZhciByYW5nZSA9IHJhbmdlLnNwbGl0KCcs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LXZpZF90bysxKSpjb3VudCkrJyUnOyB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgIH0NCg0KICAgIGZ1bmN0aW9uIEdldExpbmtzKGRhdGEpDQogICAgew0KICAgICAgICBmb3IoaSBpbiBkYXRhLnBsYXlsaXN0Lml0ZW1zKQ0KICAgICAgICB7DQogICAgICAgICAgICB2YXIgdG1wID0gIiI7DQogICAgICAgICAgICB2YXIgdmlkX2F2YWlsX3JlcyA9IFtdOw0KICAgICAgICAgICAgJC5lYWNoKGRhdGEucGxheWxpc3QuaXRlbXNbaV0udmlkZW9zLm1wNCwgZnVuY3Rpb24oa2V5LCB2YWx1ZSl7IHZpZF9hdmFpbF9yZXMucHVzaChrZXkpOyB9KTsNCiAgICAgICAgICAgIHZpZF9hdmFpbF9yZXMuc29ydCgpOw0KICAgICAgICAgICAgZm9yKGEgaW4gdmlkX2F2YWlsX3JlcykNCiAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICB0bXAgKz0gJzxhIGhyZWY9IicrZGF0YS5wbGF5bGlzdC5pdGVtc1tpXS52aWRlb3MubXA0W3ZpZF9hdmFpbF9yZXNbYV1dKyciIHRhcmdldD0iX2JsYW5rIj4nK3ZpZF9hdmFpbF9yZXNbYV0rJzwvYT4gJzsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgICAgICByZXR1cm4gdG1wOw0KICAgIH0=');
  64.             document.getElementsByTagName('body')[0].appendChild(js);
  65.         });
  66.     }
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top