突破网易相册的反盗链

网易相册,免费,无限容量,存取速度快(我用着确实快,要安装插件),而且支持批量上传图片,用着很方便.以前链接网易相册上的图片时从没遇到反盗链的问题,今天在引用时发现有了反盗链。链接的图片都显示如下,右键属性查看图看地址
1.没加反盗链:
http://img150.photo.163.com/admcg/16264326/390837893.jpg


2.加了反盗链:
http://iyeur.com/163.asp?url=http://img150.photo.163.com/admcg/16264326/390837893.jpg

.............................................................................................................
这两个图片网易地址是相同的,都为http://img150.photo.163.com/admcg/16264326/390837893.jpg

网易相册有个特点,盗链的图片当时你可以看,发给别人就看不了,这是因为你看到的是缓存的图片。如果清除缓存和cookies再看,就看不到了。

网易相册,免费,无限容量,存取速度快(我用着确实快,要安装插件),而且支持批量上传图片。用着很方便

突破反盗链的方法是:新建一163.asp文件,内容如下:
程序代码 程序代码
<%

Dim url, body, myCache

url = Request.QueryString("url")

Set myCache = new cache
myCache.name = "picindex"&url
If myCache.valid Then
body = myCache.value
Else
body = GetWebData(url)
myCache.add body,dateadd("d",1,now)
End If

If Err.Number = 0 Then
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite body
Response.Flush
Else
Wscript.Echo Err.Description
End if

'取得数据
Public Function GetWebData(ByVal strUrl)
Dim curlpath
curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
Dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", strUrl, False,"",""
.setRequestHeader "Referer", curlpath
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
End Function


'cache类

class Cache
private obj 'cache内容
private expireTime '过期时间
private expireTimeName '过期时间application名
private cacheName 'cache内容application名
private path 'url

private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub

private sub class_terminate()
end sub

public property get blEmpty
'是否为空
if isempty(obj) then
blEmpty=true
else
blEmpty=false
end if
end property

public property get valid
'是否可用(过期)
if isempty(obj) or not isDate(expireTime) then
valid=false
elseif CDate(expireTime)<now then
valid=false
else
valid=true
end if
end property

public property let name(str)
'设置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property

public property let expires(tm)
'重设置过期时间
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
end property

public sub add(var,expire)
'赋值
if isempty(var) or not isDate(expire) then
exit sub
end if
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
end sub

public property get value
'取值
if isempty(obj) or not isDate(expireTime) then
value=null
elseif CDate(expireTime)<now then
value=null
else
value=obj
end if
end property

public sub makeEmpty()
'释放application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
end sub

public function equal(var2)
'比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)="Object" then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)="Variant()" then
if join(obj,"^")=join(var2,"^") then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if
end function
end class
%>


将该文件上传到服务器空间,以后在要链接的图片地址前加上 路径/163.asp?url=图片地址 ,即可正常显示图片了,还是前面的图,加上后正常了




[本日志由 ilank 于 2007-03-16 05:20 PM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 网易相册 反盗链
相关文章:

评论: 3 | 引用: 0 | 查看次数: 31945
  • 1
依风听雨 [2007-04-15 11:58 PM]
太完美了。。。。。。。我顶。。。
Jim [2007-02-12 09:41 PM]
GeniE [2007-02-11 03:19 PM]
谢谢 谢谢 终于 找到 好的 处理 办法了  
这个 对 baidu同样 有效

还有 博主你 选的 自动 填验证码有问题 ,填 的 是 错误的
  • 1
发表评论
昵 称:
密 码: 游客发言不需要密码.
验证码: 验证码
内 容:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