anka-213 / Skip shorte.st ads

// ==UserScript==
// @name         Skip shorte.st ads
// @namespace    https://openuserjs.org/users/anka-213
// @version      0.1
// @description  Skip the ads on shorte.st
// @author       Andreas Källberg
// @match        http://sh.st/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

	var sess = document.documentElement.innerHTML.match(/sessionId: "(.*)"/)[1];
	var log  = x => (console.log(x), x);

	fetch("/shortest-url/end-adsession?adSessionId="+sess) //,{credentials: "same-origin"})
	     .then(log)
         .then(x=>x.json())
         .then(x=>x.destinationUrl)
         .then(log)
         .then(x=> window.location = x)
         .catch(e=>console.error(e));
})();