0

我正在尝试将视频链接添加到我的 RSS 字段。

例如。

这是我想从中提取视频链接的帖子的链接:http: //topdailyfights.com/index.php/09/20/employee-goes-crazy-in-office/

我想要的链接在“video-wrap” div 类中。

<div class="video-wrap"><div class='jwplayer' id='jwplayer-0'></div><script type='text/javascript'>if(typeof(jQuery)=="function"){(function($){$.fn.fitVids=function(){}})(jQuery)};jwplayer('jwplayer-0').setup({"aspectratio":null,"width":420,"height":315,"primary":"flash","file":"http://topdailyfights.com/wp-content/uploads/2013/09/office-worker-goes-crazy.mp4"});
</script></div>

这是我想要的链接:topdailyfights.com/wp-content/uploads/2013/09/office-worker-goes-crazy.mp4

我希望链接显示在每个提要下: http: //topdailyfights.com/index.php/feed/

我该怎么做呢?

feed.php 代码(如果有帮助):pastebin.com/sfHuPETv

感谢大家!

4

1 回答 1

0

前几天我在做类似的事情时偶然发现了一门很棒的课,它叫做 simplehtmldom,你可以在这里找到

简单演示:

// Create DOM from URL
$html = file_get_html('http://slashdot.org/');

// Find all article blocks
foreach($html->find('div.article') as $article) {
    $item['title']     = $article->find('div.title', 0)->plaintext;
    $item['intro']    = $article->find('div.intro', 0)->plaintext;
    $item['details'] = $article->find('div.details', 0)->plaintext;
    $articles[] = $item;
}

print_r($articles);
于 2013-09-22T04:30:20.997 回答