html5 - set url in JavaScript for jsoup -
i want set url in javascript script use jsoup not know how.
here have tried:
<script language="javascript"> var flobject = swfobject.getflashplayerversion(); var ishtml5 = (location.search.indexof('ishtml5') != -1) ? true : false; var isdishtml5 = false; switch (true) { case navigator.useragent.indexof('firefox') > -1: isdishtml5 = true; break; case navigator.useragent.indexof('msie') > -1: isdishtml5 = true; break; } if ((!isdishtml5 && flobject.major == 0) || ishtml5) { zm('#oplayer').remove(); zm('#_htmlplayer').removeclass('none'); var html5_skin = 'skins/jplayer_01'; document.write('<link href="http://static.mp3.zdn.vn/' + html5_skin + '/css/skin.css" rel="stylesheet" type="text/css" />'); zmcore.addscript('http://static.mp3.zdn.vn/' + html5_skin + '/js/jquery.min.js', function () { zmcore.addscript('http://static.mp3.zdn.vn/' + html5_skin + '/js/jquery.jplayer.min.js', function () { $("#jquery_jplayer_1").jplayer({ ready: function () { $(this).jplayer("setmedia", { mp3: "[http://mp3.zing.vn/html5/song/lhcnypfzwanatydgkh][1]" }); $(this).jplayer("play"); }, solution: "html", supplied: "mp3" }); }); }); } </script>
in function :
$(this).jplayer("setmedia", { mp3: "[http://mp3.zing.vn/html5/song/lhcnypfzwanatydgkh][1]" }); $(this).jplayer("play");
i trying mp3: http://mp3.zing.vn/html5/song/lhcnypfzwanatydgkh
import java.util.listiterator; import java.util.regex.matcher; import java.util.regex.pattern; import javax.swing.text.html.html.tag; import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.nodes.element; import org.jsoup.select.elements; public class main { public static void main(string[] args) { try { pattern pattern = pattern.compile(".*mp3\\s*:\\s*[\"|']\\[([^\\]]+)\\].*"); string html = "<script language=\"javascript\"> var flobject = swfobject.getflashplayerversion(); var ishtml5 = (location.search.indexof('ishtml5') != -1) ? true : false; var isdishtml5 = false; switch (true) { case navigator.useragent.indexof('firefox') > -1: isdishtml5 = true; break; case navigator.useragent.indexof('msie') > -1: isdishtml5 = true; break; } if ((!isdishtml5 && flobject.major == 0) || ishtml5) { zm('#oplayer').remove(); zm('#_htmlplayer').removeclass('none'); var html5_skin = 'skins/jplayer_01'; document.write('<link href=\"http://static.mp3.zdn.vn/' + html5_skin + '/css/skin.css\" rel=\"stylesheet\" type=\"text/css\" />'); zmcore.addscript('http://static.mp3.zdn.vn/' + html5_skin + '/js/jquery.min.js', function () { zmcore.addscript('http://static.mp3.zdn.vn/' + html5_skin + '/js/jquery.jplayer.min.js', function () { $(\"#jquery_jplayer_1\").jplayer({ ready: function () { $(this).jplayer(\"setmedia\", { mp3: \"[http://mp3.zing.vn/html5/song/lhcnypfzwanatydgkh][1]\" }); $(this).jplayer(\"play\"); }, solution: \"html\", supplied: \"mp3\" }); }); }); } </script>"; document doc = jsoup.parse(html); elements elements = doc.select("script"); listiterator<element> iter = elements.listiterator(); while(iter.hasnext()) { element el = iter.next(); if(el.tagname().equalsignorecase(tag.script.tostring())) { matcher matcher = pattern.matcher(el.html()); while (matcher.find()) { system.out.println(matcher.group(1)); } } } } catch (exception e) { e.printstacktrace(); } } }
Comments
Post a Comment