Last active
March 17, 2022 09:42
-
-
Save bezysoftware/116db44f61ca21357f795b2f8bcc2a77 to your computer and use it in GitHub Desktop.
Get a list of LNURLp messages
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
| $i = 0 | |
| $metadata | |
| $metadataCounter = 0 | |
| $errorCounter = 0 | |
| $url = Read-Host "Enter LNURLp URL, e.g. https://wallet.paralelnipolis.cz/lnurlp/api/v1/lnurl/" | |
| while ($true) | |
| { | |
| try | |
| { | |
| $i++ | |
| $result = Invoke-RestMethod -Method Get -Uri "$url$i" | |
| $errorCounter = 0 | |
| if ($metadata -ne $result.metadata) | |
| { | |
| Write-Host | |
| $metadataCounter = 0 | |
| } | |
| $metadataCounter++ | |
| $metadata = $result.metadata | |
| if ($metadataCounter -gt 1) | |
| { | |
| Write-Host "`r$metadata ($metadataCounter)" -NoNewline | |
| } | |
| else | |
| { | |
| Write-Host "`r$metadata" -NoNewline | |
| } | |
| } | |
| catch | |
| { | |
| $errorCounter++ | |
| if ($errorCounter -gt 5) | |
| { | |
| Write-Host | |
| Write-Host $_ | |
| Write-Host "$url$i" | |
| Write-Host "No more messages" | |
| break | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment