Greasy Fork is available in English.

MediaKlikk - mentés

Mentési segéd

  1. // ==UserScript==
  2. // @name MediaKlikk - mentés
  3. // @namespace
  4. // @version 0.9
  5. // @description Mentési segéd
  6. // @author vacsati
  7. // @match https://player.mediaklikk.hu/playernew/player.php?video=*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-1.12.4.min.js
  10. // ==/UserScript==
  11. // Szükséges http://data.hu/get/7879852/chunk_list_downloader_v1.1.zip
  12.  
  13. console.log('MediaKlikk - mentés');
  14.  
  15. var letolt = "<svg fill='rgba(255,255,255,1)' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M0 0h24v24H0z' fill='none'/><path d='M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z'/></svg>";
  16. var stilus="position:absolute;top:100px;right:100px;background:rgba(0,0,0,0.5);border-radius:5px;padding:2px 4px;";
  17. var allomany=jwplayer().getPlaylist(); allomany=allomany[0].file;
  18. var hivatkozas=allomany.replace("playlist.m3u8", ""); //console.log('m3u8:'+allomany+' hivatkozás:'+hivatkozas);
  19. var tmp = allomany.lastIndexOf("/");
  20. var legngyb=0;
  21. var legjobb=null;
  22. var legjbbk=false;
  23. //var cim=document.title.split(' | ')[0].replace(/ /g, "_");
  24. var cim=decodeURI(window.location.search.split('&title=')[1].split('&')[0]).replace(/ /g, "_");
  25. cim=cim.replace(/[őóö]/ig,"o");cim=cim.replace(/[úűü]/ig,"o");cim=cim.replace(/á/ig,"a");cim=cim.replace(/é/ig,"e");
  26. if (tmp != -1) {
  27. var base_url = allomany.substr(0, tmp + 1);
  28. var m3u8 = allomany;
  29. $.ajax({
  30. type: "GET",
  31. url: m3u8,
  32. success: function(data) {
  33. $content=data;
  34. arr=data.split("\n");
  35. $removeItem = arr[0];
  36. arr = jQuery.grep(arr, function(value) {
  37. return value !== $removeItem;
  38. });
  39. arr1=[];
  40. arr2=[];
  41. $.each(arr, function(index, value ){
  42. //var pattern = /#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=[0-9]*/; //élő
  43. var pattern = /#EXT-X-STREAM-INF:BANDWIDTH=[0-9]*/; //régi
  44. if(pattern.test(value)){
  45. var band=value.split("BANDWIDTH=")[1];
  46. band=Number(band.split(",")[0]);
  47. if(band > legngyb){
  48. legjbbk=true;
  49. legngyb = band;
  50. }
  51. //console.log('bnd: '+band);
  52. } else {
  53. pattern = /m3u8/;
  54. if(pattern.test(value)){
  55. //console.log('m3u8: '+value);
  56. if(legjbbk){
  57. legjbbk=false;
  58. legjobb=value;
  59. }
  60. }else{
  61. //console.log('nem m3u8: '+value);
  62. }
  63. }
  64. });
  65. //console.log('arr: '+JSON.stringify(arr));
  66. },
  67. error: function(request, status, error) {
  68. console.log('bajvan: '+error);
  69. },
  70. complete: function(data) {
  71. console.log('megvan:'+legjobb);//chunklist_w557993959_b3000000.m3u8
  72. var ny=legjobb.substring(10).split('.')[0];ny="media_"+ny+"_";
  73. var kesz="complete_"+ny+"0.ts";
  74. var btch="DEL "+ny+"*.ts\nREN "+kesz+" "+cim+".ts\nDEL indits-el*.bat";
  75. var bat_forras = "data:text/plain;base64," + btoa('C:\\CLD\\chunklist_downloader.exe "https:'+hivatkozas+legjobb+'"\nSTART C:\\CLD\n'+btch);
  76. $('#player').append('<a id="segedgomb3" href="'+bat_forras+'" download="indits-el.bat" style="'+stilus+'">'+letolt+'</a>');
  77. }
  78. });
  79. }