browsh icon indicating copy to clipboard operation
browsh copied to clipboard

Feature request: Export to plain text file

Open pachpict opened this issue 1 year ago • 4 comments

Proposal

Would it be possible to export the output od the terminal display to a plain text file?

Example: If I open a 80x20 terminal window and run brow.sh enter monotone mode ([alt]+m) and open bbc.co.uk and hit the export key ([ctrl]+p?) it would create a file (./2023-09-27-1908-bbc.co.uk.txt?) which was 80 characters wide and as many lines long as needed.

Would that be relatively simple to do by using an existing library?

Context

I am integrating brow.sh into a multiline refreshable Braille display (Canute Console).

It would be a great benefit for blind developers, we hope, to get a spacial layout of a web page. As it stands brow.sh is not quite suitable for browsing on the Canute Braille display. There are some changes to navigation and interaction in brow.sh that I will be looking into and hopefully can propose them or submit code. But, meanwhile, exporting to plain text would be comparatively simpler and come with major benefits for Braille readers.

pachpict avatar Sep 27 '23 18:09 pachpict

This is actually already possible with "server mode": https://www.brow.sh/docs/in-browser-usage/

Usage example: curl --header "X-Browsh-Raw-Mode: PLAIN" localhost:4333/https://google.com

tombh avatar Oct 03 '23 14:10 tombh

it would be great if it had a flag like --dump to get the text-only output

11100010 avatar Oct 09 '23 21:10 11100010

Hi there @tombh, thanks for the suggestion. I tried your example and got the source code for sites. What I was referring to was getting a snapshot of the ascii output the browsh writes to the terminal window and saving that as a plain text file. For example if I open browsh oin xfce4-terminal there is an xfce4-terminal option to 'Save Contents' to a txt file. Of course it only captures the lines on the screen and doesn't handle the images very well, but that's the kind of thing I'm thinking about.

pachpict avatar Nov 09 '23 20:11 pachpict

What about https://asciinema.org? Or the underlying it technology it uses?

tombh avatar Nov 09 '23 20:11 tombh