Ich suche einen Textbrowser mit JavaScript. Es sollte mit der Linux-Plattform kompatibel sein.
Andere Eigenschaften:
XHR
(sollte reichen, wenn js läuft)Irgendwelche Empfehlungen?
Ich habe versucht lynx
und elinks
( sudo apt-get install ...
), beide unterstützen JS nicht.
// , Betrachten Sie brow.sh wegen seiner geringen Bandbreite, aber extrem flexiblen Unterstützung für verschiedene Arten von Webseiten:
Es hat auch eine clevere Möglichkeit, die True-Color-Unterstützung in Terminals zum Rendern von Bildern zu verwenden, und unterstützt moderne Ersetzungen für SSH wie MOSH .
Hier sind einige Demoseiten:
html.brow.sh
Verwendet sehr einfache Grafiken und HTML-Anker-Tags. Obwohl dieser Dienst dem Terminal-Client ähnlich erscheinen mag, hat er noch keine Feature-Parität.text.brow.sh
Verwendet nichts als reinen Text, besser zum Beispiel für die Verwendung mit curl.
Für eine Demo des Browsers,ssh brow.sh
Sie können es auch installieren über docker pull
:
docker pull browsh/browsh
Da brow.sh Firefox unter der Haube ist, können Sie Adblock und andere Erweiterungen installieren.
Lynx unterstützt kein JavaScript, aber Links schon:
sudo apt-get install links
Verwenden Sie dann zum Kompilieren von Links mit JavaScript-Unterstützung die Konfigurationsoption. Beachten --enable-javascript
Sie, dass dies gemäß der Dokumentation fehlerhaft ist.
Viel Glück
alert(1)
aber es wird nichts angezeigt.alert
ist nicht der beste Test, da es einen Unterschied zwischen "Ausführen von Javascript" und "Anzeigen von Warnfeldern" gibt. Es ist besser zu testen , indem Sie den document.write("hello world")
Testtext in das Dokument selbst einfügen, da einige Browser, die perfekt Javascript-fähig sind, möglicherweise so eingestellt sind, dass Warnfelder unterdrückt werden, also ist "Ja, wir unterstützen Javascript, aber keine Warnfelder" eine vernünftige Position (so Wenn Sie speziell Unterstützung für Warnboxen wünschen, müssen Sie dies leider sagen ☺)Lösung 2017:
Hier ist eine Lösung zum Rendern von HTML+JS im Terminal:
Erforderlich:
Beispielnutzung:
$ 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
Ausgabe:
...
Your web browser supports JavaScript version 1.7
...
Es funktionierte!
<noscript>
ist, Chrome keine Noscript-Elemente aus seiner DOM-Ausgabe entfernt und Hermit Noscript rendert, weil es nicht erwartet, dass das Javascript ausgeführt wurde. Um sich zu verstecken <noscript>
, müssen wir entweder (a) Hermit mit einer Option zum Entfernen von Noscript erweitern oder (b) zusätzliches Javascript irgendwie in die Seite einfügen, um Noscript über die DOM-Manipulation in Chrome zu entfernen, oder (c) etwas anderes hinzufügen die Toolchain, um noscript zu entfernen, bevor Hermit es sieht. (My Web Adjuster entfernt noscript wenn js_interpreter
gesetzt)lynx -stdin -dump -nolist
anstelle von verwenden hermit
, aber auf jeden Fall erhalten Sie Text von " <noscript>
included", es sei denn, Sie nehmen ihn irgendwie heraus.Ab v0.23 verfügt Web Adjuster über eine PhantomJS-Option, die jeden Browser mit Hilfe von PhantomJS teilweise Javascript-fähig machen kann. Ich sage "teilweise", weil es (noch?) nicht mit POST-Formularen und Nur-JavaScript-Links funktioniert, aber es ist in Ordnung, den Text einer Seite zu lesen, die Javascript erfordert, bevor Ihnen dieser Text angezeigt wird.
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
und in einem anderen Fenster oder Tab
http_proxy=http://localhost:28080 lynx http://site-that-needs-javascript.example.com/
Offenlegung: Web Adjuster Betreuer hier.
adjuster.py
will ` sudo apt install firefox-geckodriver python adjuster.py --js_interpreter=HeadlessFirefox --real_proxy ` Ich erhalte die Fehlermeldungen: Web Adjuster v0.305 (c) 2012-20 Silas S. Brown Lizenziert unter der Apache-Lizenz, Version 2.0 Abhören auf Port 28080 Starten von 1 Webdriver ... fertig--PhantomJS
Option in geändert, --js_interpreter
da jetzt 3 zur Auswahl stehen (PhantomJS, HeadlessFirefox oder HeadlessChrome). Da PhantomJS nicht mehr gepflegt wird, empfehle ich jetzt die Verwendung von HeadlessFirefox oder HeadlessChrome und die Verwendung von PhantomJS nur als letzten Ausweg, wenn Sie keines der anderen auf dem von Ihnen verwendeten Computer installieren können. Aber fürs Protokoll, ich denke, der Exit-Code 127 von phantomjs kann bedeuten, dass die Binärdatei nicht ausgeführt werden konnte (z. B. falsche Architektur oder Pfadprobleme).Nicht-pseudografischer Browser, ed
-ähnliche Schnittstelle.
Dokumentation: http://the-brannons.com/edbrowse/usersguide.html
Demo-Session:
$ 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
dotVezz
Ionica Bizau
dotVezz