1. 程式人生 > 其它 >iApp獲取ANHK網頁原始碼

iApp獲取ANHK網頁原始碼

所需控制元件

  • 瀏覽器 ID1
  • 文字 ID2

載入事件

//瀏覽器控制元件ID
s id1=1
//文字控制元件ID
s id2=2
hsas(id1,true)
t()
{
  s url="http://oyp.anhk.cn/test/demo8.6/a.php"
  s post=null
  //獲取的原始碼將賦值到sss.ym,響應事件與id文字控制元件的文字更新監聽事件繫結
  fn getcode.get(url,post,id2)
  ssj(id2,"ontextchanged")
  {
    syso(sss.ym)
  }
}

getcode.myu

fn cookie(url,post,cookie,id)
t()
{
  f(post=="")
  {
    s post=null
  }
  syso("正在獲取")
  hs(url,post,"utf-8",cookie,ym)
  sss ym=ym
  ufnsui()
  {
    time(4,tt)
    sran(1,10000,uu)
    ss(tt+uu,vv)
    us(id,"text",vv)
    syso("獲取完成")
  }
}
end fn

fn get(url,post,id)
syso("準備獲取")
hs(url,ym)
sr(ym,"/aes.js","file:///storage/emulated/0/iApp/%E9%A1%B9%E7%9B%AE/com.oyp.test/files/aes.js",ym)
sr(ym,"document.cookie=","var cookie=",ym)
ss("iapp.fn('getcode.cookie(\""+url+"\"\,\""+post+"\"\,\"'\+cookie\+'\"\,"+id+")');var oyp=",hh)
sr(ym,"location.href=",hh,ym)
ufnsui()
{
  us(1,"url",ym,"utf-8","text/html",f)
}
end fn