class Object
Public Instance Methods
get_link_down(link)
click to toggle source
# File libs/api_mp3.rb, line 4 def get_link_down(link) if(link =~ /http:\/\/mp3.zing.vn\/bai\-hat\/(.*?).html/) html = open(link).read xml_link = html.match(/http:\/\/mp3.zing.vn\/xml\/song\-xml\/(.*?)\"/).to_s xml_link = xml_link.gsub!('"',"") source_xml = open(xml_link).read source_xml = source_xml.gsub("<![CDATA[","") source_xml = source_xml.gsub("]]>","") #source = XmlSimple.xml_in(source_xml) #source = Hash.from_xml(source_xml).to_json source = source_xml.match(/http:\/\/mp3.zing.vn\/xml\/load-song\/(.*?)\</).to_s source = source.gsub!("<","") else source = "No source code" end source end