<commit_before>import injectScript from 'core/injectscript';
import htmlXhr from 'core/htmlxhr';

const JWPLAYER = 'http://ssl.p.jwpcdn.com/player/v/7.2.4/jwplayer.js';

let getStreamInfo = async function(id){
	let html = await htmlXhr('GET', `http://mylive.in.th/streams/${id}`);

	let scriptNode = Array.from(html.documentElement.getElementsByTagName('SCRIPT')).filter((node) => {
		return !node.src &&
			node.textContent.indexOf('jwplayer') !== -1;
	})[0];
	return {
		title: html.title,
		script: scriptNode.textContent,
	};
};

document.documentElement.innerHTML = require('./popout.txt');

let streamPromise = getStreamInfo(window.location.hash.substr(1));

let player = document.createElement('script');
player.setAttribute('src', JWPLAYER);
player.addEventListener('load', async function(){
	let result = await streamPromise;
	document.title = result.title;
	let script = result.script.replace(/(width|height): [0-9]+/g, '$1: "100%"');
	injectScript(script);
}, false);
document.body.appendChild(player);
<commit_msg>Added SRI on jwplayer<commit_after>import injectScript from 'core/injectscript';
import htmlXhr from 'core/htmlxhr';

const JWPLAYER = 'http://ssl.p.jwpcdn.com/player/v/7.2.4/jwplayer.js';
const JWPLAYER_SRI = 'sha384-+/DsWVrOBRUMkiyZc5fN6+L<KEY>/';

let getStreamInfo = async function(id){
	let html = await htmlXhr('GET', `http://mylive.in.th/streams/${id}`);

	let scriptNode = Array.from(html.documentElement.getElementsByTagName('SCRIPT')).filter((node) => {
		return !node.src &&
			node.textContent.indexOf('jwplayer') !== -1;
	})[0];
	return {
		title: html.title,
		script: scriptNode.textContent,
	};
};

document.documentElement.innerHTML = require('./popout.txt');

let streamPromise = getStreamInfo(window.location.hash.substr(1));

let player = document.createElement('script');
player.integrity = JWPLAYER_SRI;
player.crossorigin = 'anonymous';
player.setAttribute('src', JWPLAYER);
player.addEventListener('load', async function(){
	let result = await streamPromise;
	document.title = result.title;
	let script = result.script.replace(/(width|height): [0-9]+/g, '$1: "100%"');
	injectScript(script);
}, false);
document.body.appendChild(player);

{'fraction_non_alphanumeric': 0.17595978062157222, 'fraction_numerical': 0.013254113345521023, 'mean_word_length': 5.735384615384615, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3069607', 'n_tokens_mistral': 765, 'n_tokens_neox': 747, 'n_words': 132}