「W3m」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(英語版から転載)
タグ: リダイレクト解消
(序文の翻訳を修正)
(同じ利用者による、間の11版が非表示)
7行目: 7行目:
 
{{Related|Lynx}}
 
{{Related|Lynx}}
 
{{Related articles end}}
 
{{Related articles end}}
[https://salsa.debian.org/debian/w3m w3m] is a text-based web browser as well as a pager like [https://en.wikipedia.org/wiki/More_(command) more] or [[less]]. With w3m you can browse web pages through a [[Terminal emulator]] window. Moreover, w3m can be used as a text formatting tool which typesets HTML into plain text.
+
[https://salsa.debian.org/debian/w3m w3m] はテキストベースの Web ブラウザであり、[https://ja.wikipedia.org/wiki/More_(UNIX) more] [[less]] のようなページャでもあります w3m を使用すると、[[ターミナルエミュレータ]] を通じて Web ページを閲覧できます。さらに、w3m は、HTML をプレーンテキストにタイプセットするテキスト整形ツールとしても使用できます。
   
== Installation ==
+
== インストール ==
   
  +
{{Pkg|w3m}} パッケージを [[インストール]] して下さい。
[[Install]] the {{Pkg|w3m}} package.
 
   
== Usage ==
+
== 使い方 ==
   
See {{man|1|w3m}}.
+
こちらを参照 {{man|1|w3m}}
   
== Configuration ==
+
== 設定 ==
   
  +
w3m は、ブラウザ内の設定メニューを使用するか、設定ファイルを直接変更することによって構成できます。
w3m can either be configured using the in-browser settings menu or by directly modifying its configuration files.
 
   
  +
より高度なオプションの一部は設定メニューを使用して使用できないため、設定ファイル自体を編集することをお勧めします。
Some of the more advanced options are not available using the settings menu, so it is recommended editing the configuration files themselves.
 
   
  +
デフォルトでは、すべての設定ファイルは {{ic|~/.w3m}} にあります。
By default all configuration files reside in {{ic|~/.w3m}}.
 
   
  +
== ヒントとテクニック ==
== Tips and tricks ==
 
   
=== Vim keybinds ===
+
=== Vim キーバインド ===
   
Replace {{ic|~/.w3m/keymap}} with a [https://gist.githubusercontent.com/Lovebird-Connoisseur/a11b9dbc5c056d705d1f0e1053de35af/raw/92b30d2ca4cf67b5816146f86f5d920b4bdfc492/keymap custom configuration].
+
{{ic|~/.w3m/keymap}} [https://gist.githubusercontent.com/Lovebird-Connoisseur/a11b9dbc5c056d705d1f0e1053de35af/raw/92b30d2ca4cf67b5816146f86f5d920b4bdfc492/keymap カスタム設定] に置き換えます。
   
=== URL hints ===
+
=== URL ヒント ===
   
w3m supports [[qutebrowser]]-like link navigation, simply navigate to your config file and change the following line from {{ic|display_link_number 0}} to {{ic|display_link_number 1}}.
+
w3m [[qutebrowser]] のようなリンクナビゲーションをサポートしています。設定ファイルに移動して、次の行を {{ic|display_link_number 0}} から {{ic|display_link_number 1}} に変更するだけです。
   
And add {{ic|keymap f COMMAND "RESHAPE ; LINK_BEGIN ; GOTO_LINK"}} and {{ic|keymap F COMMAND "RESHAPE ; LINK_BEGIN ; TAB_LINK"}} to {{ic|~/.w3m/keymap}}.
+
そして、{{ic|keymap f COMMAND "RESHAPE ; LINK_BEGIN ; GOTO_LINK"}} {{ic|keymap F COMMAND "RESHAPE ; LINK_BEGIN ; TAB_LINK"}} {{ic|~/.w3m/keymap}} に追加します。
   
  +
{{Note|qutebrowser はヒントを選択するためのさまざまなキーをサポートしていますが、w3m では数字キーを使用してリンクを選択することしかできません。}}
{{Note|While qutebrowser supports a variety of keys to select hints, in w3m you can only select links using the number keys.}}
 
   
=== Using kittens image protocol ===
+
=== kittens イメージプロトコルの使用 ===
   
Users of the [[kitty]] terminal emulator may chose to use its own [https://sw.kovidgoyal.net/kitty/graphics-protocol/ graphics protocol].
+
[[kitty]] ターミナルエミュレータのユーザーは、独自の [https://sw.kovidgoyal.net/kitty/graphics-protocol/ グラフィックスプロトコル] を使用することを選択できます。
   
  +
これを行うには、{{ic|~/.w3m/config}} 内の次の行を変更するだけです。
To do so simply change the following lines in {{ic|~/.w3m/config}}:
 
   
 
inline_img_protocol 0
 
inline_img_protocol 0
 
imgdisplay w3mimgdisplay
 
imgdisplay w3mimgdisplay
   
  +
これに:
to:
 
   
 
inline_img_protocol 4
 
inline_img_protocol 4
 
imgdisplay kitty
 
imgdisplay kitty
   
=== Searching ===
+
=== 検索 ===
   
  +
{{ic|wrap_search}} を 1 に設定すると、検索がページ内のすべての一致の最後に到達した後に先頭にジャンプできるようになります。
You can set {{ic|wrap_search}} to 1, to allow searches to jump to the top after they have hit the bottom of all matches within a page.
 
   
You can set {{ic|ignorecase_search}} to 1 to enable case insensitive searching.
+
{{ic|ignorecase_search}} 1 に設定すると、大文字と小文字を区別しない検索が有効になります。
   
  +
{{Note|他のブラウザやテキストエディタとは異なり、w3m にはスマートケース検索のオプションがありません。}}
{{Note|Unlike other browsers and text editors, w3m has no option for smartcase searching.}}
 
   
=== Custom search engines ===
+
=== カスタム検索エンジン ===
   
  +
キーをマップして、入力をキャプチャしてカスタム検索エンジンに渡す CGI スクリプトを起動できます。そのためには、まず {{ic|~/.w3m/keymap}} 内にキーバインドを作成してスクリプトを起動します。
You can map keys to launch a CGI script that will capture your input and pass it onto a custom search engine, to do so first create a keybind inside {{ic|~/.w3m/keymap}} to launch your script:
 
   
 
keymap s COMMAND "SET_OPTION dictcommand=file:///cgi-bin/omnibar_google.cgi ; DICT_WORD"
 
keymap s COMMAND "SET_OPTION dictcommand=file:///cgi-bin/omnibar_google.cgi ; DICT_WORD"
   
And place [https://raw.githubusercontent.com/gotbletu/shownotes/master/w3m_omnibar/omnibar_google.cgi omnibar_google.cgi] inside your {{ic|~/.w3m/cgi-bin}} directory and giving it execute permission.
+
そして、[https://raw.githubusercontent.com/gotbletu/shownotes/master/w3m_omnibar/omnibar_google.cgiomnibar_google.cgi] {{ic|~/.w3m/cgi-bin}} ディレクトリ内に配置し、実行権限を与えます。
   
  +
上記のスクリプトは Google の結果を返しますが、この種のスクリプトを使用して StackOverflow、GitHub、DuckDuckGo、Reddit、その他多数の Web サイトを検索することもできます。
While the above script will return a Google result, you can use these kinds of scripts to search StackOverflow, GitHub, DuckDuckGo, Reddit and a bunch of other websites.
 
   
You can view similar scripts on [https://github.com/gotbletu/shownotes/tree/master/w3m_omnibar GitHub].
+
同様のスクリプトは [https://github.com/gotbletu/shownotes/tree/master/w3m_omnibar GitHub] で参照できます。
   
=== Reader mode ===
+
=== リーダーモード ===
   
  +
一部の Web ページは、コンテンツのほとんどを表示するために大量の JavaScript または CSS を使用しているため、w3m では適切に動作しません。 記事の先頭に到達するために複数のページをスクロールしなければならないことがよくあります。
Some webpages do not work well with w3m, be it because they use a lot of javascript or CSS to display most of their content. Very often you will have to scroll multiple pages just to get to the start of an article.
 
   
  +
これは、最初に Web ページを {{AUR|rdrview-git}} などのリーダーモードプログラムに通すことで軽減できます。
This can be mitigated by first passing the webpages through a reader mode program such as {{AUR|rdrview-git}}.
 
   
To do so add the following to {{ic|~/.w3m/keymap}}:
+
これを行うには、次の行を {{ic|~/.w3m/keymap}} に追加します。
   
 
keymap R COMMAND "READD_SHELL 'rdrview $W3M_URL -H 2> /dev/null 1> /tmp/readable.html' ; LOAD /tmp/readdable.html"
 
keymap R COMMAND "READD_SHELL 'rdrview $W3M_URL -H 2> /dev/null 1> /tmp/readable.html' ; LOAD /tmp/readdable.html"
   
=== Redirect URLs ===
+
=== リダイレクト URL ===
   
  +
{{ic|~/.w3m/siteconf}} ファイルは、リファラーやユーザーエージェントなど、Web サイトに応じていくつかの環境設定を設定するために使用されます。
{{ic|~/.w3m/siteconf}} file is used to set some preferences depending on the website, such as: referrer and user agent.
 
   
  +
また、Web サイトの代わりに、より軽量 (レイアウトと帯域幅の両方の点で) でプライバシーの点で優れたサイトにリダイレクトするために使用することもできます。
It can also be used to redirect to lighter (both in terms of layout and bandwidth), more privacy respecting alternatives to websites.
 
   
  +
これに加えて、特定の CGI スクリプトの実行にも使用できます。
In addition to this it can also be used to run certain CGI scripts.
 
   
 
{{hc|~/.w3m/siteconf|<nowiki>
 
{{hc|~/.w3m/siteconf|<nowiki>
127行目: 127行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
=== 閉じたウィンドウを復元する ===
=== Restore closed windows ===
 
   
  +
デフォルトの w3m は閉じたタブを再度開くことができません。これを追加するには、CGI を使用して、タブを閉じるボタンをバインドして、閉じるタブの現在の URL をエコーし​​、別のキーをバインドしてファイルに追加された最新の URL を復元します。
Default w3m cannot reopen closed tabs, this can be added by binding the close tab button to echo the current URL of the tab to be closed to a text file, and binding another key to restore the latest URL added to the file, using a CGI script.
 
   
Inside {{ic|~/.w3m/keymap}} add:
+
{{ic|~/.w3m/keymap}} 内に次を追加します。
   
 
keymap d COMMAND "EXTERN 'echo %s >> ~/.w3m/RestoreTab.txt' ; CLOSE_TAB"
 
keymap d COMMAND "EXTERN 'echo %s >> ~/.w3m/RestoreTab.txt' ; CLOSE_TAB"
 
keymap u COMMAND TAB_GOTO file:/cgi-bin/restore_tab.cgi
 
keymap u COMMAND TAB_GOTO file:/cgi-bin/restore_tab.cgi
   
  +
次に、次のファイルを {{ic|~/.w3m/cgi-bin}} 内に配置し、[[ヘルプ:読み方#実行可能属性の付与|実行可能]] にします。
Then place the following file inside {{ic|~/.w3m/cgi-bin}} and make it [[executable]].
 
   
 
[https://raw.githubusercontent.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m/master/root-cgi-bin/restore_tab.cgi restore_tab.cgi]
 
[https://raw.githubusercontent.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m/master/root-cgi-bin/restore_tab.cgi restore_tab.cgi]
   
=== Opening magnet links ===
+
=== magnet リンクを開く ===
   
[https://raw.githubusercontent.com/gotbletu/shownotes/master/w3m_plugins/cgi-bin/magnet.cgi magnet.cgi] can be used to make w3m auto open magnet links using [[Transmission]].
+
[https://raw.githubusercontent.com/gotbletu/shownotes/master/w3m_plugins/cgi-bin/magnet.cgi Magnet.cgi] を使用すると、[[Transmission]] を使用して w3m 自動オープンマグネットリンクを作成できます。
   
=== Fingerprinting ===
+
=== フィンガープリント ===
   
==== Using tor ====
+
==== tor の使用 ====
   
You can use {{man|1|torify}} to route w3m traffic through {{Pkg|tor}}.
+
{{man|1|torify}} を使用して、w3m トラフィックを {{Pkg|tor}} 経由でルーティングできます。
   
 
$ torify w3m -v
 
$ torify w3m -v
   
  +
==== ユーザーエージェントとヘッダー ====
==== User agent and headers ====
 
   
  +
デフォルトでは、w3m は独自のユーザーエージェントを使用します。これは、w3m ユーザーが他のユーザーの中で目立つことを意味します。
By default w3m uses its own user agent, meaning w3m users stand out amongst other users.
 
   
  +
フィンガープリントは、より汎用的なユーザーエージェント、言語、および http_accept ヘッダーを使用することで減らすことができます。
Fingerprint can be reduced by using a more generic user agent, language and http_accept header.
 
   
 
{{hc|~/.w3m/config|2=
 
{{hc|~/.w3m/config|2=
167行目: 167行目:
 
}}
 
}}
   
==== Disable cookies ====
+
==== Cookie を無効にする ====
   
  +
Cookie を無効にするには、{{ic|~/.w3m/config}} で {{ic|use_cookie}} を 0 に設定します。
To disable cookies set {{ic|use_cookie}} to 0 in {{ic|~/.w3m/config}}.
 
   
==== Disable cache ====
+
==== キャッシュを無効にする ====
   
  +
キャッシュを無効にするには、{{ic|~/.w3m/config}} で {{ic|no_cache}} を 1 に設定します。
To disable cookies set {{ic|no_cache}} to 1 in {{ic|~/.w3m/config}}.
 
   
  +
== トラブルシューティング ==
== Troubleshooting ==
 
   
  +
=== 画像がちらつく、遅延する ===
=== Images flickering/causing lag ===
 
   
  +
残念ながら、画像をスクロールしようとすると w3m が遅延し、ブラウザが数秒間応答しなくなる場合があります。
Unfortunately, sometimes w3m lags when trying to scroll past an image, to the point where the browser can become unresponsive for multiple seconds.
 
   
  +
これに対する解決策は画像を完全に無効にすることですが、これにより一部の Web サイトが機能しなくなります (たとえば、hacker news はコメントのインデントに GIF を使用しています)
A solution to this is outright disabling images, but this breaks some websites (for example, hacker news relies on GIFs for comment indentation).
 
   
  +
より洗練された解決策は、画像のオンとオフを切り替えるキーバインドを作成することです。そのためには、次の行を {{ic|~/.w3m/keymap}} に追加します。
A more elegant solution would be to make a keybind to toggle images on or off, to do so add the following line to {{ic|~/.w3m/keymap}}:
 
   
 
keymap i COMMAND "SET_OPTION display_image=toggle ; RESHAPE"
 
keymap i COMMAND "SET_OPTION display_image=toggle ; RESHAPE"
   
== See also ==
+
== 参照 ==
   
* [https://w3m.sourceforge.net/ Homepage]
+
* [https://w3m.sourceforge.net/ ホームページ]
* [https://github.com/tats/w3m Github repository]
+
* [https://github.com/tats/w3m Github リポジトリ]
 
* [http://www.w3m.rocks/ w3m.rocks]
 
* [http://www.w3m.rocks/ w3m.rocks]
* [https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m A vim-like configuration for w3m]
+
* [https://github.com/felipesaa/A-vim-like-firefox-like-configuration-for-w3m w3m 用の vim 風の設定]
* [https://github.com/gotbletu/shownotes/tree/master/w3m_plugins/cgi-bin w3m plugins]
+
* [https://github.com/gotbletu/shownotes/tree/master/w3m_plugins/cgi-bin w3m プラグイン]

2023年8月25日 (金) 18:12時点における版

関連記事

w3m はテキストベースの Web ブラウザであり、moreless のようなページャでもあります w3m を使用すると、ターミナルエミュレータ を通じて Web ページを閲覧できます。さらに、w3m は、HTML をプレーンテキストにタイプセットするテキスト整形ツールとしても使用できます。

インストール

w3m パッケージを インストール して下さい。

使い方

こちらを参照 w3m(1)

設定

w3m は、ブラウザ内の設定メニューを使用するか、設定ファイルを直接変更することによって構成できます。

より高度なオプションの一部は設定メニューを使用して使用できないため、設定ファイル自体を編集することをお勧めします。

デフォルトでは、すべての設定ファイルは ~/.w3m にあります。

ヒントとテクニック

Vim キーバインド

~/.w3m/keymapカスタム設定 に置き換えます。

URL ヒント

w3m は qutebrowser のようなリンクナビゲーションをサポートしています。設定ファイルに移動して、次の行を display_link_number 0 から display_link_number 1 に変更するだけです。

そして、keymap f COMMAND "RESHAPE ; LINK_BEGIN ; GOTO_LINK"keymap F COMMAND "RESHAPE ; LINK_BEGIN ; TAB_LINK"~/.w3m/keymap に追加します。

ノート: qutebrowser はヒントを選択するためのさまざまなキーをサポートしていますが、w3m では数字キーを使用してリンクを選択することしかできません。

kittens イメージプロトコルの使用

kitty ターミナルエミュレータのユーザーは、独自の グラフィックスプロトコル を使用することを選択できます。

これを行うには、~/.w3m/config 内の次の行を変更するだけです。

inline_img_protocol 0
imgdisplay w3mimgdisplay

これに:

inline_img_protocol 4
imgdisplay kitty

検索

wrap_search を 1 に設定すると、検索がページ内のすべての一致の最後に到達した後に先頭にジャンプできるようになります。

ignorecase_search を 1 に設定すると、大文字と小文字を区別しない検索が有効になります。

ノート: 他のブラウザやテキストエディタとは異なり、w3m にはスマートケース検索のオプションがありません。

カスタム検索エンジン

キーをマップして、入力をキャプチャしてカスタム検索エンジンに渡す CGI スクリプトを起動できます。そのためには、まず ~/.w3m/keymap 内にキーバインドを作成してスクリプトを起動します。

keymap s COMMAND "SET_OPTION dictcommand=file:///cgi-bin/omnibar_google.cgi ; DICT_WORD"

そして、[1]~/.w3m/cgi-bin ディレクトリ内に配置し、実行権限を与えます。

上記のスクリプトは Google の結果を返しますが、この種のスクリプトを使用して StackOverflow、GitHub、DuckDuckGo、Reddit、その他多数の Web サイトを検索することもできます。

同様のスクリプトは GitHub で参照できます。

リーダーモード

一部の Web ページは、コンテンツのほとんどを表示するために大量の JavaScript または CSS を使用しているため、w3m では適切に動作しません。 記事の先頭に到達するために複数のページをスクロールしなければならないことがよくあります。

これは、最初に Web ページを rdrview-gitAUR などのリーダーモードプログラムに通すことで軽減できます。

これを行うには、次の行を ~/.w3m/keymap に追加します。

keymap R COMMAND "READD_SHELL 'rdrview $W3M_URL -H 2> /dev/null 1> /tmp/readable.html' ; LOAD /tmp/readdable.html"

リダイレクト URL

~/.w3m/siteconf ファイルは、リファラーやユーザーエージェントなど、Web サイトに応じていくつかの環境設定を設定するために使用されます。

また、Web サイトの代わりに、より軽量 (レイアウトと帯域幅の両方の点で) でプライバシーの点で優れたサイトにリダイレクトするために使用することもできます。

これに加えて、特定の CGI スクリプトの実行にも使用できます。

~/.w3m/siteconf
url m!^https?://([a-z]+\.)?twitter\.com/!
substitute_url "https://nitter.net/"

url m!^https?://([a-z]+\.)?reddit\.com/!
substitute_url "https://safereddit.com/"

#url m!^https?://([a-z]+\.)?google\.com/!
#substitute_url "https://duckduckgo.com/lite/"

url m!^https?://([a-z]+\.)?imgur\.com/!
substitute_url "https://rimgo.pussthecat.org/"

url m!^https?://([a-z]+\.)?wikipedia\.com/!
substitute_url "https://wl.vern.cc/"

url "https://www.youtube.com/" exact
substitute_url "file:/cgi-bin/video.cgi?"
#substitute_url "https://yewtu.be/"

url "https://stackoverflow.com/" exact
substitute_url "https://ao.bloatcat.tk/"

url "https://www.reuters.com/" exact
substitute_url "https://neuters.de/"

url "https://fandom.com/" exact
substitute_url "https://breezewiki.pussthecat.org/"

url "https://medium.com/" exact
substitute_url "https://scribe.rip/"

url "https://web.archive.org/" exact
substitute_url "https://wayback-classic.net/"

閉じたウィンドウを復元する

デフォルトの w3m は閉じたタブを再度開くことができません。これを追加するには、CGI を使用して、タブを閉じるボタンをバインドして、閉じるタブの現在の URL をエコーし​​、別のキーをバインドしてファイルに追加された最新の URL を復元します。

~/.w3m/keymap 内に次を追加します。

keymap d COMMAND "EXTERN 'echo %s >> ~/.w3m/RestoreTab.txt' ; CLOSE_TAB"
keymap u COMMAND TAB_GOTO file:/cgi-bin/restore_tab.cgi

次に、次のファイルを ~/.w3m/cgi-bin 内に配置し、実行可能 にします。

restore_tab.cgi

magnet リンクを開く

Magnet.cgi を使用すると、Transmission を使用して w3m 自動オープンマグネットリンクを作成できます。

フィンガープリント

tor の使用

torify(1) を使用して、w3m トラフィックを tor 経由でルーティングできます。

$ torify w3m -v

ユーザーエージェントとヘッダー

デフォルトでは、w3m は独自のユーザーエージェントを使用します。これは、w3m ユーザーが他のユーザーの中で目立つことを意味します。

フィンガープリントは、より汎用的なユーザーエージェント、言語、および http_accept ヘッダーを使用することで減らすことができます。

~/.w3m/config
user_agent Mozilla/5.0 (Windows NO 10.0; rev:91.0) Gecko/20100101 Firefox91.0
no_referer 1
cross_origin_referer 0
accept_language en-US,en;q=0.5
accept_encoding gzip, deflate
accept_media text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Cookie を無効にする

Cookie を無効にするには、~/.w3m/configuse_cookie を 0 に設定します。

キャッシュを無効にする

キャッシュを無効にするには、~/.w3m/configno_cache を 1 に設定します。

トラブルシューティング

画像がちらつく、遅延する

残念ながら、画像をスクロールしようとすると w3m が遅延し、ブラウザが数秒間応答しなくなる場合があります。

これに対する解決策は画像を完全に無効にすることですが、これにより一部の Web サイトが機能しなくなります (たとえば、hacker news はコメントのインデントに GIF を使用しています)

より洗練された解決策は、画像のオンとオフを切り替えるキーバインドを作成することです。そのためには、次の行を ~/.w3m/keymap に追加します。

keymap i COMMAND "SET_OPTION display_image=toggle ; RESHAPE"

参照