google.com 网页快照增强

针对特定网站的规则分享、讨论

Moderator: phoenix

Post Reply
Ray4
Moderator
Posts: 65
Joined: Dec 30 2007, 09:37

google.com 网页快照增强

Post by Ray4 »

其实proxomitron的应用原理本论坛基本都有了,规则再怎么变,也只是具体形式的变化而不是本质的变化,所以以后更多的规则只能算是推荐了 :!:


很多人都会遇到这种情况,好不容易找到自己想要的信息,打开链接,发现服务器当了,打开快照,却又发现需要的东西其实不在当前网页,而是在此服务器上更深的地方,这时就又要手动搜索这个链接,麻烦! :oops:
今天在userscripts上发现了她 :twisted:Google Cache Continue Redux,它会在google网页快照页面内的所有超链接旁生成一个名为cache的链接,点击它会自动在google的cache里继续搜索新打开的链接,原只支持google.com,已将google.cn的加了进去。简单试了一下,支持firefox和opera,ie内核的要自己动手了 :ugeek:
$TYPE(htm)$URL(http://[^/]+/search\?*q\=cache(:|%3a))(^(^</body>))$SET(1=<script src="http://local.ptron/js/google_cache_continue.js" type="text/javascript" charset="gb2312"></script>)$STOP()
将替换部分改为\1
最好是在匹配的时候检查一下ua,是firefox或者opera再执行

将附件解压后放在prox\html\js\目录下
Attachments
google_cache_continue.7z
(2.78 KiB) Downloaded 1619 times
User avatar
phoenix
Site Admin
Posts: 529
Joined: Dec 29 2007, 16:27

Re: google.com 网页快照增强

Post by phoenix »

很好的idea,写了个非JS的版本,只针对该服务器的绝对链接添加Google cache链接。

Code: Select all

[Patterns]
Name = "Add cache links to Google cache results page 2008.08.21 [phoenix]"
Active = TRUE
URL = "$TYPE(htm)[^/]+/search\?*q=cache"
Limit = 256
Match = "(This is Google*s cache of <a[^>]+>http://\1/*</a>)\0$SET(currentHost=\1)$ADDLST(Mem-Temp,\1)|"
        "(<a*href=$AV(http://$LST(Mem-Temp)/\1|/\1)*</a>)\0$SET(2= <a href="http://www.google.com/search?hl=en&q=cache:http://$GET(currentHost)/\1"><img src="http://www.google.com/favicon.ico" style="border: none;" /></a>)"
Replace = "\0\2"
User avatar
phoenix
Site Admin
Posts: 529
Joined: Dec 29 2007, 16:27

Re: google.com 网页快照增强

Post by phoenix »

改进了下,不再需要使用blockfile。

Code: Select all

[Patterns]
Name = "Add cache links to Google cache results page 2008.10.10 [phoenix]"
Active = TRUE
URL = "$TYPE(htm)[^/]+/search\?*q=cache"
Limit = 256
Match = "This is Google*s cache of <a[^>]+>http://\1/*</a>$SET(currentHost=\1)PrxFail|"
        "(<a\s*</a>&&*href=$AV(http://$TST(currentHost)/\1|/\1)*)\0$SET(2= <a href="http://www.google.com/search?q=cache:http://$GET(currentHost)/\1"><img src="http://www.google.com/favicon.ico" style="border: none;" /></a>)"
Replace = "\0\2"
User avatar
phoenix
Site Admin
Posts: 529
Joined: Dec 29 2007, 16:27

Re: google.com 网页快照增强

Post by phoenix »

再次改进,从当前URL解出hostname,适用于不同语言的google快照。

Code: Select all

[Patterns]
Name = "Add cache links to Google cache results page {phoenix,ln}081011"
Active = TRUE
URL = "$TYPE(htm)[^/]+/search\?*q=cache"
Bounds = "<a\s*</a>"
Limit = 256
Match = "$URL(*cache(:|%3a)(http(://|%3a%2f%2f)|)([^/&]+)\1*)"
        "(*href=$AV(http://$TST(\1)/\2|/\2)*)\3"
Replace = "\3<a href="http://www.google.com/search?q=cache:http://\1/\2"><img src="http://www.google.com/favicon.ico" style="border: none;" /></a>"
Ray4
Moderator
Posts: 65
Joined: Dec 30 2007, 09:37

Re: google.com 网页快照增强

Post by Ray4 »

这个mem-temp是退出的时候清空?有没有办法让prox主动清空?
User avatar
phoenix
Site Admin
Posts: 529
Joined: Dec 29 2007, 16:27

Re: google.com 网页快照增强

Post by phoenix »

Ray4 wrote:这个mem-temp是退出的时候清空?
是的。Reload Config的时候也会清空。
Ray4 wrote:有没有办法让prox主动清空?
对 blockfile 的操作只看到能添加记录,似乎没有办法主动清空。
User avatar
phoenix
Site Admin
Posts: 529
Joined: Dec 29 2007, 16:27

Re: google.com 网页快照增强

Post by phoenix »

更新了下,以应对下面红色部分代码:
http://72.14.235.132/search?q=cache:mVDpiTBpwCUJ:hi.baidu.com/

Code: Select all

[Patterns]
Name = "Add cache links to Google cache results page {whenever,ln}090325"
Active = TRUE
URL = "$TYPE(htm)[^/]+/search\?*q=cache"
Bounds = "<a\s*</a>"
Limit = 256
Match = "$URL(*cache(:|%3a)([^:]+:)+(http(://|%3a%2f%2f)|)([^/&]+)\1*)"
        "(*href=$AV(http://$TST(\1)/\2|/\2)*)\3"
Replace = "\3<a href="http://www.google.com/search?q=cache:http://\1/\2"><img src="http://www.google.com/favicon.ico" style="border: none;" /></a>"
jonaphan
Posts: 8
Joined: Jan 25 2010, 21:00

Re: google.com 网页快照增强

Post by jonaphan »

这是个好东西,用上了.
Post Reply