Advertisement
Guest User

Descargar capitulos

a guest
May 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         New Userscript
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        http://*/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     var getCommand = function() {
  15.         var videoUrl = (document.getElementsByTagName('iframe')[0].contentDocument).getElementsByTagName('video')[0].src;
  16.  
  17.         if (videoUrl.match(/.*google.*\.mp4$/)) {
  18.             alert(videoUrl);
  19.         } else {
  20.             alert('No se ha encontrado url de video descargable');
  21.         }
  22.     };
  23.  
  24.     // Si tengo al menos una opción que venga de google apis tiro palante
  25.     var googleApiOption = Array.from(document.querySelectorAll('span.server'))
  26.         .map(s => ({ node: s, text: s.innerText}))
  27.         .filter(s => s.text.match(/googleapis/i));
  28.  
  29.     if (googleApiOption.length > 0) {
  30.         // Me aseguro de primero seleccionar la opcion de google api
  31.         googleApiOption[0].node.parentNode.click();
  32.  
  33.         // Pongo mi boton de descarga
  34.         var container = document.getElementById('playcontainer');
  35.         var downloadButton = document.createElement('button');
  36.         downloadButton.type = 'button';
  37.         downloadButton.innerText = 'Descargar';
  38.         downloadButton.addEventListener('click', getCommand);
  39.         container.appendChild(downloadButton);
  40.     }
  41.  
  42.    
  43.     // Your code here...
  44. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement