我想提取
iframe标记来自以下网址的“src”值 http://www.teluguone.com/videos/single/comedy/Comedy-Express-464---Back-to-Back---Comedy-Scenes-14727.html
iframe width =“640”height =“380”src =“http://www.youtube.com/embed/XJDw2T1nGJQ”frameborder =“0”
的allowFullScreen / iframe中
我怎样才能在j2me中实现它?j2me不支持htmlparser,Jericho,Jsoup解析器
答案 0 :(得分:1)
假设您已将html源存储在名为htmlPage的String
变量中。
int iFrameIndex = htmlPage.indexOf("iframe");
int srcIndex = htmlPage.indexOf("src", iFrameIndex);
int httpIndex = htmlPage.indexOf("http", srcIndex);
int quotesIndex = htmlPage.indexOf("\"", httpIndex);
String srcUrl = htmlPage.substring(httpIndex, quotesIndex);