Skip to content

Instantly share code, notes, and snippets.

@jamesmacfie
Created October 25, 2019 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmacfie/9fe7c2d33674459aa7e26213f6375b87 to your computer and use it in GitHub Desktop.
Save jamesmacfie/9fe7c2d33674459aa7e26213f6375b87 to your computer and use it in GitHub Desktop.
Rubbish wee scraper for getting recent Drone build details
// Required to `view more`. Let this run for a while.
window.setInterval(() => {
var b = document.querySelector('.more-button');
if (b) b.click();
})(100);
// Now grab the details
var builds = document.querySelector('.builds >.build');
var result = Array.from(document.querySelectorAll('.builds > .build')).map((b) => {
try {
return {
buildNumber: b.querySelector('.number').textContent.replace('#', '').replace('.', ''),
timeElapsed: b.querySelector('.time-elapsed').textContent.replace('Build duration', '')
}
} catch (err) {
return null
}
})
// Output
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment