In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how js+AJAX asynchronously collects all videos and information from Youku albums, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Code
JavaScipt AJAX & regular expression test
Function wrt (s) {
Subret.value = s + "\ n" + subret.value
/ / subret.value + = "\ n" + s
}
Var objRequest; / / define a XML request object
Var previd = "", nowid = 0pr listid = "", iscancel=false; / / other variables
Function getlid () {
Var listid = weburl.value.match (/ playlist_show\ /. * (? = id_ (\ d +)). *\ .html $/ I)
If (! listid) {
Return null
} else {
Return listid [1]
}
}
Function retweb () {
If (objRequest.readyState = = 4 & & objRequest.status = = 200) {
/ / get callback
Var webstr = objRequest.responseText
Vid = webstr.match (/ var\ s+videoId\ swords =\ s * "(\ d +)"\ s match /) [1]
Vtitle = webstr.match (/ (. +)-(. +)-Video-Youku Video-online viewing (-)? /) [2]
Wrt (nowid + ":" + vtitle + "=" + vid)
If (previd = = vid) return
Previd = vid
Nowid + = 1
/ / start a new cycle
If (iscancel) return
Tstart ()
} else {
/ / alert ("callback failed!")
Return;// "error:" + objRequest.statusText
}
}
Function getweb (u) {
ObjRequest = new XMLHttpRequest (); / / new ActiveXObject ("Msxml2.XMLHTTP"); / / IE5&6 initializes the XMLHTTP object
ObjRequest.onreadystatechange = retweb; / / Asynchronous callback method
ObjRequest.open ("GET", uJing true)
ObjRequest.send (null)
}
Function tstart () {
If (listid== "") {
Listid=getlid ()
}
Url = "http://v.youku.com/v_playlist/f" + listid +" o1p "+ nowid +" .html "
Getweb (url)
}
# star
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.