Scribd Bypass

Skip Scribd for its free counterpart.

  1. // ==UserScript==
  2. // @name Scribd Bypass
  3. // @description Skip Scribd for its free counterpart.
  4. // @author 573dave
  5. // @version 2.0
  6. // @license MIT
  7. // @match *://*.scribd.com/*
  8. // @match *://ilide.info/doc-viewer-v2*
  9. // @grant GM_addStyle
  10. // @grant GM_setValue
  11. // @namespace https://greatest.deepsurf.us/users/1241821
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. GM_addStyle(`
  18. .sb-m{position:fixed;top:0;left:50%;transform:translateX(-50%);display:flex;gap:5px;z-index:10001;background:rgba(255,255,255,.85);padding:5px 10px;border-radius:0 0 5px 5px;box-shadow:0 2px 5px rgba(0,0,0,.2)}
  19. .sb-b{font:12px/1 sans-serif;padding:5px 10px;background:#FFC017;color:#000;border:none;border-radius:5px;cursor:pointer;transition:.3s}
  20. .sb-b:hover{background:#E6AC15}
  21. .sb-e{left:0;width:100%;height:0;position:relative;padding:45px 0 77.2727%}
  22. .sb-i{position:absolute;inset:0;width:100%;height:100%;border:0}
  23. `);
  24.  
  25. const createButton = (text, onClick) => {
  26. const btn = document.createElement('button');
  27. btn.textContent = text;
  28. btn.className = 'sb-b';
  29. btn.onclick = onClick;
  30. return btn;
  31. };
  32.  
  33. const createMenu = () => {
  34. const menu = document.createElement('div');
  35. menu.className = 'sb-m';
  36. document.body.prepend(menu);
  37. return menu;
  38. };
  39.  
  40. const handleScribd = () => {
  41. const match = location.href.match(/\/(doc|document|presentation)\/(\d+)\/(.*)/);
  42. if (match) {
  43. const [, , id, title] = match;
  44. GM_setValue('origUrl', location.href);
  45. document.body.innerHTML = `<div class="sb-e"><iframe class="sb-i" src="https://www.scribd.com/embeds/${id}/content"></iframe></div>`;
  46. createMenu().appendChild(
  47. createButton("Download", () => {
  48. const downloadUrl = `https://ilide.info/docgeneratev2?fileurl=${encodeURIComponent(`https://scribd.vdownloaders.com/pdownload/${id}/${title}`)}&title=${encodeURIComponent(title)}&utm_source=scrfree&utm_medium=queue&utm_campaign=dl`;
  49. location.href = downloadUrl;
  50. })
  51. );
  52. }
  53. };
  54.  
  55. const handleIlide = () => {
  56. const match = document.body.innerHTML.match(/https:\/\/ilide\.info\/docdownloadv2[^" ]+/);
  57. if (match) {
  58. location.href = `https://ilide.info/viewer/web/viewer.html?file=${encodeURIComponent(match[0])}#page=1`;
  59. }
  60. };
  61.  
  62. const { hostname } = location;
  63. if (hostname.includes("scribd.com")) {
  64. handleScribd();
  65. } else if (hostname === "ilide.info" && location.pathname.startsWith("/doc-viewer-v2")) {
  66. handleIlide();
  67. }
  68. })();