Greasy Fork is available in English.

Scribd Viewer/Downloader

View or download from Scribd without an account

  1. // ==UserScript==
  2. // @name Scribd Viewer/Downloader
  3. // @namespace 0b9
  4. // @match *://www.scribd.com/*
  5. // @grant none
  6. // @version 1.0
  7. // @author 0b9
  8. // @description View or download from Scribd without an account
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. let originalUrl = null;
  15. function redirectToEmbed() {
  16. const currentUrl = window.location.href;
  17. sessionStorage.setItem('originalUrl', currentUrl);
  18. const regex = /https:\/\/www\.scribd\.com\/[^/]+\/([^/]+)\/[^/]+/;
  19. const match = currentUrl.match(regex);
  20.  
  21. if (match) {
  22. const newUrl = `https://www.scribd.com/embeds/${match[1]}/content`;
  23. window.location.href = newUrl;
  24. } else {
  25. alert("Error: No match");
  26. }
  27. }
  28.  
  29. function downloadContent() {
  30. const contentElements = document.querySelectorAll('.text_layer .a');
  31. let content = '';
  32. contentElements.forEach(element => {
  33. content += element.textContent + '\n';
  34. });
  35.  
  36. const blob = new Blob([content], { type: 'text/plain' });
  37. const url = URL.createObjectURL(blob);
  38. const a = document.createElement('a');
  39. a.href = url;
  40. a.download = 'scribd_content.txt';
  41. document.body.appendChild(a);
  42. a.click();
  43. document.body.removeChild(a);
  44. URL.revokeObjectURL(url);
  45. }
  46.  
  47. function downloadContentAsPDF() {
  48. const savedUrl = sessionStorage.getItem('originalUrl');
  49.  
  50. if (!savedUrl) {
  51. alert('Error: !savedurl');
  52. return;
  53. }
  54.  
  55. const regex = /https:\/\/www\.scribd\.com\/(?:document|presentation)\/(\d+)\/([^\/?#]+)/;
  56.  
  57. const match = savedUrl.match(regex);
  58.  
  59. if (match) {
  60. const part1 = match[1]; // e.g. "505139221"
  61. const part2 = match[2]; // e.g. "xtream-codes-4"
  62.  
  63. console.log(`doc_number: ${part1}`);
  64. console.log(`doc_title: ${part2}`);
  65.  
  66. const urls = [
  67. `https://compress-pdf.vietdreamhouse.com/?fileurl=https://scribd.downloader.tips/pdownload/${part1}/${part2}&title=${part2}`,
  68. `https://compress.tacz.info/?fileurl=https://scribd.vpdfs.com/pdownload/${part1}/${part2}&title=${part2}`
  69. ];
  70.  
  71. const randomUrl = urls[Math.floor(Math.random() * urls.length)];
  72. window.location.href = randomUrl;
  73. }
  74. else {
  75. alert('Error: Invalid URL');
  76. }
  77. }
  78.  
  79. const redirectButton = document.createElement('button');
  80. redirectButton.textContent = 'View Full';
  81. redirectButton.style.position = 'fixed';
  82. redirectButton.style.top = '10px';
  83. redirectButton.style.right = '10px';
  84. redirectButton.style.zIndex = '1000';
  85. redirectButton.style.padding = '10px';
  86. redirectButton.style.backgroundColor = '#4CAF50';
  87. redirectButton.style.color = 'white';
  88. redirectButton.style.border = 'none';
  89. redirectButton.style.borderRadius = '5px';
  90. redirectButton.style.cursor = 'pointer';
  91.  
  92. redirectButton.addEventListener('click', redirectToEmbed);
  93. document.body.appendChild(redirectButton);
  94.  
  95.  
  96. const downloadButton = document.createElement('button');
  97. downloadButton.textContent = 'Download TXT';
  98. downloadButton.style.position = 'fixed';
  99. downloadButton.style.top = '50px';
  100. downloadButton.style.right = '10px';
  101. downloadButton.style.zIndex = '1000';
  102. downloadButton.style.padding = '10px';
  103. downloadButton.style.backgroundColor = '#007BFF';
  104. downloadButton.style.color = 'white';
  105. downloadButton.style.border = 'none';
  106. downloadButton.style.borderRadius = '5px';
  107. downloadButton.style.cursor = 'pointer';
  108.  
  109. downloadButton.addEventListener('click', downloadContent);
  110. document.body.appendChild(downloadButton);
  111.  
  112. const downloadPDFButton = document.createElement('button');
  113. downloadPDFButton.textContent = 'Download PDF';
  114. downloadPDFButton.style.position = 'fixed';
  115. downloadPDFButton.style.top = '90px';
  116. downloadPDFButton.style.right = '10px';
  117. downloadPDFButton.style.zIndex = '1000';
  118. downloadPDFButton.style.padding = '10px';
  119. downloadPDFButton.style.backgroundColor = '#FF5733';
  120. downloadPDFButton.style.color = 'white';
  121. downloadPDFButton.style.border = 'none';
  122. downloadPDFButton.style.borderRadius = '5px';
  123. downloadPDFButton.style.cursor = 'pointer';
  124.  
  125. downloadPDFButton.addEventListener('click', downloadContentAsPDF);
  126.  
  127. document.body.appendChild(downloadPDFButton);
  128.  
  129. })();