G2A Many GEOs
SHARE
TWEET

tvrain.ru video downloader v0.4 UserJS

a guest Nov 29th, 2014 406 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. // @version 0.4
  9. // @created 29.11.2014
  10. // ==/UserScript==
  11.  
  12.     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" />';
  13.  
  14.     var js = document.createElement('script');
  15.     js.src = "http://tvrain-st.cdn.ngenix.net/static/js/pub/jquery.min.js";
  16.     document.getElementsByTagName('body')[0].appendChild(js);
  17.  
  18.     var match = location.href.match(/http:\/\/cloud.tvigle.ru\/((?:playlist|video)\/(?:\d+))\//);
  19.     if(match)
  20.         var vid_id = match[1]
  21.     else
  22.     {
  23.         match = location.href.match(/(?:playlistID=(\d+))?&id=(\d+)/);
  24.         if(match) var vid_id = (match[1] ? 'playlist/'+match[1] : 'video/'+match[2]);
  25.     }
  26.    
  27.     if(vid_id)
  28.     {
  29.         var dl_links = "";
  30.         $.getJSON('http://cloud.tvigle.ru/api/play/'+vid_id, function(data) {
  31.             for(i in data.playlist.items)
  32.             {
  33.                 var tmp = "";
  34.                 var vid_avail_res = [];
  35.                 $.each(data.playlist.items[i].videos.mp4, function(key, value){ vid_avail_res.push(key); });
  36.                 vid_avail_res.sort();
  37.                 for(a in vid_avail_res)
  38.                 {
  39.                     tmp += '<a href="'+data.playlist.items[i].videos.mp4[vid_avail_res[a]]+'">'+vid_avail_res[a]+'</a> ';
  40.                 }
  41.                 dl_links += ((data.playlist.items.length > 1) ? "Часть " + (parseInt(i) + 1) + ": " + tmp : "Скачать: " + tmp) + ((a < vid_avail_res.length) ? "<br>" : "");
  42.             }
  43.             document.getElementsByTagName('body')[0].innerHTML += '<div><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></div>';
  44.             document.getElementsByClassName('TviglePlayer')[0].height -= document.getElementById("my_links").clientHeight+3;
  45.  
  46.             var js = document.createElement('script');
  47.             js.text = "var vid_range = '-500,10'; var vid_filter = ''; var vid_rightholder=" + data.playlist.items[0].rightholder;
  48.             document.getElementsByTagName('body')[0].appendChild(js);
  49.  
  50.             var js = document.createElement('script');
  51.             js.text = base64.decode('ICAgIGZ1bmN0aW9uIEZpbmRWaWRlb3MocmFuZ2UsIGZpbHRlcikNCiAgICB7DQogICAgICAgIHZhciBtYXRjaCA9IGxvY2F0aW9uLmhyZWYubWF0Y2goL2h0dHA6XC9cL2Nsb3VkLnR2aWdsZS5ydVwvdmlkZW9cLyhcZCspXC8vKTsNCiAgICAgICAgaWYobWF0Y2gpDQogICAgICAgIHsNCiAgICAgICAgICAgIHZhciByYW5nZSA9IHJhbmdlLnNwbGl0KCcsJyk7DQogICAgICAgICAgICB2YXIgdmlkX2Zyb20gPSBwYXJzZUludChtYXRjaFsxXSkrcGFyc2VJbnQocmFuZ2VbMV0pOw0KICAgICAgICAgICAgdmFyIHZpZF90byA9IHBhcnNlSW50KG1hdGNoWzFdKStwYXJzZUludChyYW5nZVswXSk7DQogICAgICAgICAgICB2YXIgY291bnQgPSAwOw0KICAgICAgICAgICAgdmFyIG15UG9wdXAgPSB3aW5kb3cub3BlbignJywnJywnd2lkdGg9NjAwLGhlaWdodD00MDAsc2Nyb2xsYmFycz0xJyk7DQogICAgICAgICAgICBteVBvcHVwLmRvY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wNCwgZnVuY3Rpb24oa2V5LCB2YWx1ZSl7IHZpZF9hdmFpbF9yZXMucHVzaChrZXkpOyB9KTsNCiAgICAgICAgICAgIHZpZF9hdmFpbF9yZXMuc29ydCgpOw0KICAgICAgICAgICAgZm9yKGEgaW4gdmlkX2F2YWlsX3JlcykNCiAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICB0bXAgKz0gJzxhIGhyZWY9IicrZGF0YS5wbGF5bGlzdC5pdGVtc1tpXS52aWRlb3MubXA0W3ZpZF9hdmFpbF9yZXNbYV1dKyciIHRhcmdldD0iX2JsYW5rIj4nK3ZpZF9hdmFpbF9yZXNbYV0rJzwvYT4gJzsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfQ0KICAgICAgICByZXR1cm4gdG1wOw0KICAgIH0=');
  52.             document.getElementsByTagName('body')[0].appendChild(js);
  53.         });
  54.     }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
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