該用戶從未簽到  鮮花( 0)  雞蛋( 0)
|
看看采集后的視頻能用多長時不過期啊
美中不足,就是當采集和單首增加同時用,列表就排得亂七八糟
看以后有時間能不能再改善
asp版 采集程序開源,是否有朋友能轉(zhuǎn)換成php版 如能記的發(fā)我參照一下為謝。
測試方法的地址;http://www.flashcs5as3.com/bfs/代理程序/youku采集.asp?id=http://v.youku.com/v_show/id_XMzc1MjIxODI0.html-
- <%
- '說明 當 輸入url目標網(wǎng)頁地址,返回值getHTTPPage是目標網(wǎng)頁的html代碼
- '跟隨當前的 html代碼 中找到相關(guān)的信息
- '---------------------------------加載html代碼 URL網(wǎng)址數(shù)據(jù)--------------------
- function getHTTPPage(url) '定義函數(shù)
- dim Http '定義變量http
- set Http=server.createobject("MSXML2.XMLHTTP")'建立XMLHTTP對象
- Http.open "GET",url,false '設(shè)置http對象打開方式 GET方式, URL 連接頁面地址,同步處理
- Http.send() '發(fā)送請求
- if Http.readystate<>4 then '對象處理狀態(tài)為 非結(jié)束
- exit function '退出函數(shù)
- end if
- getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8") '接收數(shù)據(jù)并轉(zhuǎn)換 文本格式 utf-8 也可以用 GB2312
- set http=nothing
- if err.number<>0 then err.Clear '錯誤代碼非0則出錯 清除錯誤
- end function ''退出定義函數(shù)
- '------------------------------------轉(zhuǎn)換html代碼數(shù)據(jù)---------------------------
- '轉(zhuǎn)換亂瑪,直接用xmlhttp調(diào)用有中文字符的網(wǎng)頁得到的將是亂瑪,可以通過adodb.stream組件進行轉(zhuǎn)換
- Function BytesToBstr(body,Cset)
- dim objstream
- set objstream = Server.CreateObject("adodb.stream")
- objstream.Type = 1
- objstream.Mode =3
- objstream.Open
- objstream.Write body
- objstream.Position = 0
- objstream.Type = 2
- objstream.Charset = Cset
- BytesToBstr = objstream.ReadText
- objstream.Close
- set objstream = nothing
- End Function
- '------------------------------------強制數(shù)據(jù)----------------------------------
- '強制函數(shù)相 當無法得到 html代碼時
- '進行強制性來得到 url目標網(wǎng)頁地址所有的代碼
- Function GetKey(HTML,Start,Last)
- Dim filearray,filearray2
- filearray=split(lcase(HTML),lcase(Start))
- filearray2=split(lcase(filearray(1)),lcase(Last))
- GetKey=filearray2(0)
- End Function
-
- '------------------------------------輸入url網(wǎng)頁地址---------------------------
- '連接 ID 的信息
- Dim Url,Html '定義2個變量 Url Html
- Url=request.querystring("id")'設(shè)為 ?id= 后面的網(wǎng)址信息
- Html = getHTTPPage(Url)
- '輸出當前要采集的 標題名稱
- 'Response.write "當前采集的的標題名是:"&GetKey(Html,"<title>","</title>")
-
-
- '--------------------------防止別的域名連接使用-------------------
- 'dim iphtmlUrl,strURid,aryReturnm
- 'iphtmlUrl ="http://"&Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")
- 'strURid = iphtmlUrl 'http://www.flashcs5as3.com/bfs/代理程序/
- 'aryReturnm = Split(strURid,"flashcs5as3")
- 'if aryReturnm then
- ' call ponseList1()
- 'else
- 'call ponseList2()
- 'end if
-
- 'sub ponseList1()
- 'response.Redirect("http://www.flashcs5as3.com")
- 'end sub
-
- 'sub ponseList2()
- 'response.Redirect("ok本站使用")
- 'end sub
-
- '----------------------------------生成xml 數(shù)據(jù)-------------------
- dim body,jmStr,tvName,tvTitle
- dim i
- flag = instr(Html,"<ul class=""pack_number"">")'設(shè)置 flag 變量名 從html代碼中到到相關(guān)的位置 開始位置
- jmStr = mid(Html,flag,instr(flag,Html,"</ul>")-flag)'結(jié)束的位置
- 'response.write(jmStr)' '輸出相關(guān)內(nèi)容
- bfsxml = bfsxml & "<?xml version='1.0' encoding='gb2312'?>" & vbcrlf &"<list>" &""'設(shè)置XML 的編碼 方便FLASH中讀入
- a = 0
- for i = 1 to len(jmStr)'進行計算 輸出 XML 的ID
- if mid(jmStr,i,3) = "d=""" then
- tvName = mid(jmStr,i+3,instr(i+3,jmStr,""">")-i-3)
- Session("tvTitle") = Session("tvTitle") & tvName & vbcrlf
- a = a + 1
- bfsxml = bfsxml & "<m label=""" & tvName & """ />" & vbcrlf
- 'bfsxml = bfsxml & "<m> "&"<n>""" & tvName & """ <n> "&"<m/>" & vbcrlf
- end if
- next
- bfsxml = bfsxml & vbcrlf & "</list>"
- response.write(bfsxml)'輸出bfsxml 輸出播放器需要加載的XML
- %>
復制代碼 |
|