function issupport(url)
    if url:match("^http://www.yinyuetai.com/video/") then return true end
    if url:match("^http://www.yinyuetai.com/playlist/") then return true end
    return false   
end

function analyze(url)
	print('-----------------------Enter analyze-----------------------')
	print('url:'..url)
	require('idownx')
    
if url:match("^http://www.yinyuetai.com/video/") then 
    local page = idown.requesturl(url)
    local videotitle = page:match('<h1 id="videoTitle">(.-)</h1>')
    local artist = page:match('id="videoArtistName"[^>]*>([^<]*)')
	local title = videotitle..'-'..artist
	local realname = title..'.flv'
	print(idown.toansi(title))
	
	local id = url:match('video/(%d+)')
	local postdata = 'flex=true&videoId='..id
	local req = {}
	req.verb = 'POST'
	req.postdata = postdata
	
	local page = idown.requesturl('http://www.yinyuetai.com/mvplayer/get-video-info', '', idown.encode(req))
	--print(page)
	
	s,e = page:find('http://%w+.yinyuetai.com/uploads/videos/')
	print(s,e)

	len = page:byte(s-1)
	print(len)

	local realurl = page:sub(s,s+len-1)
	--local realurl = page:match('(http://hc.yinyuetai.com/.-.flv%?.-&)') or page:match('(http://flv.yinyuetai.com/.-.flv)') or page:match('(http://hcflv.yinyuetai.com/.-.flv)')
	print(realurl)
	
	local result = {}
	result['realurl'] = realurl
	result['title'] = title
	result['realname'] = realname
	result['encode'] = 65001

	retstr = idown.encode(result)
	return 1, retstr
end
if url:match("^http://www.yinyuetai.com/playlist/") then 
	local page = idown.requesturl(url)
	for id in page:gmatch('<span name="videoId">(%d+)</span>') do
		idown.addtask("http://www.yinyuetai.com/video/"..id)
	end
	local result={
	title = page:match('<meta property="og:title" content="(.-)"'),
	encode = 65001
	}
	return 200,idown.encode(result)
end
end