-
-
Save sysnucleus/4dba8385d96d8d5bfac35c71f5ff424c to your computer and use it in GitHub Desktop.
Flashscore JS codes and RegEx to get goal highlights video URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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