将视频链接字段添加到RSS

时间:2013-09-22 04:22:12

标签: php xml wordpress rss

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

例如。

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

我想要的链接是“视频包装”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

我想要在每个Feed下显示链接:http://topdailyfights.com/index.php/feed/

我该怎么做?

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

谢谢大家!

1 个答案:

答案 0 :(得分:0)

前几天我偶然发现了一个伟大的课程,当时我正在做类似的事情,它叫做simplehtmldom,你可以得到它here

简单演示:

// 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);
相关问题