Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flashscore JS codes and RegEx to get goal highlights video URLs
// Code to enable follow links from match listings page
var elements = document.getElementsByTagName('div');
for(var i=0; i < elements.length; i++)
{
var element = elements[i];
var url = "https://www.flashscore.com/match/" + element.id.replace('g_1_', '');
element.setAttribute("url", url);
}
// RegEx to follow links to load match details page
url="([^"]*)
// Code to display match highlight video links on page
var videoEls = document.getElementsByClassName('highlight-video');
var urls = "";
for (var i = videoEls.length - 1; i >= 0; i--) {
try {
urls = urls + videoEls[i].children[0].contentWindow.document.body.getElementsByClassName('video-js')[0].getAttribute('src') + ",\n";
}
catch(err) {}
}
document.body.innerText = urls;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment