Ledger Nano X - The secure hardware wallet
SHARE
TWEET

tvrain.ru video downloader v0.3 UserJS

a guest Sep 12th, 2014 1,201 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.3
  9. // @created 06.09.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 = '';";
  48.             document.getElementsByTagName('body')[0].appendChild(js);
  49.  
  50.             var js = document.createElement('script');
  51.             js.text = base64.decode('ICAgIGZ1bmN0aW9uIEZpbmRWaWRlb3MocmFuZ2UsIGZpbHRlcikNCiAgICB7DQogICAgICAgIHZhciBtYXRjaCA9IGxvY2F0aW9uLmhyZWYubWF0Y2goL2h0dHA6XC9cL2Nsb3VkLnR2aWdsZS5ydVwvdmlkZW9cLyhcZCspXC8vKTsNCiAgICAgICAgaWYobWF0Y2gpDQogICAgICAgIHsNCiAgICAgICAgICAgIHZhciByYW5nZSA9IHJhbmdlLnNwbGl0KCcsJyk7DQogICAgICAgICAgICB2YXIgdmlkX2Zyb20gPSBwYXJzZUludChtYXRjaFsxXSkrcGFyc2VJbnQocmFuZ2VbMV0pOw0KICAgICAgICAgICAgdmFyIHZpZF90byA9IHBhcnNlSW50KG1hdGNoWzFdKStwYXJzZUludChyYW5nZVswXSk7DQogICAgICAgICAgICB2YXIgY291bnQgPSAwOw0KICAgICAgICAgICAgdmFyIG15UG9wdXAgPSB3aW5kb3cub3BlbignJywnJywnd2lkdGg9NjAwLGhlaWdodD00MDAsc2Nyb2xsYmFycz0xJyk7DQogICAgICAgICAgICBteVBvcHVwLmRvY3VtZW50LndyaXRlKC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j1odHRwOi8vY2xvdWQudHZpZ2xlLnJ1L3ZpZGVvLycrZGF0YS5wbGF5bGlzdC5pdGVtc1swXS5pZCsnLyB0YXJnZXQ9Il9ibGFuayI+JytkYXRhLnBsYXlsaXN0Lml0ZW1zWzBdLnRpdGxlKyc8L2E+ICgnK2RhdGEucGxheWxpc3QuaXRlbXNbMF0uZHVyYXRpb24rJyk8L2Rpdj48ZGl2PjxpbWcgd2lkdGg9MjUlIHNyYz0nK2RhdGEucGxheWxpc3QuaXRlbXNbMF0udGh1bWJuYWlsKycgLz48L2Rpdj48ZGl2PicrZGF0YS5wbGF5bGlzdC5pdGVtc1swXS5kZXNjcmlwdGlvbi5yZXBsYWNlKC88XC8/W14+XSs+L2dpLCAnJykrJzxocj48L2Rpdj4nOw0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIGNvdW50Kys7DQogICAgICAgICAgICAgICAgICAgIG15UG9wdXAuZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ215X3Byb2dyZXNzJykuaW5uZXJIVE1MID0gJ1Byb2dyZXNzOiAnK01hdGgucm91bmQoMTAwLyh2aWRfZnJvbS12aWRfdG8rMSkqY291bnQpKyclJzsNCiAgICAgICAgICAgICAgICB9KS5mYWlsKGZ1bmN0aW9uKCkgeyBjb3VudCsrOyBteVBvcHVwLmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdteV9wcm9ncmVzcycpLmlubmVySFRNTCA9ICdQcm9ncmVzczogJytNYXRoLnJvdW5kKDEwMC8odmlkX2Zyb20tdmlkX3RvKzEpKmNvdW50KSsnJSc7IH0pOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9DQogICAgfQ0K');
  52.             document.getElementsByTagName('body')[0].appendChild(js);
  53.         });
  54.     }
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