从页面html android获取网址

时间:2014-03-01 19:09:00

标签: android html regex

我想在此页面中提取两个网址html:

http://paste.ubuntu.com/7017703 /

主页:

http:// www.clip2ni.com/05/Video-Section/Iranian/download-funny-hassan-rhubarb-concert-at-milad-tower

(这里发布它似乎太长了,因为它有数千行代码)。

我想要的两个网址:

  

http:// dl.clip2ni.com/m/VIDEO/92-11/3GP/consert25tir-milad.3gp

     

http:// dl.clip2ni.com/m/VIDEO/92-11/MP4/consert25tir-milad.mp4

RegEx可能吗?怎么样 ? Jsoup可能吗?怎么样?

The best Hidden camera

1 个答案:

答案 0 :(得分:0)

假设您的网址内没有任何空间:

String input = "http://dl.clip2ni.com/m/VIDEO/92-11/3GP/consert25tir-milad.3gp asdas http://dl.clip2ni.com/m/VIDEO/92-11/MP4/consert25tir-milad.mp4";
Pattern pattern = Pattern.compile("(https?://\\s*\\S+\\.(?:3gp|mp4))");    Matcher m = pattern.matcher(input);
while(m.find()) {
  System.out.println(m.group(1));
}
相关问题