Silberengel on Nostr: I should probably show more devs how I did this. Tony was just pulling the API list, ...
I should probably show more devs how I did this.
Tony was just pulling the API list, on the fly, and had some relays hard-coded as a fallback, if the list wasn't reachable.
It's over 700 relays, now, though. Takes forever, unless you use threading or something. Or workers. Only really worth it for a wide search or for broadcasting delete events.
https://api.nostr.watch/ Here's how I get around using blastr. I looked where he gets the relay list from. He just uses the API from Nostr.Watch.
```
// download a list of active relays
$url = "https://api.nostr.watch/v1/online";
$page = file_get_contents($url);
$requestedRelays = json_decode($page, true);
sort($requestedRelays);
```
Published at
2024-09-23 19:55:23Event JSON
{
"id": "998a29fafc472f6a3dc7f77b5d264337011d24f26acd134fe05d40acb9f7b3d7",
"pubkey": "fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1",
"created_at": 1727121323,
"kind": 1,
"tags": [
[
"q",
"8d9131bd8c631c8ac4a90ab4e7f8d968029d81713a0e60893a41ef5c5a4d3ac9"
]
],
"content": "I should probably show more devs how I did this.\nTony was just pulling the API list, on the fly, and had some relays hard-coded as a fallback, if the list wasn't reachable.\n\nIt's over 700 relays, now, though. Takes forever, unless you use threading or something. Or workers. Only really worth it for a wide search or for broadcasting delete events.\n\nhttps://api.nostr.watch/\n\nnostr:nevent1qqsgmyf3hkxxx8y2cj5s4d88lrvksq5as9cn5rnq3yayrm6utfxn4jgn4gge7",
"sig": "b7734ec9abf3031469088bb385816f64c1e364354c2c23bd6a608c9d1b1dbd1b9ad239e15fe85229313c1f6a19796f113c029a74460f73d77dfaae1afddc1e01"
}