sencha-touch中通过JsonP来获取优酷数据~

使用优酷api请求数据,原url如:https://openapi.youku.com/v2/searches/show/top_unite.json?_dc=1393066615798&client_id=753b1d1e778c3dca&category=电视剧&genre=1007&area=1001&year=2014&orderby=1&headnum=1&tailnum=1&onesiteflag=0&page=1&count=20,在sencha-touch中向优酷服务器发送请求获取数据,用ajax时出现了错误,故改成如下的方法(已认证可用~):

Ext.data.JsonP.request({

url : ' https://openapi.youku.com/v2/searches/show/top_unite.json',
method : ' get',
callbackKey : 'callback',
params : {
client_id : this.getClient_ID(),
category : '电视剧',
genre : 1007,
area : 1001,
year : 2014,
orderby : 1,
headnum : 1,
tailnum : 1,
onesiteflag : 0,
page : 1,
count : 20,

},
success : function(result, request) {
    alert( result.data[0].director);
  },
  failure : function(result, request) {
     alert("error");
  }

});

服务器返回的数据如:



e: - {
provider"searches.soku.top",
code0,
desc"OK"
},
total5,
cost11,
data: - [
-{
preSize45,
programmeId277932,
name"隋唐英雄3",
director: - [
"李翰韬"
],
performer: - [
"郑国霖",
"张卫健",
"刘晓庆"
],
host:[],
singer:[],
genre: - [
"剧情",
"历史",
"古装"
],
area: - [
"大陆"
],
score6.705999851226807,
vpic"http://g3.ykimg.com/0516000051B03E996758394ABB0C0E34",
pic"http://g3.ykimg.com/050B000051B03E83675839362B0AE8F2",
brief"玄武门之变后,李世民登上皇位,但隋朝的残余势力和十八反王留下来的军队仍在北漠兴风作浪,危害百姓。罗通、程铁牛、秦怀玉等一批小将已长大成人,罗通夺得帅位,率领唐军出征,扫平了北漠。此时渤辽国又兴兵攻唐,程咬金挂帅,在龙门县招兵,薛仁贵泪别柳金花去当兵,军营中,薛仁贵被人冒功,只当了个火头军,但他没有放弃,凭着一身本领,屡立战功,终于得到程咬金的赏识,被程咬金举荐为先锋大将,薛仁贵率领唐军平定了渤辽国。柳金花在寒窑中苦等丈夫十年,薛仁贵功成之后,不忘糟糠之妻,回龙门与妻儿相会。同时,李世民在魏征、长孙无忌等贤臣的辅佐下,励精图治,开创了贞观盛世。",
subtitle"黄海冰郑国霖续兄弟情",
playurl"http://tv.sohu.com/20140129/n394357587.shtml",
trailerUrl"http://v.youku.com/v_show/id_XNjYyOTAwMzAw.html",
hd0,
displaystatus"更新至58集",
paid0,
totalvv243462,
detailUrlYouku"http://www.youku.com/show_page/id_z9c1676a2b91e11e2a19e.html",
detailUrlSoku"/detail/show/XMTExMTcyOA==",
releaseDate"2014-00-00",
releaseYear"2014",
completed0,
animeEdition"0",
zhengPian"b,c",
haveMinorListtrue,
queryCount91705,
programmeSite: - [
-{
pre" ",
siteId6,
hd0,
episodeCollected58,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3第1集",
url"http://tv.sohu.com/20140129/n394357587.shtml",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3第58集",
url"http://tv.sohu.com/20140222/n395464374.shtml?txid=8254069965286abe9ee523a73c256ea7",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},

]
}
]
这样运行程序,提示框显示的为:  李翰韬

