Greasy Fork is available in English.

Pixeldrain Download Bypass

Bypass Pixeldrain Download Limit

  1. // ==UserScript==
  2. // @name Pixeldrain Download Bypass
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.6.3
  5. // @description Bypass Pixeldrain Download Limit
  6. // @author MegaLime0, honey, Nurarihyon
  7. // @match https://pixeldrain.com/*
  8. // @match https://cdn.pd8.workers.dev/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=pixeldrain.com
  10. // @grant GM_openInTab
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. const bypassUrl = "https://pd.cybar.xyz/";
  17. const idRegex = /\/api\/file\/(\w+)\//;
  18.  
  19.  
  20. function getBypassUrls(urlType) {
  21. const currentUrl = window.location.href;
  22.  
  23. if (urlType == "file") {
  24. const id = currentUrl.replace("https://pixeldrain.com/u/", "");
  25. const alteredUrl = bypassUrl + id;
  26.  
  27. return alteredUrl;
  28. }
  29.  
  30. if (urlType == "gallery") {
  31. const links = document.querySelectorAll('a.file');
  32.  
  33. const bypassUrlList = [];
  34. const bypassUrlNames = [];
  35.  
  36. links.forEach((link) => {
  37. const childDiv = link.querySelector('div');
  38. const backgroundUrl = childDiv.style.backgroundImage;
  39.  
  40. const match = backgroundUrl.match(idRegex);
  41.  
  42. if (match && match.length > 1) {
  43. const alteredUrl = bypassUrl + match[1];
  44. bypassUrlList.push(alteredUrl);
  45. bypassUrlNames.push(link.textContent);
  46. }
  47. });
  48.  
  49. return {bypassUrlList, bypassUrlNames};
  50. }
  51. }
  52.  
  53. function handleButtonClick() {
  54. const currentUrl = window.location.href;
  55.  
  56. if (currentUrl.includes("https://pixeldrain.com/u/")) {
  57. const alteredUrl = getBypassUrls("file");
  58. startDownload(alteredUrl);
  59. }
  60.  
  61. if (currentUrl.includes("https://pixeldrain.com/l/")) {
  62. const links = getBypassUrls("gallery").bypassUrlList;
  63.  
  64. links.forEach((link) => {
  65. startDownload(link)
  66. });
  67. }
  68. }
  69.  
  70. function startDownload(link) {
  71. // GM_openInTab(link); Old way of downloading
  72. const a = document.createElement("a");
  73. a.href = link;
  74. a.click();
  75. }
  76.  
  77. function handleLinksButtonClick() {
  78. const popupBox = document.getElementById('popupBox');
  79. const popupClose = document.createElement('span');
  80. popupClose.innerHTML = '×';
  81. popupClose.style.position = 'absolute';
  82. popupClose.style.top = '1px';
  83. popupClose.style.right = '7px';
  84. popupClose.style.cursor = 'pointer';
  85. popupClose.onclick = function() {
  86. popupBox.style.display = 'none';
  87. };
  88.  
  89. popupBox.innerHTML = '';
  90. popupBox.appendChild(popupClose);
  91.  
  92. const currentUrl = window.location.href;
  93.  
  94. if (currentUrl.includes("https://pixeldrain.com/u/")) {
  95. const alteredUrl = getBypassUrls("file");
  96. const urlElement = document.createElement("a");
  97. urlElement.href = alteredUrl;
  98. urlElement.textContent = alteredUrl;
  99. popupBox.appendChild(urlElement);
  100. }
  101.  
  102. if (currentUrl.includes("https://pixeldrain.com/l/")) {
  103. let result = getBypassUrls("gallery");
  104. let bypassLinks = result.bypassUrlList;
  105. let bypassNames = result.bypassUrlNames;
  106.  
  107. const linksContainer = document.createElement("div");
  108. linksContainer.style.maxHeight = "calc(100% - 40px)";
  109. linksContainer.style.overflowY = "auto";
  110. linksContainer.style.paddingBottom = "10px";
  111.  
  112. bypassLinks.forEach((link) => {
  113. const urlElement = document.createElement("a");
  114. urlElement.href = link;
  115. urlElement.textContent = link;
  116. urlElement.style.display = "block";
  117. linksContainer.appendChild(urlElement);
  118. });
  119.  
  120. popupBox.appendChild(linksContainer);
  121.  
  122. popupBox.style.display = 'flex';
  123. popupBox.style.flexDirection = 'column';
  124. popupBox.style.alignItems = 'center';
  125. popupBox.style.justifyContent = 'center';
  126.  
  127. const buttonContainer = document.createElement('div');
  128. buttonContainer.style.display = 'flex';
  129. buttonContainer.style.justifyContent = 'center';
  130. buttonContainer.style.marginTop = '10px';
  131.  
  132. const copyButton = document.createElement('button');
  133. copyButton.textContent = '🔗 Copy URL';
  134. copyButton.style.marginRight = '5px';
  135. copyButton.addEventListener('click', function() {
  136. const urls = bypassLinks.join('\n');
  137. navigator.clipboard.writeText(urls).then(function() {
  138. copyButton.textContent = "✔️ Copied";
  139. setTimeout(function() {
  140. copyButton.textContent = '🔗 Copy URL';
  141. }, 2500);
  142. }, function(err) {
  143. console.error('Failed to copy URLs: ', err);
  144. });
  145. });
  146. buttonContainer.appendChild(copyButton);
  147.  
  148. const saveButton = document.createElement('button');
  149. saveButton.textContent = '📄 Save as Text File';
  150. saveButton.style.marginLeft = '5px';
  151. saveButton.addEventListener('click', function() {
  152. const popupContent = document.getElementById('popupBox').querySelectorAll('a');
  153. if (popupContent.length > 0) {
  154. const currentUrl = window.location.href;
  155. const fileIdMatch = currentUrl.match(/\/l\/([^/#?]+)/);
  156. if (fileIdMatch && fileIdMatch.length > 1) {
  157. const fileId = fileIdMatch[1];
  158. const fileName = fileId + '.txt';
  159. let content = '';
  160. popupContent.forEach((link) => {
  161. content += link.href + '\n';
  162. });
  163. const blob = new Blob([content.trim()], { type: 'text/plain' });
  164. const url = URL.createObjectURL(blob);
  165. const a = document.createElement('a');
  166. a.href = url;
  167. a.download = fileName;
  168. document.body.appendChild(a);
  169. a.click();
  170. document.body.removeChild(a);
  171. URL.revokeObjectURL(url);
  172. } else {
  173. console.error('Failed to extract file identifier from URL.');
  174. }
  175. } else {
  176. console.error('Popup content not found.');
  177. }
  178. });
  179. buttonContainer.appendChild(saveButton);
  180.  
  181. popupBox.appendChild(buttonContainer);
  182. }
  183.  
  184. popupBox.style.display = 'block';
  185. }
  186.  
  187. if (window.location.href.includes('pixeldrain.com')) {
  188. const button = document.createElement("button");
  189. const downloadIcon = document.createElement("a");
  190. downloadIcon.className = "icon";
  191. downloadIcon.textContent = "download";
  192. downloadIcon.style.color = "#d7dde8";
  193. const downloadButtonText = document.createElement("span");
  194. downloadButtonText.textContent = "Download Bypass";
  195. button.appendChild(downloadIcon);
  196. button.appendChild(downloadButtonText);
  197.  
  198. const linksButton = document.createElement("button");
  199. const linksIcon = document.createElement("i");
  200. linksIcon.className = "icon";
  201. linksIcon.textContent = "link";
  202. const linksButtonText = document.createElement("span");
  203. linksButtonText.textContent = "Show Bypass Links";
  204. linksButton.appendChild(linksIcon);
  205. linksButton.appendChild(linksButtonText);
  206.  
  207. const popupBox = document.createElement("div");
  208. popupBox.style.zIndex = 20;
  209. popupBox.style.whiteSpace = "pre-line";
  210. popupBox.id = "popupBox";
  211. popupBox.style.display = "none";
  212. popupBox.style.position = "fixed";
  213.  
  214. popupBox.style.top = "50%";
  215. popupBox.style.left = "50%";
  216. popupBox.style.transform = "translate(-50%, -50%)";
  217. popupBox.style.padding = "20px";
  218. popupBox.style.background = "#2f3541";
  219. popupBox.style.border = "2px solid #a4be8c";
  220. popupBox.style.color = "#d7dde8";
  221. popupBox.style.borderRadius = "10px";
  222. popupBox.style.width = "30%";
  223. popupBox.style.height = "auto";
  224. popupBox.style.maxWidth = "600px";
  225.  
  226. button.addEventListener('click', handleButtonClick);
  227. linksButton.addEventListener('click', handleLinksButtonClick);
  228.  
  229. const labels = document.querySelectorAll('div.label');
  230. labels.forEach(label => {
  231. if (label.textContent.trim() === 'Size') {
  232. const nextElement = label.nextElementSibling;
  233. if (nextElement) {
  234. nextElement.insertAdjacentElement('afterend', linksButton);
  235. nextElement.insertAdjacentElement('afterend', button);
  236. }
  237. }
  238. });
  239.  
  240. document.body.appendChild(popupBox);
  241.  
  242. function positionPopupBox(popupBox) {
  243. const popupRect = popupBox.getBoundingClientRect();
  244. popupBox.style.top = `calc(50% - ${popupRect.height / 2}px)`;
  245. popupBox.style.left = `calc(50% - ${popupRect.width / 2}px)`;
  246. }
  247. }
  248. })();