Skip to content

Instantly share code, notes, and snippets.

@ToreJuloe
ToreJuloe / bt-anticlickbait.js
Last active August 13, 2019 12:44
Remove click-bait on BT
(function() {
const setContent = element => nodesArray => {
element.innerText = "";
nodesArray.forEach(node => {
element.appendChild(node);
});
};
const parseHTML = text => new DOMParser().parseFromString(text, "text/html");
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body, html {
padding: 0;
@ToreJuloe
ToreJuloe / base64StringToGuid.js
Last active April 11, 2017 09:33
Extract a key ID from a Smooth Streaming asset
// Adapted nippet from here: https://rosettacode.org/wiki/Strip_control_codes_and_extended_characters_from_a_string#JavaScript
// Also remove non "<" chars in the beginning of the XML.
function stripGarbage (string) {
return string.split('').filter(function (character) {
const number = character.charCodeAt(0)
return 31 < number && 127 > number
}).join('').replace(/^[^<]*/, '')
}
// Snippet from here: http://stackoverflow.com/a/13240395/511923