w3m その8 (738レス)
w3m その8 http://mevius.5ch.net/test/read.cgi/unix/1185784998/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
667: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 19:40:18.57 やっぱちょっと違うな。<div></div>に変えて動いてるわけだからな。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/667
668: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 19:41:22.71 これは動く。 <a href='test.html'>test<div></div></a> これ駄目。 <a href='test.html'><div>test</div></a> http://mevius.5ch.net/test/read.cgi/unix/1185784998/668
669: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 19:50:46.58 ただ面倒なので、duckduckgoがお勧め。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/669
670: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 01:27:48.66 #!/bin/zsh # factorを変更しただけ。 UNIQ=$(basename $(ps -p $PPID -o pid,ppid,egroup,euser,lstart |md5sum)) case "$QUERY_STRING" in # formから流れてくるもの。# 次のページへ、時間指定等の対応。 ${UNIQ}=form\&*|${UNIQ}=rotate\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/[^&]*&//; s/%25/%/g' <<<$QUERY_STRING ))";; *) # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/url?q=/search%3F\(q%3D[^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=decode\&\2,;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g;'\ 's%\(<a [^>]*href="\)/search?\([^"]*"\)'\ '%\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/670
671: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 01:40:19.68 #!/bin/zsh # bsdのmanにはeuserとかの指定の仕方は無かったので変えただけ。 # そもそもたぶんここ要らないと思うんだけど改造する時の使い道としてまあやっとく。 UNIQ=$(basename $(ps -p $PPID -o pid,ppid,group,user,lstart |md5sum)) case "$QUERY_STRING" in # formから流れてくるもの。# 次のページへ、時間指定等の対応。 ${UNIQ}=form\&*|${UNIQ}=rotate\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/[^&]*&//; s/%25/%/g' <<<$QUERY_STRING ))";; *) # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/url?q=/search%3F\(q%3D[^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=decode\&\2,;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g;'\ 's%\(<a [^>]*href="\)/search?\([^"]*"\)'\ '%\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/671
672: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 01:55:42.21 このぐらいの変更で貼り付けないけど、gidとuid使ったほうがいいのかも。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/672
673: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 01:57:51.40 UNIQ=$(basename $(ps -p $PPID -o pid,ppid,gid,uid,lstart |md5sum)) ここの話しね。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/673
674: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 02:52:39.37 UNIQ=$(printf $(ps -p $PPID -o pid,ppid,lstart |md5sum)) このぐらいでいいな。後printfの方が速いな。 いまいちここ好きじゃなんだよな。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/674
675: 名無しさん@お腹いっぱい。 [] 2019/09/08(日) 15:05:16.58 #!/bin/zsh # すまんnkfとか無くてももっと簡単な事だった。 # 後<span>を削る必要は無いけど扱いやすくなるから残しとく。 UNIQ=$(printf $(ps -p $PPID -o pid,ppid,lstart |md5sum)) case "$QUERY_STRING" in # formから流れてくるもの。 ${UNIQ}=form\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=rotate\&*) # 次のページへ、ここから再検索して下さい、時間指定等の対応。 URL="https://www.google.co.jp/$( cut -d '&' -f 2- <<<$QUERY_STRING )";; *) # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/\(search?\|url?q=/search%3F\)\([^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2\3,g;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/675
676: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:05:35.75 最後にちょっとだけ拡張してみた。これでそろそろ辞めるわ。 変数大文字ですまんな、なんかそうなってしまった。 まあまた間違いのラッシュだろけど。 現在のurlが一番上に表示されるようにしたからそれを見ながら、 二つ目のformにsedに渡す文字列を入力してsubmitするとその変更したurlに変わる。 だからs/ja/en/とすると英語のページに変わりますよという事。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/676
677: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:13:49.61 #!/bin/zsh # やられた停電だよ。まじか。 UNIQ=$(printf $(ps -p $PPID -o pid,ppid,lstart |md5sum)) case "$QUERY_STRING" in ${UNIQ}=option\&*) URL_HOLD=$(nkf --url-input <(sed 's%[^&]*&field=\([^&]*\)&.*%\1%' <<<$QUERY_STRING)) URL=$(sed $(nkf --url-input <(cut -d '&' -f 3 <<<$QUERY_STRING |tr '+' ' ')) <<<$URL_HOLD) test -z "$URL" && URL=$URL_HOLD;; ${UNIQ}=form\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=rotate\&*) URL="https://www.google.co.jp/$( cut -d '&' -f 2- <<<$QUERY_STRING )";; *) URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac http://mevius.5ch.net/test/read.cgi/unix/1185784998/677
678: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:14:23.25 <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: EXTERN echo %s |xsel -s w3m-control: VIEW w3m-control: PIPE_BUF sed "s,<body [^>]*>,&\$(xsel -s |sed "s/&/\\\\\&/g")<br />,;"\ 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's,</form>,&<form action="file:///cgi-bin/google.zsh">'\ '<input name=$UNIQ value="option" type=hidden>'\ '<input name=field value='"\$(xsel -s |sed "s/&/\\\\\&/g")"' type=hidden>'\ '<input type=text></form>,;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/\(search?\|url?q=/search%3F\)\([^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2\3,g;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/678
679: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:17:41.26 そうだった。xsel -s使ってるから。xsel -sの内容消えるからね。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/679
680: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:43:47.91 #!/bin/zsh UNIQ=$(printf $(ps -p $PPID -o pid,ppid,lstart |md5sum)) case "$QUERY_STRING" in ${UNIQ}=option\&*) URL_HOLD=$(nkf --url-input <(sed 's%[^&]*&field=\([^&]*\)&.*%\1%; s/%25/%/g' \ <<<$QUERY_STRING)) URL=$(sed $(nkf --url-input <(cut -d '&' -f 3 <<<$QUERY_STRING |tr '+' ' ')) <<<$URL_HOLD) echo $QUERY_STRING>>$HOME/debug echo $URL>>$HOME/debug echo $URL_HOLD>>$HOME/debug test -z "$URL" && URL=$URL_HOLD;; ${UNIQ}=form\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=rotate\&*) URL="https://www.google.co.jp/$( cut -d '&' -f 2- <<<$QUERY_STRING )";; *) URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac http://mevius.5ch.net/test/read.cgi/unix/1185784998/680
681: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 02:44:15.88 <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: EXTERN echo %s |xsel -s w3m-control: VIEW w3m-control: PIPE_BUF sed "s,<body [^>]*>,&\$(xsel -s |sed "s/&/\\\\\&/g")<br />,;"\ 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's,</form>,&<form action="file:///cgi-bin/google.zsh">'\ '<input name=$UNIQ value="option" type=hidden>'\ '<input name=field value='"\$(xsel -s |sed "s/&/\\\\\&/g")"' type=hidden>'\ '<input type=text></form>,;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/\(search?\|url?q=/search%3F\)\([^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2\3,g;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/681
682: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 03:07:59.08 >>675で完成してるからな。後は余興。ノシ。PC触り過ぎてきもちわり。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/682
683: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 07:23:21.45 すまん。やっぱ寝ぼけてたな。$HOME/debugにfileを書き出してる。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/683
684: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 07:26:17.19 #!/bin/zsh UNIQ=$(printf $(ps -p $PPID -o pid,ppid,lstart |md5sum)) case "$QUERY_STRING" in ${UNIQ}=option\&*) URL_HOLD=$(nkf --url-input <(sed 's%[^&]*&field=\([^&]*\)&.*%\1%; s/%25/%/g' \ <<<$QUERY_STRING)) URL=$(sed $(nkf --url-input <(cut -d '&' -f 3 <<<$QUERY_STRING |tr '+' ' ')) <<<$URL_HOLD) test -z "$URL" && URL=$URL_HOLD;; ${UNIQ}=form\&*) URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=rotate\&*) URL="https://www.google.co.jp/$( cut -d '&' -f 2- <<<$QUERY_STRING )";; *) URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100";; esac http://mevius.5ch.net/test/read.cgi/unix/1185784998/684
685: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 07:26:52.00 <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: EXTERN echo %s |xsel -s w3m-control: VIEW w3m-control: PIPE_BUF sed "s,<body [^>]*>,&\$(xsel -s |sed "s/&/\\\\\&/g")<br />,;"\ 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's,</form>,&<form action="file:///cgi-bin/google.zsh">'\ '<input name=$UNIQ value="option" type=hidden>'\ '<input name=field value='"\$(xsel -s |sed "s/&/\\\\\&/g")"' type=hidden>'\ '<input type=text></form>,;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/\(search?\|url?q=/search%3F\)\([^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2\3,g;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF # もう間違っててもちょっと離れる。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/685
686: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 07:30:02.79 まじすまんな。上の$HOME/debugにfileを書いちゃってるから。 まあダメージないだろうけど。この失敗は教訓にしよう。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/686
687: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 07:35:59.90 幸い>>でつけたしだから。万が一があってもあわてずにな。ノシ。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/687
688: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 18:59:11.46 すまん。xselなくてもいけるなPIPE_BUFでも普通に%s使えるっぽいな。 直すか。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/688
689: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 19:18:13.15 いや、どうやら無理だな。後sedで変更する値が見えてるままの値じゃなくて 検索に入ってる文字列を変更するようになってるけと、これは直さないほうが使いやすいな。 後ほんとsedに流し込んでるだけなので、危険な事すれば危険なのでね。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/689
690: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 19:36:12.85 # 下部分だけちょっと改良。 # でも前のほうがxsel -sにurlがそのまま入ってる形だけど。 # xselを一時fileにしたほうが素直だと思うけどrm使うのは頭働かせないと怖いからやらない。 <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: EXTERN echo %s |sed 's/&/\\\&/g' |xsel -s w3m-control: VIEW w3m-control: PIPE_BUF sed "s,<body [^>]*>,&\$(xsel -s)<br />,;"\ 's%\(<input[^>]*\)Shift_JIS%\1UTF-8%; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name=$UNIQ type=hidden value="form">%;'\ 's,</form>,&<form action="file:///cgi-bin/google.zsh">'\ '<input name=$UNIQ value="option" type=hidden>'\ '<input name=field value='"\$(xsel -s)"' type=hidden>'\ '<input type=text></form>,;'\ 's%\(<span[^>]*>\|</span>\)%%g; s%<div[^>]*>%%g; s%</div>%<div>&%g;'\ 's,\(<a [^>]*href="\)/\(search?\|url?q=/search%3F\)\([^"]*"\)'\ ',\1file:///cgi-bin/google.zsh?${UNIQ}=rotate\&\2\3,g;'\ 's%\(<a [^>]*href="\)/url?%\1https://www.google.co.jp/url?%g' w3m-control: VIEW $( printf '%s\n' 'w3m-control: DELETE_PREVBUF'{,,,} ) EOF http://mevius.5ch.net/test/read.cgi/unix/1185784998/690
691: 名無しさん@お腹いっぱい。 [] 2019/09/09(月) 19:58:46.24 どうでもいいだろうけど以下の部分は、""いらないな。 '<input name=field value='"\$(xsel -s)"' type=hidden>'\ こう見たほうが素直に何してるか分かるかも。\\\&が非常に自分でも分かり辛い。 '<input name=field value='\$(xsel -s)' type=hidden>'\ http://mevius.5ch.net/test/read.cgi/unix/1185784998/691
692: 名無しさん@お腹いっぱい。 [] 2019/09/11(水) 02:42:21.38 w3mは適当にformだけを切り出してもちゃんと描画してくれるから、 適当に抜き出してw3m-control: SUBMITを使えば、 10行20行に満たないコードでいろいろ書けちゃうね。shで書くよりも短く書ける。 やっぱw3m作った人はセンスの塊だと思うわ。いつか俺はテコ入れしてバージョン上げたいね。 色々書いたから載せたい所だか、まあ間違い直しでスレッドが埋まっちゃうから無理だな。 5chはmoreなんだな。lessじゃない。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/692
693: 名無しさん@お腹いっぱい。 [sage] 2019/09/11(水) 17:50:18.92 自己顕示欲の塊みたいなやつだな http://mevius.5ch.net/test/read.cgi/unix/1185784998/693
694: 名無しさん@お腹いっぱい。 [] 2019/09/19(木) 19:41:51.98 5chでよく聞く気持ち悪い台詞だな。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/694
695: 名無しさん@お腹いっぱい。 [sage] 2019/09/20(金) 08:49:56.46 そんなにたくさん5chを見てるのか http://mevius.5ch.net/test/read.cgi/unix/1185784998/695
696: 名無しさん@お腹いっぱい。 [sage] 2019/12/07(土) 20:24:38.61 「誰に向けて書いてんだよ?」とは思うけど、どうせ過疎スレだし… そんなことより Google の仕様がまた変わったな。 テキストがリンクになってる。a 要素の中に div 要素が無い。 まあ、この変更に気付いたのは lynx で見てる時なんだが。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/696
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 42 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.007s