~lioploum/offpunk-users

2

broken urls / redirects [wikipedia]

José Manuel Castroagudín Silva <chavescesures@gmail.com>
Details
Message ID
<CAJjuAbgAvVZtjMPG6BMNGJQzMoBWDOz22tjFXY9UjM9d15ViJQ@mail.gmail.com>
Sender timestamp
1740746583
DKIM signature
pass
Download raw message
Hi all,
Note: I started writing a much longer email talking about several
things, but have since decided to focus on one feature at a time.
Wikipedia for now :)

The offpunk shortcuts include the commands "gus" "wikipedia" and "search"
of those 3, gus and wikipedia are broken

I've found a possible replacement for wikipedia:
gemini://gemi.dev/cgi-bin/wp.cgi/
but for some reason the search results are interpreted as
"message/news" by offpunk (or maybe the server is returning a wrong
mime type? but the response seems to start with "20
text/gemini;lang=XX", checked in a different client )

Search for an Article
> gemini
                                          gemi.dev (0 links)   (last
accessed on Fri Feb 28 12:39:44 2025)

                                          File es?gemini is of format
message/news.
                                          It cannot be rendered in
your terminal.
                                          Use "open" to open the file
using an external handler

So, I would like to propose to change the "wikipedia" shortcut, but
first we would need to know why exactly it is not quite working...

Or, since this is the -users list, maybe hear other alternatives that
I'm not aware of

Maybe for other mails we can talk about gus, or "nitter.net",
"teddit.net", "yewtu.be" (not that I use these much in offpunk), and
consider if they should be included with the "offpunk core" or be
completely a config file, for example?

I'm curious to hear opinions from others

Alright, I've made the email quite long, again. Sorry about that :)

--
Saúde,

J. M. Castroagudín
Details
Message ID
<174074962587.7.15443681970185882589.618333690@ploum.eu>
In-Reply-To
<CAJjuAbgAvVZtjMPG6BMNGJQzMoBWDOz22tjFXY9UjM9d15ViJQ@mail.gmail.com> (view parent)
Sender timestamp
1740749620
DKIM signature
pass
Download raw message
Le 25 fév 28 12:43, José Manuel Castroagudín Silva a écrit :
>Hi all,
>Note: I started writing a much longer email talking about several
>things, but have since decided to focus on one feature at a time.
>Wikipedia for now :)
>
>The offpunk shortcuts include the commands "gus" "wikipedia" and "search"
>of those 3, gus and wikipedia are broken

Yeah, that’s very annoying because each time I change them, the service 
breaks or is unavailable.

>
>I've found a possible replacement for wikipedia:
>gemini://gemi.dev/cgi-bin/wp.cgi/
>but for some reason the search results are interpreted as
>"message/news" by offpunk (or maybe the server is returning a wrong
>mime type? but the response seems to start with "20
>text/gemini;lang=XX", checked in a different client )

The bug appears because of several factors:

1. Due to the URL construction, there’s no extension to the file.

2. As there’s no extension, ansicat relies on the Unix utility "file" to 
guess the format. "file" doesn’t know about "gemtext" but Ansicat is 
smart enough to consider that any kind of text should, by default, be 
gemtext is on the gemini protocol.

3. For whatever reason, "file" sometimes consider some text files as 
"message/news". Note that this doesn’t happen for all the query on 
gemi.dev. So it seems to really depends on the content.

4. For ansicat, "message/news" is not a "text/*" format, it’s kind of a 
binary one. So ansicat doesn’t try to open it and consider that "file" 
was correct.


Conclusion: someone should really patch "file" to add support for 
gemtext format ;-)

How to workaround this? Well, Offpunk should consider that 
"message/news" are "gemtext". I guess that the cases where it would help 
far outnumber the cases where a true "message/news" file will be 
encountered.

So I commited a fix, which is simply adding the line:

     "message/news": GemtextRenderer,

to _FORMAT_RENDERERS (ansicat.py, line 1491).

This fixes the problem.
>So, I would like to propose to change the "wikipedia" shortcut, but
>first we would need to know why exactly it is not quite working...

Note that you can configure the "wikipedia" command. See "help 
wikipedia" which states:

The interface used can be modified with the command:
"set wikipedia URL" where URL should contains two "%s", the first
one used for the language, the second for the search string.

But, indeed, working default are a must. I believe that gemi.dev was the 
default at some point before being offline for too long and I switched 
to something else.
>
>Or, since this is the -users list, maybe hear other alternatives that
>I'm not aware of
>
>Maybe for other mails we can talk about gus, or "nitter.net",
>"teddit.net", "yewtu.be" (not that I use these much in offpunk), and
>consider if they should be included with the "offpunk core" or be
>completely a config file, for example?

This is the same problem: relying on external tools.

In a perfect world, Offpunk should be able to handle itself 
transformations. That would become possible with the unmerdify 
integration currently being worked on by Vincent Jousse. (maybe you 
should ping -devel for more information). For example, I dream of 
Offpunk being smart enough to download Youtube videos with ytdlp if 
specifically asked to load a Youtube page.

For wikipedia, instead of relying on an unreliable gemini server, 
offpunk should simply interpret the HTML itself.

In the meantime, it might worth reviewing what are the current default 
and what they should be.
>
>I'm curious to hear opinions from others
>
>Alright, I've made the email quite long, again. Sorry about that :)

Thanks for the feedback, happy to discuss it ;-)
>
>--
>Saúde,
>
>J. M. Castroagudín
>

-- 
Ploum - Lionel Dricot

Blog: https://www.ploum.net
Bikepunk: https://bikepunk.fr/
Details
Message ID
<174076120581.8.12364611043310595648.618626597@ploum.eu>
In-Reply-To
<CAJjuAbgAvVZtjMPG6BMNGJQzMoBWDOz22tjFXY9UjM9d15ViJQ@mail.gmail.com> (view parent)
Sender timestamp
1740761198
DKIM signature
pass
Download raw message
Le 25 fév 28 02:26, Lionel Dricot - Ploum a écrit :
>Le 25 fév 28 12:43, José Manuel Castroagudín Silva a écrit :
>>I've found a possible replacement for wikipedia:
>>gemini://gemi.dev/cgi-bin/wp.cgi/
>>but for some reason the search results are interpreted as
>>"message/news" by offpunk (or maybe the server is returning a wrong
>>mime type? but the response seems to start with "20
>>text/gemini;lang=XX", checked in a different client )
>
>The bug appears because of several factors:
>
>1. Due to the URL construction, there’s no extension to the file.
>
>2. As there’s no extension, ansicat relies on the Unix utility "file" 
>to guess the format. "file" doesn’t know about "gemtext" but Ansicat 
>is smart enough to consider that any kind of text should, by default, 
>be gemtext is on the gemini protocol.
>
>3. For whatever reason, "file" sometimes consider some text files as 
>"message/news". Note that this doesn’t happen for all the query on 
>gemi.dev. So it seems to really depends on the content.
>
>4. For ansicat, "message/news" is not a "text/*" format, it’s kind of 
>a binary one. So ansicat doesn’t try to open it and consider that 
>"file" was correct.

By going through file sourcecode, I’ve identified that any file which 
starts with "Article" is identified as a message/news item.

One of the fix would already be for gemi.dev to return a gmi file 
starting with a "# Title". I guess that would already help a lot.
Reply to thread Export thread (mbox)