Scribd Auto Downloader by 3xploiton3

Automate download Scribd via vDownloader & iLIDE (Scribd doc/documents/presentation)

Stan na 15-08-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Scribd Auto Downloader by 3xploiton3
// @namespace    https://greasyfork.org/users/3xploiton3
// @version      1.4
// @description  Automate download Scribd via vDownloader & iLIDE (Scribd doc/documents/presentation)
// @author       3xploiton3
// @match        https://*.scribd.com/document/*
// @match        https://*.scribd.com/doc/*
// @match        https://*.scribd.com/presentation/*
// @match        https://scribd.vdownloaders.com/*
// @match        https://ilide.info/doc-viewer-v2*
// @icon         https://scribd.vdownloaders.com/favicon.ico
// @license      MIT
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  function onMutation(root, cb) {
    if (typeof MutationObserver === 'undefined') {
      var i = setInterval(cb, 500);
      setTimeout(function(){ clearInterval(i); }, 30000);
      return { disconnect: function() { clearInterval(i); } };
    }
    var mo = new MutationObserver(function(){ cb(); });
    mo.observe(root || document.body, { childList: true, subtree: true });
    return mo;
  }

  var host = location.hostname;
  var path = location.pathname;

  // 1) Scribd pages: add button
  if (host.indexOf('scribd.com') > -1 &&
      (path.indexOf('/document/') > -1 || path.indexOf('/doc/') > -1 || path.indexOf('/presentation/') > -1)) {

    var currentURL = window.location.href;
    var vDownloadURL = 'https://scribd.vdownloaders.com/?doc=' + encodeURIComponent(currentURL);

    var button = document.createElement('button');
    button.appendChild(document.createTextNode('⬇ Download via vDownloader'));
    button.style.position = 'fixed';
    button.style.top = '80px';
    button.style.right = '20px';
    button.style.zIndex = '2147483647';
    button.style.padding = '10px 15px';
    button.style.backgroundColor = '#1a73e8';
    button.style.color = '#fff';
    button.style.border = 'none';
    button.style.borderRadius = '4px';
    button.style.cursor = 'pointer';
    button.style.fontSize = '14px';
    button.style.boxShadow = '0 2px 5px rgba(0,0,0,0.3)';
    button.onclick = function () { location.href = vDownloadURL; };
    document.body.appendChild(button);
  }

  // 2) vDownloader landing: auto-paste + submit
  if (host === 'scribd.vdownloaders.com' && path === '/') {
    var params = new URLSearchParams(window.location.search);
    var docURL = params.get('doc');
    if (!docURL) return;

    (function fillAndClick(){
      var input = document.querySelector('form input[name="url"], form #url');
      var submitBtn = document.querySelector('form button[type="submit"], form input[type="submit"]');
      if (input && submitBtn) {
        input.value = docURL;
        input.dispatchEvent(new Event('input', { bubbles: true }));
        input.dispatchEvent(new Event('change', { bubbles: true }));
        setTimeout(function(){ submitBtn.click(); }, 400);
      } else {
        setTimeout(fillAndClick, 400);
      }
    })();
  }

  // 3) vDownloader result: auto-click download
  if (host === 'scribd.vdownloaders.com' && path.substr(0, 5) === '/vdoc') {
    var mo1 = onMutation(document.body, function(){
      var downloadBtn = document.querySelector('a.btn[href*="pdf"], a[href*="download"]');
      if (downloadBtn) {
        downloadBtn.click();
        if (mo1 && mo1.disconnect) mo1.disconnect();
      }
    });
  }

  // 4) iLIDE doc-viewer: auto-click main button, then modal's download
  if (host === 'ilide.info' && path.indexOf('/doc-viewer-v2') === 0) {
    var clickedMain = false;

    var mo2 = onMutation(document.body, function(){
      // Step A: click the big orange button
      var mainBtn = document.getElementById('btnDownload');
      if (mainBtn && !clickedMain) {
        mainBtn.click();
        clickedMain = true;
      }

      // Step B: when modal appears, click the download control inside it
      var modal = document.getElementById('downloadModalCenter');
      if (modal && (modal.className.indexOf('show') > -1 || modal.style.display === 'block')) {
        // Try common selectors inside Bootstrap modal
        var inner =
          modal.querySelector('a[href*="download"]') ||
          modal.querySelector('a[href*="pdf"]') ||
          modal.querySelector('button[id*="download"]') ||
          modal.querySelector('button[name*="download"]') ||
          modal.querySelector('button[type="submit"]');

        if (inner) {
          inner.click();
          if (mo2 && mo2.disconnect) mo2.disconnect();
        }
      }
    });
  }
})();