function issupport(url)
    if url:match("^http://www.songtaste.com/song/%d+") then return true end
    if url:match("^http://songtaste.com/song/%d+") then return true end
    return false   
end

function normalize(s)
    s = s:gsub('\\','')
    return s
end

function analyze(url)
	print('-----------------------Enter analyze-----------------------')
	print('url:'..url)
	
    local json = require('json')
    require('common')
	--获得音乐文件id
	local id = url:match('song/(%d*)')
	print('id:'..id)

	--组合播放页面地址
	local playerurl = 'http://www.songtaste.com/playmusic.php?song_id='..id
	print('playerurl:'..playerurl)
	
	--请求播放页面
	local page1 = idown.requesturl(playerurl)
	print('page:\n'..page1)
	
	local funcall = page1:match('WrtSongLine%((".-)%);')
	print('funcall:\n'..funcall)
		
	--获取文件信息表
	local arguments = {}
	for arg in string.gfind(funcall, '%b""') do
	    argstring = string.sub(arg, 2, string.len(arg)-1)
	    table.insert(arguments, argstring)
	    print(arg)
	end
	
	--获得文件标题
	local title = normalize(arguments[2]..'-- '..arguments[3])
	local realurl = arguments[6]
	local realfilename = title..getsuffix(realurl)
	print('realfilename:'..realfilename)
	
	local result = {}
	result['realurl'] = realurl
	result['title'] = title
	result['realname'] = realfilename
	--result['agent'] = agent
	result['headers'] = {}
	result['headers']['Cookie'] = 'valid=1;'
    
	retstr = json:encode(result)
	print('ret:'..retstr)

	print('-----------------------Leave analyze-----------------------')
	return 1, retstr
end