Skip to content

Instantly share code, notes, and snippets.

@klaaz0r
Created July 25, 2025 18:35
Show Gist options
  • Select an option

  • Save klaaz0r/12e09425bd4a07be728b05727e854ce5 to your computer and use it in GitHub Desktop.

Select an option

Save klaaz0r/12e09425bd4a07be728b05727e854ce5 to your computer and use it in GitHub Desktop.
const results = [];
document.querySelectorAll('.single').forEach(el => {
const title = el.querySelector('h2')?.innerText.trim() || '';
const infoLink = el.querySelector('a.button')?.href || '';
const status = el.querySelector('.state')?.innerText.trim() || '';
const address = el.querySelector('ul li')?.innerText.trim().replace(/\s+/g, ' ') || '';
const pressure = el.querySelector('p')?.innerText.trim() || '';
results.push({
title,
infoLink,
status,
address,
pressure
});
});
// Convert to JSON and trigger download
const blob = new Blob([JSON.stringify(results, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'hydrogen-stations.json';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment