w3m その8 (738レス)
w3m その8 http://mevius.5ch.net/test/read.cgi/unix/1185784998/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
646: 名無しさん@お腹いっぱい。 [] 2019/09/06(金) 18:15:42.68 # この星の一等賞んなりたいのw3mで俺は!そんだけ! # 変数UNIQ関係は検索した文字列がcaseの命令と重ならないようにしている。 # それはw3mの起動ごとに変わるはず。もしかしたらいらないのかな。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/646
647: 名無しさん@お腹いっぱい。 [] 2019/09/06(金) 18:18:11.34 あーまた間違える。さっきまでとまた世界が変わってる。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/647
648: 名無しさん@お腹いっぱい。 [] 2019/09/06(金) 18:30:16.64 #!/bin/zsh test "${QUERY_STRING%%&*}" != $(basename $( factor $PPID |md5sum )) \ && UNIQ=$(basename $( factor $PPID |md5sum )) case "$UNIQ$QUERY_STRING" in rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )" UNIQ=$(basename $( factor $PPID |md5sum ));; decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))" UNIQ=$(basename $( factor $PPID |md5sum ));; ${UNIQ}*) #default, またはformから流れてくるもの。 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%<form.*value="\(.*\)"[^>]*name="q".*/form>'\ '%<form action="file:///cgi-bin/google.zsh">'\ '<input type=text value="\1"></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/648
649: 名無しさん@お腹いっぱい。 [] 2019/09/06(金) 18:33:46.29 全然違うわ。なんなんだよ。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/649
650: 名無しさん@お腹いっぱい。 [] 2019/09/06(金) 19:09:05.53 #!/bin/zsh # あってるのかな。 UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%&*}" != $UNIQ; then # default, またはformから流れてくるもの。 URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else case "$QUERY_STRING" in ${UNIQ}\&rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )";; ${UNIQ}\&decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; esac fi <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed 's%<form.*value="\(.*\)"[^>]*name="q".*/form>'\ '%<form action="file:///cgi-bin/google.zsh">'\ '<input type=text value="\1"></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/650
651: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 00:34:24.46 #!/bin/zsh UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%&*}" != ${UNIQ}=; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else case "$QUERY_STRING" in ${UNIQ}=\&*) # formから流れてくるもの。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; ${UNIQ}=\&rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )";; ${UNIQ}=\&decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; esac fi <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed \ 's%Shift_JIS%UTF-8%g; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name="${UNIQ}" type=hidden>%;'\ '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/651
652: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 00:43:08.66 formから流れてくるものはqueryの変更をしない事にした。ニュースを検索したいのに「すべて」を 検索してしまう事への対応。 Shift_JISは変えないと、formから流れてくる文字の検索が失敗する。 大体これで前と一緒な感じがするな。ただ眠るとどうだろうな。 まあ誰か役に立てば。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/652
653: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:02:48.50 はい間違えてる。なんなの俺。俺の頭どうしちゃったんだよ。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/653
654: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:05:37.74 #!/bin/zsh UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%&*}" != ${UNIQ}=; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else case "$QUERY_STRING" in ${UNIQ}=\&rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )";; ${UNIQ}=\&decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; ${UNIQ}=\&*) # formから流れてくるもの。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; esac fi <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed \ 's%Shift_JIS%UTF-8%g; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2<input name="${UNIQ}" type=hidden>%;'\ '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/654
655: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:13:24.47 あれ、これ駄目か、振り出しに戻ってるか。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/655
656: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:22:02.52 #!/bin/zsh UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%=*}" != ${UNIQ}; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=10" else case "$QUERY_STRING" in ${UNIQ}=\&rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )";; ${UNIQ}=\&decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; ${UNIQ}=1\&*) # formから流れてくるもの。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; esac fi <<EOF Content-Type: text/plain w3m-control: GOTO $URL w3m-control: VIEW w3m-control: PIPE_BUF sed 's%Shift_JIS%UTF-8%g; s%\(<form \)\([^>]*>\)'\ '%\1action="file:///cgi-bin/google.zsh" \2'\ '<input name=$UNIQ type=hidden value="1">%;'\ '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/656
657: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:23:44.21 あ、num=10のままになってるな。 これでもうもう間違いないっしょ。 だからnumは自分で変えてくんろ。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/657
658: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:50:58.58 UTF-8に変える所にgは要らないな。このぐらいじゃ貼らないけど。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/658
659: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 01:57:53.91 てか直さないと出力の中のも変えちゃうか。あーまた間違えてる。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/659
660: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 02:05:07.89 #!/bin/zsh UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%=*}" != $UNIQ; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else case "$QUERY_STRING" in ${UNIQ}=\&rotate\&*) # 次のページへ、時間指定等の対応。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 3- <<<$QUERY_STRING )";; ${UNIQ}=\&decode\&*) # ここから再検索して下さいの対処。 URL="https://www.google.co.jp/search?\ $(nkf --url-input <( sed 's/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; ${UNIQ}=1\&*) # formから流れてくるもの。 URL="https://www.google.co.jp/search?$( cut -d '&' -f 2- <<<$QUERY_STRING )";; esac fi <<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="1">%;'\ '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/660
661: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 02:08:37.88 良かった。気づいて。これは申し訳ないレベルだった。 よしもういいだろ。もういいだろ。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/661
662: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 14:22:20.68 #!/bin/zsh # より短く分かりやすく、無駄な事をしてる部分を削った。 UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%=*}" != $UNIQ; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else 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/\([^&]*&\)\{2\}//; s/%25/%/g' <<<$QUERY_STRING ))";; esac fi <<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/662
663: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 15:01:09.86 #!/bin/zsh # 直し忘れの修正。 UNIQ=$(basename $( factor $PPID |md5sum )) if test "${QUERY_STRING%%=*}" != $UNIQ; then # default. URL="https://www.google.co.jp/search?q=$QUERY_STRING&hl=ja&biw=&bih=&gbv=1&num=100" else 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 ))";; esac fi <<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/663
664: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 15:35:13.55 #!/bin/zsh # ごめんこれだけで良かったの修正。 UNIQ=$(basename $( factor $PPID |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 ))";; *) 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/664
665: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 19:35:00.39 一応簡単に説明しくおくと、最近googleで検索してもlink先へ飛べなくなった事への対 処をしている。googleが送ってきたソースをsedで加工して表示している。<a></a>の中に <div>があってそれが原因なので消しているだけ。 他にそのままgoogleを開いたまま検索した場合、検索は出来るが出てくるソースはまた 上で書いた問題を含む為、cgiを経由するように書き換える、だからまた同じようにsedで 加工されたページが表示される。その繰り返し。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/665
666: 名無しさん@お腹いっぱい。 [] 2019/09/07(土) 19:37:27.95 いや、原因違うかも。まあ動いてるから良しとする。 http://mevius.5ch.net/test/read.cgi/unix/1185784998/666
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
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 63 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.007s