-- Leo's gemini proxy

-- Connecting to tilde.team:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Stargate Relay, Search the web in gemini

Stargate Relay: Search Engine Inputs For Stargate!


So today I was reading some of Acidus's logs, notably updates to Stargate and searching marginalia.nu within gemini

Replacing Duckling with Stargate, a new Gemini-to-HTTP gateway by Acidus

Using Marginalia Search via Gemini By Acidus


I am particularly invested in these things and have been ever since discovering the Duckling Proxy last year. Gemtext is an beautiful, simple, and eloquent way to digest information. Being able to read webpages through your gemini browser opens up a whole new way of experiencing the web.


However, actually searching for web pages through gemini proved to be a challenge. A CGI script is needed. I experemented with trying to make a script with my old "duckduckgo input", but it didn't work right. I gave up and moved on.


That all changed today with the discovery of Acidus's marginalia search script. They puzzled out the blueprint of how the script should work. With this upgraded proxy and a basic blueprint to victory, my desire to get a proper search engine input system was renewed.


Unfortunately I couldn't just copy Acidus's script over to my server (well, the tilde.team server) for reasons im too dumb to understand. Just wouldn't run and I didn't know why. So I sat down and got to work on building my own simple script from the ground up referencing tilde.team's capsule cgi wiki page, plently of stack exchange searches, and some IRC communication.


tilde.team wiki gemini cgi guide


And the end result was this:

Code
#!/usr/bin/python3

from os import environ
from sys import exit

if "QUERY_STRING" not in environ:
    print("10 Please enter search term",end="\r\n")
    exit()

searchterm = environ['QUERY_STRING']
url = "https://search.marginalia.nu/search?query=" + searchterm + "&profile=default&js=no-js"

print("30 " + url + "\r\n")

Doesn't look too impressive I know, but it works dammit! Finally a proper script for generating web search engine queries that runs on my capsule.


Now, I could have tried making a more complex single cgi script that allows you to select a search engine with one input and then enter query with another. Instead, I choose to simply make multiple near-identical cgi scripts with the url changed accordingly and index them all in a .gmi page.


The next step was to then see which search engines, if any, actually worked with the damn thing. A few hours of testing and script making later and here we are. Im quite happy with the result and will be using the stargate relay heavily from here on out.


Amazingly, bangs actually work for searx so in theory you have access to almost a hundred different sites to search. I linked a collection of searx bangs. The search engine im most suprised with is YaCy, the most experemental of the bunch.


Got any suggestions to add? Send me an email.


Back To Logs



-- Response ended

-- Page fetched on Tue May 21 20:03:20 2024