查看: 1284|回复: 2

优酷一键采集 测试

[复制链接]

该用户从未签到

鲜花(0) 鸡蛋(0)
发表于 2012-5-17 11:00 | 显示全部楼层 |阅读模式














看看采集后的视频能用多长时不过期啊 美中不足,就是当采集和单首增加同时用,列表就排得乱七八糟 看以后有时间能不能再改善 asp版 采集程序开源,是否有朋友能转换成php版 如能记的发我参照一下为谢。 测试方法的地址;http://www.flashcs5as3.com/bfs/代理程序/youku采集.asp?id=http://v.youku.com/v_show/id_XMzc1MjIxODI0.html
  1. <%
  2. '说明 当 输入url目标网页地址,返回值getHTTPPage是目标网页的html代码
  3. '跟随当前的 html代码 中找到相关的信息
  4. '---------------------------------加载html代码 URL网址数据--------------------
  5. function getHTTPPage(url) '定义函数
  6. dim Http '定义变量http
  7. set Http=server.createobject("MSXML2.XMLHTTP")'建立XMLHTTP对象
  8. Http.open "GET",url,false '设置http对象打开方式 GET方式, URL 连接页面地址,同步处理
  9. Http.send() '发送请求
  10. if Http.readystate<>4 then '对象处理状态为 非结束
  11. exit function '退出函数
  12. end if
  13. getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8") '接收数据并转换 文本格式 utf-8 也可以用 GB2312
  14. set http=nothing
  15. if err.number<>0 then err.Clear '错误代码非0则出错 清除错误
  16. end function ''退出定义函数
  17. '------------------------------------转换html代码数据---------------------------
  18. '转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换
  19. Function BytesToBstr(body,Cset)
  20. dim objstream
  21. set objstream = Server.CreateObject("adodb.stream")
  22. objstream.Type = 1
  23. objstream.Mode =3
  24. objstream.Open
  25. objstream.Write body
  26. objstream.Position = 0
  27. objstream.Type = 2
  28. objstream.Charset = Cset
  29. BytesToBstr = objstream.ReadText
  30. objstream.Close
  31. set objstream = nothing
  32. End Function
  33. '------------------------------------强制数据----------------------------------
  34. '强制函数相 当无法得到 html代码时
  35. '进行强制性来得到 url目标网页地址所有的代码
  36. Function GetKey(HTML,Start,Last)
  37. Dim filearray,filearray2
  38. filearray=split(lcase(HTML),lcase(Start))
  39. filearray2=split(lcase(filearray(1)),lcase(Last))
  40. GetKey=filearray2(0)
  41. End Function
  42. '------------------------------------输入url网页地址---------------------------
  43. '连接 ID 的信息
  44. Dim Url,Html '定义2个变量 Url Html
  45. Url=request.querystring("id")'设为 ?id= 后面的网址信息
  46. Html = getHTTPPage(Url)
  47. '输出当前要采集的 标题名称
  48. 'Response.write "当前采集的的标题名是:"&GetKey(Html,"<title>","</title>")
  49. '--------------------------防止别的域名连接使用-------------------
  50. 'dim iphtmlUrl,strURid,aryReturnm
  51. 'iphtmlUrl ="http://"&Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")
  52. 'strURid = iphtmlUrl 'http://www.flashcs5as3.com/bfs/代理程序/
  53. 'aryReturnm = Split(strURid,"flashcs5as3")
  54. 'if aryReturnm then
  55. ' call ponseList1()
  56. 'else
  57. 'call ponseList2()
  58. 'end if
  59. 'sub ponseList1()
  60. 'response.Redirect("http://www.flashcs5as3.com")
  61. 'end sub
  62. 'sub ponseList2()
  63. 'response.Redirect("ok本站使用")
  64. 'end sub
  65. '----------------------------------生成xml 数据-------------------
  66. dim body,jmStr,tvName,tvTitle
  67. dim i
  68. flag = instr(Html,"<ul class=""pack_number"">")'设置 flag 变量名 从html代码中到到相关的位置 开始位置
  69. jmStr = mid(Html,flag,instr(flag,Html,"</ul>")-flag)'结束的位置
  70. 'response.write(jmStr)' '输出相关内容
  71. bfsxml = bfsxml & "<?xml version='1.0' encoding='gb2312'?>" & vbcrlf &"<list>" &""'设置XML 的编码 方便FLASH中读入
  72. a = 0
  73. for i = 1 to len(jmStr)'进行计算 输出 XML 的ID
  74. if mid(jmStr,i,3) = "d=""" then
  75. tvName = mid(jmStr,i+3,instr(i+3,jmStr,""">")-i-3)
  76. Session("tvTitle") = Session("tvTitle") & tvName & vbcrlf
  77. a = a + 1
  78. bfsxml = bfsxml & "<m label=""" & tvName & """ />" & vbcrlf
  79. 'bfsxml = bfsxml & "<m> "&"<n>""" & tvName & """ <n> "&"<m/>" & vbcrlf
  80. end if
  81. next
  82. bfsxml = bfsxml & vbcrlf & "</list>"
  83. response.write(bfsxml)'输出bfsxml 输出播放器需要加载的XML
  84. %>
复制代码

该用户从未签到

鲜花(0) 鸡蛋(0)
发表于 2012-5-17 13:13 | 显示全部楼层
啊城的作品一定是高难新颖的。辛苦了

签到天数: 54 天

[LV.5]常住居民I

鲜花(5) 鸡蛋(0)
发表于 2012-5-18 14:36 | 显示全部楼层
阿城是代码达人啊,我看到这一堆代码就头大,哈哈!强人!{:soso_e179:}
您需要登录后才可以回帖 登录 | 中文注册

本版积分规则

网站地图|小黑屋|Archiver|中画网 ( 蜀ICP备11021737号-2 )|网站地图

GMT+8, 2024-9-28 07:22 , Processed in 0.049152 second(s), 13 queries , MemCached On.

上网要文明 发言要理性

Powered by Discuz! © 2008-2023 YinHuaBBS.CN

快速回复 返回顶部 返回列表