pastebin

Paste Search Dynamic
Recent pastes
9anime Batch Downloader
  1. // ==UserScript==
  2. // @name         9anime Batch Downloader
  3. // @namespace    https://greasyfork.org/en/scripts/31118-9anime-batch-downloader
  4. // @version      2.3.4.0
  5. // @description  Download all episodes automatically from Server F4 (only). How to use: Open the anime page. Start playing the video. Just above the server list you should see the Download all button. Hit it, copy the links and add to your download manager as a batch, and enjoy!!
  6. // @author       wrick17
  7. // @match        https://9anime.ru/watch/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.     'use strict';
  13.  
  14.     var interval = setInterval(function() {
  15.       var downloadButton = $('.download.movie');
  16.       var link = downloadButton.attr('href');
  17.  
  18.       if (link) {
  19.         clearInterval(interval);
  20.         $('#servers')
  21.         .before('<button class="btn btn-primary btn-sm download-trigger" style="margin-bottom: 10px;">Download all of \'em!</button>')
  22.         .before('<button class="btn btn-primary btn-sm download-close" style="margin-bottom: 10px; display: none;">Close the links box.</button>')
  23.         .before('<div class="download-label" style="display: none; color: #9a9a9a; margin-bottom: 15px; ">Add the following links to your download manager and enjoy:</div>')
  24.         .before('<textarea class="download-links" style="display: none; width: 100%; height: 200px; background: #0f0e13; color: #9a9a9a; border: none; margin-bottom: 10px; padding: 10px;"></textarea>');
  25.       }
  26.     }, 100);
  27.  
  28.     $('body').on('click', '.download-trigger', function(e) {
  29.  
  30.       var episodesArray = [];
  31.       $('#servers .server[data-type="direct"] .episodes li a').each(function(idx, el) {
  32.         episodesArray.push( $(el).html() );
  33.       });
  34.  
  35.       var downloadButton = $('.download.movie');
  36.       var link = downloadButton.attr('href');
  37.  
  38.       var match = (/(.*)- (?:[0-9\-]+) -(.*)/g).exec(link);
  39.       var start = match[1] + '- ';
  40.       var end = ' -' + match[2];
  41.  
  42.  
  43.       var linksBlob = '';
  44.       episodesArray.forEach(function(episode) {
  45.         linksBlob += encodeuri(start + episode + end) + '\n';
  46.       });
  47.  
  48.       $('.download-links').val(linksBlob).show();
  49.       $('.download-label, .download-close').show();
  50.       $('.download-trigger').hide();
  51.  
  52.     });
  53.  
  54.     $('body').on('click', '.download-close', function(e) {
  55.       $('.download-links').val('');
  56.       $('.download-label, .download-close, .download-links').hide();
  57.       $('.download-trigger').show();
  58.     })
  59.  
  60. })();
Parsed in 0.013 seconds