Created
October 17, 2025 17:37
-
-
Save aelindeman/ef49d4ef8157cd21f3cbe837acf9a09b to your computer and use it in GitHub Desktop.
Return a map of Sol Systems current SREC prices per kWh by state
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
| fetch({ | |
| method: 'GET', | |
| url: 'https://www.solsystems.com/services/srecs/', | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:143.0) Gecko/20100101 Firefox/143.0', | |
| 'Accept-Language': 'en-US,en;q=0.5', | |
| } | |
| }) | |
| .then(response => response.text()).then(response => { | |
| const dom = new DOMParser().parseFromString(response, 'text/html') | |
| ['DC', 'MD', 'VA', 'PA', 'NJ', 'OH', 'DE', 'MA'].reduce( | |
| (rest, state) => ({ | |
| [state]: (() => { | |
| const amt = [...dom.querySelectorAll(`#srec-pricing #${state} [data-name=Amount]:nth-child(2)`)] | |
| return parseFloat(amt.pop().innerText.replace('$', '')) / 1000 | |
| })(), | |
| ...rest | |
| }), {}) | |
| }) | |
| // example response: | |
| // { MA: 0.038, DE: 0.009, OH: 0.003, NJ: 0.079, PA: 0.026, VA: 0.02725, MD: 0.07, DC: 0.407 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment