A simple command-line tool written in Odin that fetches web pages or searches the web via DuckDuckGo’s HTML interface, then formats the response as readable plain text.
>go2web.exe -s:"Apples"
(Apple - Wikipedia)[https://en.wikipedia.org/wiki/Apple]
(25 Types of Apples - Jessica Gavin)[https://www.jessicagavin.com/types-of-apples/]
(Apples 101: Nutrition Facts and Health Benefits)[https://www.healthline.com/nutrition/foods/apples]
(Apple)[https://www.apple.com]
(6 Healthiest Types of Apples for Digestion, Blood Sugar, and Gut Health)[https://www.verywellhealth.com/healthiest-types-of-apples-11905297]
(All the types of apples (almost) and what to use them for in one place)[https://www.usatoday.com/story/graphics/2024/10/24/apple-types-varieties-guide/75721107007/]
(Apple | Fruit, Types, Nutrition, Cultivation, & Facts | Britannica)[https://www.britannica.com/plant/apple-fruit-and-tree]
(iSpace - oficial Apple Premium Partner in Moldova)[https://ispace.md]
(The 10 Best Apples to Eat Fresh, According to a Fruit Expert)[https://www.marthastewart.com/best-apples-to-eat-fresh-11832852]
(Apples: Nutrition and Health Benefits - WebMD)[https://www.webmd.com/food-recipes/benefits-apples]
go2web.exe -u:"https://example.com"
()["https://iana.org/domains/example"]Title: Example Domain
# Example Domain
This domain is for use in documentation examples without needing permission. Avoid use in operations.
Learn more- Make
GETrequests to HTTP and HTTPS URLs with automatic redirect handling (up to 10 redirects). - Decode
gzipandchunkedtransfer encoding. - Parse HTML and extract text, links, headings, lists, and images as plain text.
- Search DuckDuckGo using the
-sflag and display the top results in a clean format. - Local response caching (10‑second TTL) to avoid repeated network requests.
-
Odin compiler – Installation guide
-
OpenSSL development libraries (e.g.
libssl-devon Debian/Ubuntu,opensslon macOS via Homebrew) -
Two custom Odin packages are vendored as git submodules:
odin-html– HTML parserodin-http– Library for HTTP/S
These are automatically checked out when cloning with:
git clone --recurse-submodules <repo-url>
If you have already cloned the repository without submodules, run:
git submodule update --init
The submodules live at the paths expected by the import statements (
odin-htmlandodin-http).
odin build .The -file flag treats the file as a standalone script. If you structure the project with packages, adjust accordingly.
# Fetch a URL and display its content
./httpcli -u "https://example.com"
# Search for a term using DuckDuckGo
./httpcli -s "odin programming language"Flags -u and -s are mutually exclusive. If both are provided, an error is shown.
Responses are cached in the cache/u/ (for URLs) and cache/s/ (for searches) directories. A cache entry is valid for 10 seconds; after that, a fresh request is made.
- HTTPS is handled via OpenSSL using the
odin-http/opensslpackage. - HTTP requests use Odin’s built‑in
netpackage. - HTML parsing is done with
odin-html. - Gzip decompression uses Odin’s
core:compress/gzip. - Output is printed to stdout after basic formatting.
- This tool was tested with simple websites and DuckDuckGo’s
html.duckduckgo.comendpoint. Complex JavaScript‑driven sites will not render correctly. - The search functionality relies on DuckDuckGo’s HTML version and may break if the site’s structure changes.
No license specified – use at your own discretion.