Jump to content

To save myself the time trawling GitHub, can anybody tell me if there is a framework that I can use to make my website visible on the command prompt, as well as a GUI browser ?

 

Imagine the scenario, the under sea internet cables are cut and data is down to trickle: no fancy graphics, just text, is all that is needed from the mirrored webpage when viewed through the command prompt.

 

How do I best go about investigating this please ?

Link to comment
https://linustechtips.com/topic/1451315-website-mirrored-via-command-line/
Share on other sites

Link to post
Share on other sites

You can use a command line browser like Lynx. The issue is that modern web pages don't just contain images, they also contain a lot of scripts that are needed to make the page functional. This is something that doesn't really work in such a browser.

 

As an alternative, you can enable the extreme data saver mode that is e.g. available in Firefox, where it no longer downloads images (not sure if that's just on mobile though, I used it on holiday once when my mobile volume was almost used up).

 

To make your website functional in such a scenario, you'd have to use plain HTML, no JavaScript and as little CSS magic as possible.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

Naturally I would structure my data so that it could be scraped and reinterpreted via the command line form the outset.

 

I was under the impression that all Terminal sessions could interpret webpages, at least those that conformed to HTML protocols.

 

I don't want the user to have to install anything, I expect my data to be read by "normies" and to simply copy and paste the necessary commands to be able to access my site i.e. c&p commands, I need the least number of barriers to allow folk to achieve this aim.

 

I plan to use a lot of HTML/CSS/JS, but surely the data could be structured so that requests from a Terminal session could facilitate just as good an experience ?

Link to post
Share on other sites

6 minutes ago, lotus321 said:

I was under the impression that all Terminal sessions could interpret webpages, at least those that conformed to HTML protocols.

No, because a terminal is not a browser. It doesn't contain the code needed to parse and render HTML (why would it?). You can certainly download HTML using tools like cURL, but that is hardly user friendly and not something a "normy" can read. You need a browser for that.

 

6 minutes ago, lotus321 said:

I don't want the user to have to install anything, I expect my data to be read by "normies" and to simply copy and paste the necessary commands to be able to access my site i.e. c&p commands, I need the least number of barriers to allow folk to achieve this aim.

Many people already have trouble following instructions that contain nothing but copy & paste commands and you expect them to browse your page doing that? Really, use a browser like Lynx. It has an address bar you where enter a URL, you can select links by using the cursor keys and follow them by pressing enter. This is much more convenient than copying commands.

 

6 minutes ago, lotus321 said:

I plan to use a lot of HTML/CSS/JS, but surely the data could be structured so that requests from a Terminal session could facilitate just as good an experience ?

Install Lynx and use it to open a few modern websites (e.g. this forum), see how far you get. HTML is fine, but any functionality that depends on JS (e.g. mouse over menus) is a no-go.

 

Last but not least, please quote or mention people when you reply. Unlike you (the topic starter) others get no notification when you reply otherwise.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

I'd just make sure that there was an auth'd controller that spits out the data you need and curl that directly. You can make a BASH or PowerShell script your endusers can execute to simplify things

 

Can we know more about the usecase?

5950X/4090FE primary rig  |  1920X/1070Ti Unraid for dockers  |  200TB TrueNAS w/ 1:1 backup

Link to post
Share on other sites

What about accelerated mobile pages then, that is a form of low-fi web experience, perhaps there is a way to make that work ?

 

One line of code (with privileges) isn't too bad: sudo apt-get install lynx

 

1 hour ago, Eigenvektor said:

No, because a terminal is not a browser. It doesn't contain the code needed to parse and render HTML (why would it?). You can certainly download HTML using tools like cURL, but that is hardly user friendly and not something a "normy" can read. You need a browser for that.

 

Many people already have trouble following instructions that contain nothing but copy & paste commands and you expect them to browse your page doing that? Really, use a browser like Lynx. It has an address bar you where enter a URL, you can select links by using the cursor keys and follow them by pressing enter. This is much more convenient than copying commands.

 

Install Lynx and use it to open a few modern websites (e.g. this forum), see how far you get. HTML is fine, but any functionality that depends on JS (e.g. mouse over menus) is a no-go.

 

Last but not least, please quote or mention people when you reply. Unlike you (the topic starter) others get no notification when you reply otherwise.

 

Link to post
Share on other sites

1 hour ago, OddOod said:

Can we know more about the usecase?

This. What's your actual use case? Are you targeting mobile phones that are a decade old or something?

 

AMP is (or was, it's being deprecated) mostly about optimizations to the page's HTML and caching things to make them load faster. That doesn't really make it suitable for non-desktop browsers (i.e. browser not capable to run JS).

 

38 minutes ago, lotus321 said:

One line of code (with privileges) isn't too bad: sudo apt-get install lynx

I've used Lynx in a pinch (server, no desktop and no mobile phone access), but it's really an option of last resort. You really don't want to use it if you can get your hands on a desktop or mobile browser. If a page is optimized to work well on Lynx, it'll work just as well on Firefox.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

I am looking to make the content of my site available even under strenuous conditions i.e. bandwidth throttling, cable repair i.e. trickle-data service at best, multiple re-routing (TOR), web browser restrictions etc...

 

There are times and conditions e.g. Ukraine, where service quality cannot be guaranteed.

 

There used to be a trend of creating an accessibility page, where the site was broken down into simple HTML links. Not so popular now. Think of the service like that, but refactored away to the backend, accessible via the command line.

 

Even I'm having trouble installing lynx, macOS prattling on about Java..

 

Perhaps I was confused with FTP, I wonder if there is some kind of workaround ?

Link to post
Share on other sites

Again, you aren't telling us what the content of your site is. If it's *just* data retrieval, you can do that with a curl command directly against the API controller. 

 

5950X/4090FE primary rig  |  1920X/1070Ti Unraid for dockers  |  200TB TrueNAS w/ 1:1 backup

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×