Skip to content

Instantly share code, notes, and snippets.

@flexchar
Created October 27, 2023 16:29
Show Gist options
  • Save flexchar/928bc1958a8d23c99b5eeb33d3b73003 to your computer and use it in GitHub Desktop.
Save flexchar/928bc1958a8d23c99b5eeb33d3b73003 to your computer and use it in GitHub Desktop.
Lån og Spar scraper for SKAT
javascript: /** Tryk_for_at_importere_data **/ (function () {
'use strict';
console.log('Bookmarklet running...');
var uploadServerUrl =
'https://api-shared-proxy.sdc.eu/api/public/v1/file-upload/external/upload';
var sambaServerUrl = 'https://api-shared-proxy.sdc.eu/api/public/v1/samba';
var main_js_url = 'https://bundles.lsb.dk/external/scrape';
var appTitle = 'Lån & Spar';
var logoUrl = '/logo-lsb.png';
var handleRequest = function () {
if (this.readyState === 4) {
console.log(this);
if (this.status === 200) {
console.log('Script fetched...');
console.log(window);
eval(this.responseText);
window.festina.scraping.scrape(
sambaServerUrl,
uploadServerUrl,
main_js_url,
null,
null,
'2f0f3655f53448bdb4b5fc13f15449c2',
appTitle,
logoUrl
);
request.onreadystatechange = null;
} else {
alert(
'Du skal være på tastselv.skat.dk for at anvende denne. Status kode: ' +
this.status
);
}
}
};
var request = new XMLHttpRequest();
request.open(
'GET',
main_js_url + '/scraping.js?nocache=' + new Date().getTime(),
true
);
if (request.overrideMimeType) {
request.overrideMimeType('text/javascript');
}
request.timeout = 2 * 60 * 1000;
request.ontimeout = function () {
alert('Kaldet for at hente import script timede ud');
};
request.onreadystatechange = handleRequest;
request.send();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment