- Load up the respective websites.
- Run script in console.
- Click button to run test.
- Results will be printed out to the console.
Last active
September 27, 2020 23:18
-
-
Save ipwnponies/88bcfd19a029a84dc1b0fdc4ae713e11 to your computer and use it in GitHub Desktop.
Speed test scraper
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
function scrap() { | |
var dl = document.querySelector('#speed-value').textContent | |
var ul = document.querySelector('#upload-value').textContent | |
var lat = document.querySelector('#latency-value').textContent | |
var latLoad= document.querySelector('#bufferbloat-value').textContent | |
console.log([dl, ul, lat, latLoad].join(',')) | |
} | |
observer = new MutationObserver((mutationsList, observer)=> { | |
for (const mutation of mutationsList) { | |
if (mutation.attributeName === 'class' && mutation.target.classList.contains('succeeded')){ | |
scrap(); | |
alert('copied!'); | |
} | |
} | |
}) | |
observer.observe(document.querySelector('#speed-progress-indicator'), {attributes: true}) |
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
function scrap() { | |
var dl = document.querySelector('[data-download-status-value]').textContent | |
var ul = document.querySelector('[data-upload-status-value]').textContent | |
var lat = document.querySelector('[data-latency-status-value]').textContent | |
console.log([dl, ul, lat].join(',')) | |
} | |
observer = new MutationObserver((mutationsList, observer)=> { | |
for (const mutation of mutationsList) { | |
if (mutation.attributeName === 'class' && mutation.target.classList.contains('result-container-speed-active')){ | |
scrap(); | |
alert('copied!'); | |
} | |
} | |
}) | |
observer.observe(document.querySelector('.result-container-speed'), {attributes: true}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment