💾 Archived View for tilde.team › ~smokey › cgi-bin › search-engine-source.gmi captured on 2023-06-16 at 17:21:06. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

-=-=-=-=-=-=-

Individual search engine CGI

#!/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://any-search-engine.com/search?q=" + searchterm

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

Multiple search engine select CGI

#!/usr/bin/python3

from os import environ
from sys import exit

if "QUERY_STRING" not in environ:
    print("10 Select search engine (bi, br, gg, mg, sx, sp, yc, yh)",end="\r\n")
    exit()

searchengine = environ['QUERY_STRING']

if searchengine == 'bi':
    print("30 bing-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'br':
    print("30 brave-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'gg':
    print("30 google-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'mg':
    print("30 mg-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'sx':
    print("30 searx-work-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'sp':
    print("30 startpage-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'yc':
    print("30 yacy-input-py.cgi",end="\r\n")
    exit()
if searchengine == 'yh':
    print("30 yahoo-input-py.cgi",end="\r\n")
    exit()
else:
    print("30 google-input-py.cgi",end="\r\n")
    exit()