检查网页是否繁忙?

时间:2014-02-16 17:53:25

标签: html r httr

我编写了一个脚本来从站点中提取某些信息,代码运行正常,但速度非常慢(我编译了函数并启用了JIT),如何检查延迟是否是由于网页流量造成的?任何帮助将不胜感激

url = "http://www.currys.co.uk/gbuk/computing-accessories/accessories-and-bags/power-       cables/power-cables-adaptors/masterplug-bfg2-mp-4-gang-extension-cable-2m-00852134-pdt.html?    srcid=369&xtor=AL-1&cmpid=aff~!!!sitenamecm!!!~!!!promotypecm!!!~Computing+Accessorie"

getpagedata = function (url, uniq_id)

{
  srcpage = getURLContent(parenturl)
  page = htmlTreeParse(srcpage,useInternalNodes = T,encoding='UTF-8')    
  link = '0' 
  availability = xpathSApply(page, "//span[@class ='available']",xmlValue)

 if (length(availability) > 0 )
 {
   if (length(availability_option) > 0) 
   {   
         availability_option = paste0(toString(str_replace_all(availability_option,"\n|\t","")),",")
   }
availability = paste0("'",availability_option,toString(str_replace_all         (availability,"\n|\t","")),"'")
}

df2 = data.frame(starttime,Sys.time(),store,uniq_id,Avail_Flag,availability,link)
writetofile_c(df2)
free(page)
}

谢谢,

0 个答案:

没有答案