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