Estoy buscando un navegador de texto que ejecute JavaScript. Debe ser compatible con la plataforma Linux.
Otras características:
XHR
(se supone que debe hacer si ejecuta js)¿Alguna recomendación?
Intenté lynx
y elinks
( sudo apt-get install ...
), ambos no son compatibles con JS.
// Considere brow.sh, debido a su bajo ancho de banda pero soporte extremadamente flexible para diferentes tipos de páginas web:
También tiene una forma inteligente de usar la compatibilidad con color verdadero en terminales para renderizar imágenes y admite reemplazos modernos para SSH como MOSH .
Aquí hay algunas páginas de demostración:
html.brow.sh
Utiliza gráficos muy básicos y etiquetas de anclaje HTML. Aunque este servicio puede parecer similar al cliente de terminal, aún no tiene paridad de funciones.text.brow.sh
No usa nada más que texto puro, mejor para usar con curl, por ejemplo.
Para una demostración del navegador,ssh brow.sh
También puede instalarlo a través de docker pull
:
docker pull browsh/browsh
Debido a que brow.sh es Firefox bajo el capó, puede instalar Adblock y otras extensiones.
Lynx no admite JavaScript, pero Links sí:
sudo apt-get install links
luego, para compilar enlaces con soporte de JavaScript, use la opción de configuración, --enable-javascript
tenga en cuenta que tiene errores de acuerdo con la documentación.
La mejor de las suertes
alert(1)
pero no se muestra nada.alert
no es la mejor prueba, porque hay una diferencia entre "ejecutar Javascript" y "mostrar cuadros de alerta". Es mejor probar con document.write("hello world")
poner el texto de prueba en el documento en sí, porque bastantes navegadores que son perfectamente compatibles con Javascript pueden configurarse para suprimir cuadros de alerta, por lo que "sí, admitimos Javascript pero no cuadros de alerta" es una posición razonable (entonces si desea soporte específico para cuadros de alerta, me temo que tiene que decirlo ☺)Solución 2017:
Aquí hay una solución para renderizar html+js en la terminal:
Requerido:
Ejemplo de uso:
$ google-chrome --headless --disable-gpu --dump-dom https://javatester.org/javascript.html | hermit
$ chromium --headless --disable-gpu --dump-dom https://javatester.org/javascript.html |html2text
Producción:
...
Your web browser supports JavaScript version 1.7
...
¡Funcionó!
<noscript>
, Chrome no elimina los elementos noscript de su salida DOM, y Hermit muestra noscript porque no espera que se haya ejecutado Javascript. Para ocultar <noscript>
, necesitaremos (a) Hermit para mejorar con una opción de "eliminar noscript" o (b) Javascript adicional para inyectarlo de alguna manera en la página para eliminar noscript a través de la manipulación DOM en Chrome o (c) agregar algo más a la cadena de herramientas para eliminar noscript antes de que Hermit lo vea. (My Web Adjuster elimina noscript si js_interpreter
está configurado)lynx -stdin -dump -nolist
en lugar de hermit
, pero de cualquier manera obtendrá texto <noscript>
incluido a menos que lo elimine de alguna manera.A partir de la v0.23, Web Adjuster tiene una opción PhantomJS, que puede habilitar parcialmente Javascript en cualquier navegador con la ayuda de PhantomJS. Digo "parcialmente" porque no funciona (¿todavía?) con formularios POST y enlaces solo de Javascript, pero está bien para leer el texto de una página que requiere Javascript antes de mostrarle ese texto.
sudo apt-get install python-selenium # or sudo yum install python-selenium
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
tar -jxvf phantomjs-2.1.1-linux-i686.tar.bz2
cd phantomjs-2.1.1-linux-i686/
sudo mv bin/phantomjs /usr/local/bin/
cd ..
sudo apt-get install python-tornado # or sudo pip-install tornado
wget http://ssb22.user.srcf.net/adjuster/adjuster.py
python adjuster.py --js_interpreter=PhantomJS --real_proxy
y en otra ventana o pestaña
http_proxy=http://localhost:28080 lynx http://site-that-needs-javascript.example.com/
Divulgación: mantenedor de Web Adjuster aquí.
adjuster.py
quiere ` sudo apt install firefox-geckodriver python adjuster.py --js_interpreter=HeadlessFirefox --real_proxy ` Recibo los mensajes de error: Web Adjuster v0.305 (c) 2012-20 Silas S. Brown Con licencia de Apache, versión 2.0 Escuchando en el puerto 28080 Iniciando 1 webdriver... hecho--PhantomJS
opción anterior --js_interpreter
porque ahora hay 3 para elegir (PhantomJS, HeadlessFirefox o HeadlessChrome). Dado que PhantomJS ya no se mantiene, ahora recomiendo usar HeadlessFirefox o HeadlessChrome, y solo usar PhantomJS como último recurso si no puede instalar ninguno de los otros en la máquina que está usando. Pero para que conste, creo que el código de salida phantomjs 127 puede significar que no pudo ejecutar el binario (por ejemplo, arquitectura incorrecta o problemas de ruta).Navegador no pseudográfico, ed
interfaz similar.
Documentación: http://the-brannons.com/edbrowse/usersguide.html
Sesión de demostración:
$ edbrowse http://softwarerecs.stackexchange.com/
no ssl certificate file specified; secure connections cannot be verified
no trailing newline
74558
6590
# Let's print the beginning of the page
1,20p
{current community}
*
{chat}
{blog}
{Software Recommendations}
*
{Software Recommendations Meta}
your communities
{Sign up} or {log in} to customize your list.
{more stack exchange communities}
# Seach field is not here yet.
# Pressing "Enter" until we find it
{Stack Exchange}
{sign up}
{log in}
{tour}
{help}
* {Tour Start here for a quick overview of the site}
* {Help Center Detailed answers to any questions you might have}
* {Meta Discuss the workings and policies of this site}
<> <Go implicit>
# Here it is. Let's find the line number
n
32
28,32n
28 * {Help Center Detailed answers to any questions you might have}
29 * {Meta Discuss the workings and policies of this site}
30 <> <Go implicit>
31
32
30
<> <Go implicit>
# We are now focused on the search field.
i=text browser
<text browser> <Go implicit>
i*
submitting form
76944
10997
# OK, we have searched. Let's enumerate the results.
# First 30 lines are probably fluff, so begin with 40'th line
40,60p
* {Ask Question}
Search
<text browser>|<search>
127 results
{relevance}
{newest}
{votes}
{active}
10
votes
1answer
# Pressing Enter for more lines
{Q: Text based browser that runs JavaScript}
I am searching for a text browser running JavaScript.
It should be compatible with Linux platform. Other features:
# OK, we are here. Let's follow the link
n
63 It should be compatible with Linux platform. Other features:
58,62n
58 10
59 votes
60 1answer
61 {Q: Text based browser that runs JavaScript}
62 I am searching for a text browser running JavaScript.
61
{Q: Text based browser that runs JavaScript}
g
74946
7226
50,80p
{Text based browser that runs JavaScript}
up vote 10 down vote {favorite}
1
I am searching for a text browser running JavaScript.
It should be compatible with Linux platform.
Other features:
* run JavaScript (this is the most important)
* minor CSS rendering (text colors, background colors, borders maybe)
* support XHR (is supposed to do if it runs js)
* run in command line (terminal)
Any recommendations?
I tried lynx and elinks (sudo apt-get install ...), both not supporting JS.
{linux}
{open-source}
{web-browser}
{command-line}
{share}
{improve this question}
asked Sep 22 '14 at 18:02
{image}
{Ionic\u0103 Biz\u0103u}
3589
|
2
Call me crazy, but I think {links} supports javascript.
- {dotVezz} Sep 23 '14 at 16:38
@dotVezz If you prove me that, I will give you 100 points. :smile:
Add an answer with the instructions and I will review it.
:-) - {Ionic\u0103 Biz\u0103u} Sep 23 '14 at 16:54
I should have done some google-fu before I commented.
Javascript support is not available by default.
Both it and elinks have an --enable-javascript compile flag.
By default, "{JavaScript support was removed in release 2.1pre29 because it
was buggy.}" So in other words... I probably wouldn't bother with links and elinks.
- {dotVezz} Sep 23 '14 at 19:47
add a comment
# Let's try to add a comment
n
107
100,107n
100 By default, "{JavaScript support was removed in release 2.1pre29 because it
101 was buggy.}" So in other words... I probably wouldn't bother with links and elinks.
102 - {dotVezz} Sep 23 '14 at 19:47
103
104
105 add a comment
106
107
105
add a comment
# OK, enough for now.
# I don't know why "add a comment" is not shown as a link
q
puntovezz
Ionică Bizău
puntovezz