tudou得到真实地址
土豆API获取视频站外真实地址
privatestaticfinalStringurl="http://www.tudou.com/albumplay/T1h8y2I2RNw/J6YlFd79fIg.html";
privatestaticStringtudouApi="http://api.tudou.com/v6/video/info?app_key=c49123d3fa5838e1&format=json&itemCodes=J6YlFd79fIg";
@Override
protectedvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
newThread(newRunnable(){
@Override
publicvoidrun(){
try{
URLurl=newURL(tudouApi);
URLConnectionurlConnection=url.openConnection();
BufferedReaderreader=newBufferedReader(newInputStreamReader(
urlConnection.getInputStream()));
Stringresponse="";
while(true)
{
Stringstr=reader.readLine();
if(TextUtils.isEmpty(str))
{
break;
}
response+=str;
}
System.out.println(response);
JSONObjectjsonObject=newJSONObject(response);
//jsonObject.get("outerPlayerUrl");
JSONArrayjsonArray=jsonObject.getJSONArray("results");
jsonObject=jsonArray.getJSONObject(0);
System.out.println(jsonObject.getString("outerPlayerUrl"));
}catch(Exceptione){
//TODOAuto-generatedcatchblock
System.out.println("cuowuwuwu");
e.printStackTrace();
}
}
}).start();
}
url返回json对象
{
results:[
{
itemCode:"kbPzDzCIeBE",
title:"中国舞蹈学校惊悚入学考试外国网友惊呼好疼",
tags:"入学,舞蹈,好疼,震惊",
description:"",
picUrl:"http://i2.tdimg.com/172/902/091/p.jpg",
totalTime:281600,
pubDate:"2013-07-18",
ownerId:73083056,
ownerName:"_73083056",
ownerNickname:"铁手VII",
ownerPic:"http://u3.tdimg.com/8/217/192/99230656702592439942388589224330221858.jpg",
ownerURL:"http://www.tudou.com/home/_73083056",
channelId:29,
outerPlayerUrl:"http://www.tudou.com/v/kbPzDzCIeBE/v.swf",
playUrl:"http://www.tudou.com/programs/view/kbPzDzCIeBE/",
mediaType:"视频",
secret:false,
hdType:"2",
playTimes:285701,
commentCount:728,
bigPicUrl:"http://i2.tdimg.com/172/902/091/w.jpg",
alias:"",
downEnable:true,
location:"",
favorCount:208,
outerGPlayerUrl:"http://www.tudou.com/programs/view/html5embed.action?code=kbPzDzCIeBE"
}
]
}
http://www.tudou.com/programs/view/html5embed.action?code=J6YlFd79fIg&autoPlay=true