asp提取媒体文件并清理播放器代码
作者:admin 日期:2007-11-08
'进行多媒体对象检测
'提取媒体文件,清理播放器
Function CheckMedia(Content)
Dim oregExp,oRegExp1,oMatch,Matches,oMatch1,Matches1
Dim sFiles1,sFiles2,sFile
sFiles="swf,mp3,rm,ram,rmvb,mp4,wma,wav,avi"
Set oregExp = New Regexp
oRegExp.IgnoreCase = True
oRegExp.Global = True
Set oregExp1 = New Regexp
oRegExp1.IgnoreCase = True
oRegExp1.Global = True
'媒体文件
oRegExp.pattern ="<object.+?>"
Set Matches=oRegExp.Execute(Content)
For Each oMatch In Matches
oRegExp1.pattern="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
Set Matches1=oRegExp.Execute(oMatch.Value)
For Each oMathch1 In Matches1
'只取媒体文件
sFile=Split(oMathch1.value,".")
If InStr(sFiles1,sFile(UBound(sFile)))>0 Then
strFiles2="<a href=""" & oMathch1.value & """ target=""_blank"">" & oMathch1.value & "</a><br>"
End If
Next
Next
'清空
oRegExp.pattern ="<object.+?/object>"
Content=oRegExp1.replace(Content,"")
oRegExp.pattern ="<em.+?>"
Set Matches=oRegExp.Execute(Content)
For Each oMatch In Matches
oRegExp1.pattern="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
Set Matches1=oRegExp.Execute(oMatch.Value)
For Each oMathch1 In Matches1
'只取媒体文件
sFile=Split(oMathch1.value,".")
If InStr(sFiles1,sFile(UBound(sFile)))>0 Then
strFiles2="<a href=""" & oMathch1.value & """ target=""_blank"">" & oMathch1.value & "</a><br>"
End If
Next
Next
oRegExp.pattern ="<em.+?/em>"
Content=oRegExp1.replace(Content,"")
Set oregExp1=othing
Set oregExp2=othing
End Function
广告位