function issupport(url)
    if url:match("^http://video.sina.com.cn/") then return true end
    if url:match("^http://video.*.sina.com.cn/") then return true end
    if url:match("^http://.*.video.sina.com.cn/") then return true end
    return false   
end

function analyze(url)
json = require('json')
require('common')

print('---------------enter analyze---------------')
print('url:'..url)
--´ò¿ªÍøÒ³
page1=idown.requesturl(url,'','')
--print('page1:\n'..page1)

id = page1:match("vid :'([^']*)'") or page1:match("vid:'(.-)'")
url2='http://v.iask.com/v_play.php?vid='..id
page2=idown.requesturl(url2,'','')
print('page2:\n'..page2)

realurl = ''
for match in page2:gmatch("<url><!%[CDATA%[(.-)%]%]></url>") do
	realurl = realurl..match..'\n'
end
realurl = realurl:gsub('\n$','')
realname = string.match(page2,"<vname><!%[CDATA%[(.-)%]%]></vname>")
print(idown.toansi(realname))

realname =realname..getsuffix(realurl)
realfilename=realname
result = {}
result['realurl'] = realurl
result['title'] = realname
result['realname'] = realfilename
result['encode'] = 65001
retstr = json:encode(result)
print('ret:'..retstr)

print('-----------------------leave analyze-----------------------')

return 1, retstr
end

