Created
July 25, 2025 18:35
-
-
Save klaaz0r/12e09425bd4a07be728b05727e854ce5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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