1

Yahoo Answersのリンクを変更して一部のパーツを削除し、を保存して。qidに置き換えることを検討indexしていanswerます。

したがって、この:

http://answers.yahoo.com/question/index;_ylt=AhT5ZZwbMiGWdQZDSxD1ML305nNG;_ylv=3?qid=20121004094847AAjekoj

これになります:

http://answers.yahoo.com/question/answer?qid=20121004094847AAjekoj

リンクを書き換える方法があることは知っています.htaccessが、この場合、タスクはWebサイトではなく、アクセスしたサイトで実行されるため、Greasemonkeyスクリプトである必要があります。

4

3 に答える 3

2

ここで必要なパターンは次のとおりです。

/(http:\/\/answers.yahoo.com\/questions\/)index.*(?qid=.*)$/i

そして、あなたはそれをこれに置き換えるでしょう:

/$1answer$2/

ただし、Greasemonkeyについてはよくわからないので、これ以上はお伝えできません。うまくいけば、Greasemonkeyの知識が豊富な人がやって来て、より良い答えを提供してくれます。

于 2012-10-04T17:02:05.243 に答える
1

一般的に、これはそれを行う必要があります(完全なGMスクリプト):

// ==UserScript==
// @name     _Replace yahoo-answers links
// @include  http://answers.yahoo.com/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant    GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change introduced
    in GM 1.0.   It restores the sandbox.
*/
var targLinks   = $("a[href*='question/index']");
targLinks.each ( function () {
    if (/\bqid=\w+/i.test (this.href) ) {
        var newHref = this.href

        var newPath = this.pathname.replace (/\/question\/index.+$/, "/question/answer");
        var newURL  = this.protocol + "//"
                    + this.host
                    + newPath
                    + this.search
                    + this.hash
                    ;
        this.href   = newURL;
    }
} );
于 2012-10-04T17:04:27.867 に答える
0

交換

/(http:\/\/answers\.yahoo\.com\/question)\/index.+[?&]qid=([^&#]+)/g

"$1/answer?quid=$2"
于 2012-10-04T17:07:03.900 に答える