Skip to content

Instantly share code, notes, and snippets.

@seszele64
Last active June 20, 2026 14:05
Show Gist options
  • Select an option

  • Save seszele64/011bd8a049d11fc9579d93afafa0367c to your computer and use it in GitHub Desktop.

Select an option

Save seszele64/011bd8a049d11fc9579d93afafa0367c to your computer and use it in GitHub Desktop.
Download documents from docer sites bypassing paywall
// ==UserScript==
// @name Docer Document Downloader (Multi-site)
// @namespace http://tampermonkey.net/
// @version 2
// @description Intercepts document URLs from various Docer sites and creates a direct download link
// @author seszele64
// @match https://docer.pl/*
// @match https://docer.com.ar/*
// @match https://docer.ar/*
// @match https://doceru.com/*
// @match https://docero.de/*
// @grant GM_log
// @updateURL https://gist.github.com/seszele64/011bd8a049d11fc9579d93afafa0367c/raw/Docer%20Document%20Downloader.user.js
// @downloadURL https://gist.github.com/seszele64/011bd8a049d11fc9579d93afafa0367c/raw/Docer%20Document%20Downloader.user.js
// ==/UserScript==
(function() {
'use strict';
const SUPPORTED_DOMAINS = ['docer.pl', 'docer.com.ar', 'docer.ar', 'doceru.com', 'docero.de'];
function debug(message) {
GM_log('[Docer Debug] ' + message);
console.log('[Docer Debug] ' + message);
}
function createDownloadLink(url) {
debug('Creating download link for URL: ' + url);
// Parse the URL to get the direct PDF link
let directPdfUrl = url;
try {
const parsedUrl = new URL(url);
const embeddedUrl = parsedUrl.searchParams.get('url');
if (embeddedUrl) {
directPdfUrl = decodeURIComponent(embeddedUrl);
}
} catch (e) {
debug('Error parsing URL: ' + e.message);
}
debug('Direct PDF URL: ' + directPdfUrl);
const linkContainer = document.createElement('div');
linkContainer.style.position = 'fixed';
linkContainer.style.top = '10px';
linkContainer.style.right = '10px';
linkContainer.style.zIndex = '9999';
linkContainer.style.backgroundColor = 'white';
linkContainer.style.padding = '10px';
linkContainer.style.border = '1px solid black';
const link = document.createElement('a');
link.href = directPdfUrl;
link.textContent = 'Download Document';
link.style.color = 'blue';
link.style.textDecoration = 'underline';
link.setAttribute('download', '');
linkContainer.appendChild(link);
document.body.appendChild(linkContainer);
}
// Intercept all XHR requests
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
const url = arguments[1];
debug('XHR request intercepted: ' + url);
if (url.includes('/start/show')) {
this.addEventListener('load', function() {
debug('XHR response received for: ' + this.responseURL);
debug('Response status: ' + this.status);
debug('Response type: ' + this.responseType);
if (this.responseType === '' || this.responseType === 'text') {
debug('Response text: ' + this.responseText);
try {
const data = JSON.parse(this.responseText);
debug('Parsed JSON: ' + JSON.stringify(data));
if (data.response && data.response.url) {
const pdfUrl = data.response.url;
debug('PDF URL found: ' + pdfUrl);
createDownloadLink(pdfUrl);
} else {
debug('PDF URL not found in response');
}
} catch (e) {
debug('Error parsing JSON: ' + e.message);
}
} else {
debug('Response is not text, cannot parse');
}
});
}
return originalOpen.apply(this, arguments);
};
debug('Docer PDF Downloader script is active (Multi-site version)');
})();
@igorgustavodafonseca

Copy link
Copy Markdown

NOT WORKING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment