我有一个相当大的音乐网站,有一个很大的艺术家数据库。我一直注意到其他音乐网站在窃取我们网站的数据(我在这里和那里输入假艺人的名字,然后进行谷歌搜索)。

如何防止屏幕刮擦?这可能吗?


当前回答

一种方法是将内容作为XML属性、URL编码的字符串、使用HTML编码的JSON预格式化的文本或数据uri提供,然后在客户机上将其转换为HTML。以下是一些这样做的网站:

Skechers: XML <document filename="" height="" width="" title="SKECHERS" linkType="" linkUrl="" imageMap="" href=&quot;http://www.bobsfromskechers.com&quot; alt=&quot;BOBS from Skechers&quot; title=&quot;BOBS from Skechers&quot; /> Chrome Web Store: JSON <script type="text/javascript" src="https://apis.google.com/js/plusone.js">{"lang": "en", "parsetags": "explicit"}</script> Bing News: data URL <script type="text/javascript"> //<![CDATA[ (function() { var x;x=_ge('emb7'); if(x) { x.src='data:image/jpeg;base64,/*...*/'; } }() ) Protopage: URL Encoded Strings unescape('Rolling%20Stone%20%3a%20Rock%20and%20Roll%20Daily') TiddlyWiki : HTML Entities + preformatted JSON <pre> {&quot;tiddlers&quot;: { &quot;GettingStarted&quot;: { &quot;title&quot;: &quot;GettingStarted&quot;, &quot;text&quot;: &quot;Welcome to TiddlyWiki, } } } </pre> Amazon: Lazy Loading amzn.copilot.jQuery=i;amzn.copilot.jQuery(document).ready(function(){d(b);f(c,function() {amzn.copilot.setup({serviceEndPoint:h.vipUrl,isContinuedSession:true})})})},f=function(i,h){var j=document.createElement("script");j.type="text/javascript";j.src=i;j.async=true;j.onload=h;a.appendChild(j)},d=function(h){var i=document.createElement("link");i.type="text/css";i.rel="stylesheet";i.href=h;a.appendChild(i)}})(); amzn.copilot.checkCoPilotSession({jsUrl : 'http://z-ecx.images-amazon.com/images/G/01/browser-scripts/cs-copilot-customer-js/cs-copilot-customer-js-min-1875890922._V1_.js', cssUrl : 'http://z-ecx.images-amazon.com/images/G/01/browser-scripts/cs-copilot-customer-css/cs-copilot-customer-css-min-2367001420._V1_.css', vipUrl : 'https://copilot.amazon.com' XMLCalabash: Namespaced XML + Custom MIME type + Custom File extension <p:declare-step type="pxp:zip"> <p:input port="source" sequence="true" primary="true"/> <p:input port="manifest"/> <p:output port="result"/> <p:option name="href" required="true" cx:type="xsd:anyURI"/> <p:option name="compression-method" cx:type="stored|deflated"/> <p:option name="compression-level" cx:type="smallest|fastest|default|huffman|none"/> <p:option name="command" select="'update'" cx:type="update|freshen|create|delete"/> </p:declare-step>

如果查看上述任何一个的源代码,就会看到抓取只会返回元数据和导航。

其他回答

我同意上面的大部分帖子,我想补充的是,你的网站对搜索引擎越友好,它就越容易被抓取。你可以尝试做一些让刮刀器更难的事情,但它也可能影响你的搜索能力……当然,这取决于你想让你的网站在搜索引擎上排名有多好。

当然,这是可能的。为了100%的成功,让你的网站离线。

在现实中,你可以做一些事情,让抓取变得更加困难。谷歌进行浏览器检查,以确保您不是一个抓取搜索结果的机器人(尽管这和大多数其他事情一样,可以被欺骗)。

你可以做一些事情,比如在第一次连接到你的网站和随后的点击之间需要几秒钟。我不确定理想的时间是什么,也不知道具体怎么做,但这是另一个想法。

我相信还有其他一些人有更多的经验,但我希望这些想法至少有一定的帮助。

你真的没有什么办法可以完全防止这种情况。刮刮者可以伪造他们的用户代理,使用多个IP地址等,并以正常用户的身份出现。你唯一能做的就是让文本在页面加载时不可用——用图像、flash或JavaScript加载。然而,前两个都是糟糕的想法,如果JavaScript没有为一些常规用户启用,最后一个将是可访问性问题。

如果他们对你的网站进行了猛烈的攻击,并且浏览了你所有的页面,你可以做一些速率限制。

不过还是有希望的。刮刮器依赖于您的网站的数据是一致的格式。如果你能随机分配,它可能会打碎他们的刮刀。比如在每次加载时更改页面元素的ID或类名等。但这需要做很多工作,我不确定是否值得。即便如此,只要有足够的投入,他们可能就能解决这个问题。

不,不可能停止(以任何方式) 拥抱它。为什么不发布为RDFa,成为超级搜索引擎友好,并鼓励重复使用数据?人们会感谢你,并在适当的时候提供信用(以musicbrainz为例)。

这可能不是你想要的答案,但为什么要隐藏你想要公开的东西呢?

你可以做一些事情来防止屏幕抓取。有些不是很有效,而另一些(验证码)是,但阻碍可用性。你必须记住,它也可能阻碍合法的网站刮刀,如搜索引擎索引。

然而,我认为如果你不希望它被删除,这意味着你也不希望搜索引擎索引它。

这里有一些你可以尝试的方法:

Show the text in an image. This is quite reliable, and is less of a pain on the user than a CAPTCHA, but means they won't be able to cut and paste and it won't scale prettily or be accessible. Use a CAPTCHA and require it to be completed before returning the page. This is a reliable method, but also the biggest pain to impose on a user. Require the user to sign up for an account before viewing the pages, and confirm their email address. This will be pretty effective, but not totally - a screen-scraper might set up an account and might cleverly program their script to log in for them. If the client's user-agent string is empty, block access. A site-scraping script will often be lazily programmed and won't set a user-agent string, whereas all web browsers will. You can set up a black list of known screen scraper user-agent strings as you discover them. Again, this will only help the lazily-coded ones; a programmer who knows what he's doing can set a user-agent string to impersonate a web browser. Change the URL path often. When you change it, make sure the old one keeps working, but only for as long as one user is likely to have their browser open. Make it hard to predict what the new URL path will be. This will make it difficult for scripts to grab it if their URL is hard-coded. It'd be best to do this with some kind of script.

如果我必须这样做,我可能会结合使用后三种方法,因为它们最大限度地减少了对合法用户的不便。然而,你必须接受这样的事实:你不可能用这种方式屏蔽所有人,一旦有人想出了绕过它的方法,他们就可以永远地刮掉它。我猜你可以在发现他们的时候屏蔽他们的IP地址。