e: - {
provider"searches.soku.top",
code0,
desc"OK"
},
total5,
cost11,
data: - [
-{
preSize45,
programmeId277932,
name"隋唐英雄3",
director: - [
"李翰韬"
],
performer: - [
"郑国霖",
"张卫健",
"刘晓庆"
],
host:[],
singer:[],
genre: - [
"剧情",
"历史",
"古装"
],
area: - [
"大陆"
],
score6.705999851226807,
vpic"http://g3.ykimg.com/0516000051B03E996758394ABB0C0E34",
pic"http://g3.ykimg.com/050B000051B03E83675839362B0AE8F2",
brief"玄武门之变后,李世民登上皇位,但隋朝的残余势力和十八反王留下来的军队仍在北漠兴风作浪,危害百姓。罗通、程铁牛、秦怀玉等一批小将已长大成人,罗通夺得帅位,率领唐军出征,扫平了北漠。此时渤辽国又兴兵攻唐,程咬金挂帅,在龙门县招兵,薛仁贵泪别柳金花去当兵,军营中,薛仁贵被人冒功,只当了个火头军,但他没有放弃,凭着一身本领,屡立战功,终于得到程咬金的赏识,被程咬金举荐为先锋大将,薛仁贵率领唐军平定了渤辽国。柳金花在寒窑中苦等丈夫十年,薛仁贵功成之后,不忘糟糠之妻,回龙门与妻儿相会。同时,李世民在魏征、长孙无忌等贤臣的辅佐下,励精图治,开创了贞观盛世。",
subtitle"黄海冰郑国霖续兄弟情",
playurl"http://tv.sohu.com/20140129/n394357587.shtml",
trailerUrl"http://v.youku.com/v_show/id_XNjYyOTAwMzAw.html",
hd0,
displaystatus"更新至58集",
paid0,
totalvv243462,
detailUrlYouku"http://www.youku.com/show_page/id_z9c1676a2b91e11e2a19e.html",
detailUrlSoku"/detail/show/XMTExMTcyOA==",
releaseDate"2014-00-00",
releaseYear"2014",
completed0,
animeEdition"0",
zhengPian"b,c",
haveMinorListtrue,
queryCount91705,
programmeSite: - [
-{
pre" ",
siteId6,
hd0,
episodeCollected58,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3第1集",
url"http://tv.sohu.com/20140129/n394357587.shtml",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3第58集",
url"http://tv.sohu.com/20140222/n395464374.shtml?txid=8254069965286abe9ee523a73c256ea7",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},
-{
pre" ",
siteId17,
hd0,
episodeCollected58,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3 01",
url"http://www.letv.com/ptv/vplay/2252104.html",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3 58",
url"http://www.letv.com/ptv/vplay/2270883.html",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},
-{
pre" ",
siteId19,
hd0,
episodeCollected58,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3第1集",
url"http://www.iqiyi.com/v_19rrgyogws.html",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3第58集",
url"http://www.iqiyi.com/v_19rrgxpc4o.html",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},
-{
pre" ",
siteId130,
hd0,
episodeCollected58,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3 第1集",
url"http://www.funshion.com/vplay/m-111671.e-1",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3 第58集",
url"http://www.funshion.com/vplay/m-111671.e-58",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},
-{
pre" ",
siteId27,
hd0,
episodeCollected57,
displaystatus"更新至58集",
episode: - [
-{
pre" ",
name"隋唐英雄3 TV版 第01集",
url"http://v.qq.com/cover/2/2hwvjmmzfubodxt/t0013zvqdwo.html",
orderStage1,
lastUpdate1392480000,
tagType0
},
-{
pre" ",
name"隋唐英雄3 第58集",
url"http://v.qq.com/cover/2/2hwvjmmzfubodxt/v0013qscvd2.html",
orderStage58,
lastUpdate1392998400,
tagType1
}
]
},
-{
pre" ",
siteId3,
hd0,
episodeCollected49,
displaystatus"更新至49集",
episode: - [
-{
pre" ",
name"1",
url"http://video.sina.com.cn/m/201401160532608_63448691.html",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"49",
url"http://video.sina.com.cn/m/201401160532608_63525917.html",
orderStage49,
lastUpdate1392912000,
tagType1
}
]
},
-{
pre" ",
siteId131,
hd0,
episodeCollected49,
displaystatus"更新至49集",
episode: - [
-{
pre" ",
name"隋唐英雄3 第1集",
url"http://www.wasu.cn/Play/show/id/2134923?refer=www.soku.com",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄3 第49集",
url"http://www.wasu.cn/Play/show/id/2192523?refer=www.soku.com",
orderStage49,
lastUpdate1392912000,
tagType1
}
]
},
-{
pre" ",
siteId83,
hd0,
episodeCollected46,
displaystatus"更新至49集",
episode: - [
-{
pre" ",
name"隋唐英雄III臻高清-01",
url"http://v.pps.tv/play_3C456X.html#from_soku",
orderStage1,
lastUpdate1390924800,
tagType0
},
-{
pre" ",
name"隋唐英雄III超清版-49",
url"http://v.pps.tv/play_3CNNDI.html#from_soku",
orderStage49,
lastUpdate1392912000,
tagType1
}
]
}
]
},

你可能感兴趣的:(sencha-touch中通过JsonP来获取优酷数据~)