Post

Not many posts on this account. Let's fix that! SourceBot has been trundling along for a while now with nothing new added. That's cool, I don't charge for it anymore. But with Derpibooru being a little wobbly of late, I wanted another good reverse searching service to take up the slack.

Enter @fluffle.xyz (oooh, they have a Bluesky!). Great little reverse searching service, and they have an API. Very nice. A small downside is that SourceBot only works with URLs, not blobs of image data. Now, I could do some really horrible bodge-coded solution to do it in SourceBot, but...

Let's leverage @cloudflare.social! So, to make an API endpoint to take an image URL and spit back site URLs, I need to do 3 things: 1. I need to download the image 2. I need to ensure it is smol (Fluffle only likes 4MB or less) 3. I need to do the Fluffle query

0 reposts0 likes

1 is easy. Cloudflare has a nice little js.fetch() function that can easily gobble a URL and spit out image blob. 2 was actually integrated into 1. Cloudflare allows you to resize images as you ingest them. Very nice! 3 ...

3 is where the rub lies. Fluffle wants a specific user agent layout, Cloudflare doesn't want to allow me to use such a user agent via any of the usual Python utils (httpx, aiohttp, etc), and the requirement for uploading a blob of data means js.fetch() (in Python) doesn't work. What do?

SourceBot now just makes a call to this, giving it the URL. Cloudflare handles the image resize/sending, then passes back a list of URLs that have the image. Success never tasted so good. Huge thanks to @fluffle.xyz again. Great service, send love to them!