Skip to content

Instantly share code, notes, and snippets.

@yousefamar
Last active August 31, 2019 13:55
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 yousefamar/e560b9fa2b102faa768ed0334332fb64 to your computer and use it in GitHub Desktop.
Save yousefamar/e560b9fa2b102faa768ed0334332fb64 to your computer and use it in GitHub Desktop.
Snippets for finding the cheapest DBS umbrella company bodies
let things = [];
UBDs.map(u => u.id).forEach(id => {
fetch('https://dbs-ub-directory.homeoffice.gov.uk/org-page.php?id='+id).then(res => res.text()).then(text => {
let el = document.createElement('html');
el.innerHTML = text;
el = el.getElementsByClassName('pricing')[0];
if (!el) {
console.log(id, 'has no price');
return;
}
el = el.getElementsByClassName('count');
things.push({
id: id,
standard: +el[2].innerText.substr(1),
enhanced: +el[5].innerText.substr(1)
});
});
});
///////////////
things.filter(t => t.enhanced === 44).forEach(t => console.log('https://dbs-ub-directory.homeoffice.gov.uk/org-page.php?id='+t.id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment