Scribd Content Viewer/Downloader

View or export scribd docs content for free

  1. // ==UserScript==
  2. // @name Scribd Content Viewer/Downloader
  3. // @namespace Violentmonkey Scripts
  4. // @match *://www.scribd.com/*
  5. // @grant none
  6. // @version 1.0
  7. // @author FENZIGO
  8. // @description View or export scribd docs content for free
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12.  
  13.  
  14. (function() {
  15.  
  16. 'use strict';
  17.  
  18. let originalUrl = null;
  19.  
  20.  
  21. function redirectToEmbed() {
  22.  
  23. const currentUrl = window.location.href;
  24.  
  25. localStorage.setItem('originalUrl', currentUrl);
  26.  
  27. const regex = /https:\/\/www\.scribd\.com\/[^/]+\/([^/]+)\/[^/]+/; // Użycie dzikiej karty
  28.  
  29.  
  30. const match = currentUrl.match(regex);
  31.  
  32.  
  33.  
  34. if (match) {
  35.  
  36.  
  37.  
  38. const newUrl = `https://www.scribd.com/embeds/${match[1]}/content`;
  39.  
  40. window.location.href = newUrl;
  41.  
  42. } else {
  43.  
  44. alert("Refresh page.");
  45.  
  46. }
  47.  
  48. }
  49.  
  50.  
  51.  
  52. function downloadContent() {
  53.  
  54. const contentElements = document.querySelectorAll('.text_layer .a');
  55.  
  56. let content = '';
  57.  
  58.  
  59. contentElements.forEach(element => {
  60.  
  61. content += element.textContent + '\n';
  62.  
  63. });
  64.  
  65.  
  66.  
  67.  
  68. const blob = new Blob([content], { type: 'text/plain' });
  69.  
  70. const url = URL.createObjectURL(blob);
  71.  
  72. const a = document.createElement('a');
  73.  
  74. a.href = url;
  75.  
  76. a.download = 'scribd_content.txt';
  77. document.body.appendChild(a);
  78.  
  79. a.click();
  80.  
  81. document.body.removeChild(a);
  82.  
  83. URL.revokeObjectURL(url);
  84.  
  85. }
  86.  
  87.  
  88.  
  89.  
  90. function downloadContentAsPDF() {
  91.  
  92. const savedUrl = localStorage.getItem('originalUrl');
  93.  
  94. if (!savedUrl) {
  95. alert('Refresh page');
  96. return;
  97. }
  98.  
  99.  
  100. const regex = /https:\/\/www\.scribd\.com\/document\/(\d+)\/(.+)/;
  101.  
  102. const match = savedUrl.match(regex);
  103.  
  104. if (match) {
  105. const part1 = match[1]; // np. "505139221"
  106. const part2 = match[2]; // np. "xtream-codes-4"
  107.  
  108. console.log(`doc_number: ${part1}`);
  109. console.log(`doc_title: ${part2}`);
  110.  
  111. const newUrl = `https://compress-pdf.vietdreamhouse.com/?fileurl=https://scribd.downloader.tips/pdownload/${part1}/${part2}`;
  112. window.location.href = newUrl;
  113. }
  114. else {
  115. alert('chujnia z url.');
  116. }
  117. }
  118.  
  119.  
  120.  
  121. const redirectButton = document.createElement('button');
  122.  
  123. redirectButton.textContent = 'View Full';
  124.  
  125. redirectButton.style.position = 'fixed';
  126.  
  127. redirectButton.style.top = '10px';
  128.  
  129. redirectButton.style.right = '10px';
  130.  
  131. redirectButton.style.zIndex = '1000';
  132.  
  133. redirectButton.style.padding = '10px';
  134.  
  135. redirectButton.style.backgroundColor = '#4CAF50';
  136.  
  137. redirectButton.style.color = 'white';
  138.  
  139. redirectButton.style.border = 'none';
  140.  
  141. redirectButton.style.borderRadius = '5px';
  142.  
  143. redirectButton.style.cursor = 'pointer';
  144.  
  145.  
  146.  
  147.  
  148. redirectButton.addEventListener('click', redirectToEmbed);
  149.  
  150. document.body.appendChild(redirectButton);
  151.  
  152.  
  153.  
  154.  
  155. const downloadButton = document.createElement('button');
  156.  
  157. downloadButton.textContent = 'Download(TXT)';
  158.  
  159. downloadButton.style.position = 'fixed';
  160.  
  161. downloadButton.style.top = '50px';
  162.  
  163. downloadButton.style.right = '10px';
  164.  
  165. downloadButton.style.zIndex = '1000';
  166.  
  167. downloadButton.style.padding = '10px';
  168.  
  169. downloadButton.style.backgroundColor = '#007BFF';
  170.  
  171. downloadButton.style.color = 'white';
  172.  
  173. downloadButton.style.border = 'none';
  174.  
  175. downloadButton.style.borderRadius = '5px';
  176.  
  177. downloadButton.style.cursor = 'pointer';
  178.  
  179.  
  180.  
  181.  
  182. downloadButton.addEventListener('click', downloadContent);
  183.  
  184. document.body.appendChild(downloadButton);
  185.  
  186.  
  187.  
  188.  
  189. const downloadPDFButton = document.createElement('button');
  190.  
  191. downloadPDFButton.textContent = 'Download(PDF)';
  192.  
  193. downloadPDFButton.style.position = 'fixed';
  194.  
  195. downloadPDFButton.style.top = '90px';
  196.  
  197. downloadPDFButton.style.right = '10px';
  198.  
  199. downloadPDFButton.style.zIndex = '1000';
  200.  
  201. downloadPDFButton.style.padding = '10px';
  202.  
  203. downloadPDFButton.style.backgroundColor = '#FF5733';
  204.  
  205. downloadPDFButton.style.color = 'white';
  206.  
  207. downloadPDFButton.style.border = 'none';
  208.  
  209. downloadPDFButton.style.borderRadius = '5px';
  210.  
  211. downloadPDFButton.style.cursor = 'pointer';
  212.  
  213.  
  214.  
  215. downloadPDFButton.addEventListener('click', downloadContentAsPDF);
  216.  
  217. document.body.appendChild(downloadPDFButton);
  218.  
  219. })();