I moved over from the 'pynostr' library to 'nostr_sdk' because it's being actively maintained, but every once in awhile I get stuck

Why doesn't this filter work to search events in the NIP94 File Metadata?

Filter().kind(Kind(1063)).custom_tag(SingleLetterTag.lowercase(Alphabet.M), "image/gif").search("dinosaur")

Is there a way to search custom tags that aren't of "SingleLetterTag" type (e.g. "summary", "alt", "ox")?

#asknostr #python

nostr:npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet nostr:npub1vp8fdcyejd4pqjyrjk9sgz68vuhq7pyvnzk8j0ehlljvwgp8n6eqsrnpsw nostr:npub137c5pd8gmhhe0njtsgwjgunc5xjr2vmzvglkgqs5sjeh972gqqxqjak37w

Reply to this note

Please Login to reply.

Discussion

No, according to NIP01 only single-letter tag are allowed in filter.

Is the "dinosaur" string included in `content` field? The `search` filter generally look only in `content` field.

I see

I figured the search term was for the “content” field, but wasn’t certain

The problem I have is that this filter doesn’t reduce the size of the request enough (error from relay that request is too large) and I can’t think of a way to filter it down farther without using custom tags that aren’t single letters

If you have any advice, let me know

Thanks for helping!

Sorry, I have very little knowledge about these things 🫂

How would you go about searching the gifs we’re uploading to nostr.build from gifbuddy?

Also, what relays are you using on nostr:npub1nxy4qpqnld6kmpphjykvx2lqwvxmuxluddwjamm4nc29ds3elyzsm5avr7 to broadcast NIP94 events after files are uploaded?

Replied in DM(04)

I’m not familiar with that library, but if it’s doing nip-50 search, it depends on the relay. Not many relays support nip-50 and the ones that do possibly have different implementations for the search. The nostr.band relay for example performs the search on other fields besides the content field, but I don’t remember which ones.

I think you can help me with this one:

I've gotten the library and filter working now (I think), but I'm only seeing 95 events when connected to the damus relay. I added a bunch more relays (nostr band, nos.lol, primal, nostr.wine, nostr-pub) and now I'm up to 892 events (590 are unique hashes/gifs).

But I know we've uploaded more than that since the launch of gifbuddy.

According to Fishcake, nostr.build uses Blastr when sending NIP94 events, but if that's the case then why am I not seeing way more gifs on these relays?

My goal is to make this a simple function for clients to use so that we can get gif buttons without using Tenor and GIPHY

Hoping you come in clutch on this one

Hard to say without knowing exactly what you’re doing. If you could use something like nak or nostr-tools and post your query, I could help more.

nostr:npub1nxa4tywfz9nqp7z9zp7nr7d4nchhclsf58lcqt5y782rmf2hefjquaa6q8 do you have any good advice on how to navigate this note above?

Trying to figure out how to filter NIP94 events (kind 1063) enough to be a service for gif search

I’m not seeing a way to parse these notes by other tags

Hoping you’re familiar with this library 🤞

What you can do, and this might be not be the most elegant way, but it should be fast enough to work:

Reconcile the events you are looking for with the the tags that do work (like single letter tags) to a local database and do a full text search on the stringified events in that local database. Happy to help if you have any code to look at.

I think I'm definitely doing something wrong on my end as I'm not getting repeatable results

Here's the code I'm working off of if you want to take a look:

https://github.com/happylemonprogramming/gifbuddy/blob/main/nostrgifsearch.py

I made a PR, let me know if that fixes what you were looking for. I also added a second variant using a local database. In the end you only need to run one variant.

Nice! I’ll definitely try it out and let you know how it goes

I was playing with it more last night and discovered some things

I think the next problem I have is trying to find the right relays to add

Nostr.Build uses Blastr so the NIP94 events are published to whatever relay is online and working, which makes it challenging to know where to look

For example, if you just add the Damus relay you get 94 events, I added like 4 more and got up to almost 900, but I know we’ve uploaded more GIFs than that

Just need to find where they are hiding

I don't get how to search nip94 events if I don't know what relay ask events from

Current process:

- Gifbuddy uploads to Nostr.Build

- Nostr.Build publishes a NIP94 event to Blastr

- Blastr goes to whatever relays are online and working (I don't 100% understand this area)

I expect Blastr would include publishing to popular relays like damus, primal, nos.lol, nostr.band, etc. Yet when I add these relays and search for such events (Kind 1063) I get less than 900 results for gifs, which can't be right.

Nostr.Build definitely has more than 900 gifs uploaded assuming that every file uploaded to Nostr.Build has a corresponding nip94 event published.

I can keep adding relays, but I don't think that's the right answer

Hopefully I'm making sense, but this is where I'm at right now:

Nah, I figured it out with Fishcake in DMs: I messed up

When I upload a gif to nostr.build, I get nip94 event data in the response, which I’m suppose to publish, but I interpreted that at the time as it’s already been published

So gifs have been uploading to nostr.build, but haven’t been publishing nip94 events, which super sucks

Working on fixing it this weekend

You wouldn't happen to know how to use Blastr in python with nostr-sdk, would you?

I pretty much finished the nip94 update to gifbuddy, but I want to broadcast it as wide as possible (right now it just does damus and primal relays)