【问题标题】:filtering src attribute of iframe in ios在ios中过滤iframe的src属性
【发布时间】:2013-06-28 06:45:50
【问题描述】:

我有一个网站,允许用户使用标签嵌入他们的视频,例如。

<iframe width="560" height="315" src="http://www.youtube.com/embed/se2P7hjPanE" frameborder="0" allowfullscreen></iframe>

实际上这个 iframe 字符串来自像这样的服务

    <br />
 \n&lt;iframe width=&quot;560&quot; height=&quot;314&#39;&#39;
   src=&quot;http://www.youtube.com/embed/se2P7hjPanE&quot; frameborder=&quot;0&quot; 
  allowfullscreen&gt;&lt;/iframe&gt;

我怎样才能得到我的原始 iframe 字符串如何解析 src 值,也可能是其他值来加载视频实际上我使用了 MWfeedparser(https://github.com/mwaterfall/MWFeedParser) 但我不是这样

     <iframe width="560" height="314'' src="http://www.youtube.com/embed/se2P7hjPanE" frameborder="0" allowfullscreen></iframe>

在高度属性之后我得到了 (' ') 而不是 "

我该如何解决这个问题

我想从上面的帧中获取 src 值我想在 iphone 的 webview 中播放该视频

所以我想在我的 iphone 中播放那个特定的视频(客户上传的)。

【问题讨论】:

    标签: iphone iframe filter src


    【解决方案1】:

    示例代码:

    NSString *myString = @"&lt;iframe width=&quot;560&quot; height=&quot;314&#39;&#39; src=&quot;http://www.youtube.com&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;";
    NSRange firstRange = [myString rangeOfString:@"http://"];
    NSRange secondRange = [[myString substringFromIndex:firstRange.location] rangeOfString:@"&quot;"];
    NSRange finalRange = NSMakeRange(firstRange.location, secondRange.location);
    NSString *subString = [myString substringWithRange:finalRange];
    NSLog(@"subString :: %@",subString);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-03
      • 2011-11-24
      相关资源
      最近更新 更多