Post
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
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?
0 reposts0 likes
Using a chunk of JS as its own worker, making an RPC call to it and getting the info back! This includes a lot of head-smacking-against-brick-wall in the early attempts to make this work, but ultimately I tossed all the ideas out and implemented the final. github.com/SomewhatDama...
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!