1

私は SimplePie を使用して、オーディオとビデオの両方の毎週の説教を含む教会の RSS フィードを解析しています。タイトルと mp3 のリンクは取得できますが、YouTube のリンクを取得するのに苦労しています。以下は、YouTube ビデオを含む XML フィードの内容のサンプルです。

使っている[CDATA]

を使用し$item->get_content()ていますが、以下のタグ データが含まれていないようです。フィードの URL はhttp://lakeforest.org/feedです。この URL をブラウザに表示すると、埋め込まれた YouTube ビデオが表示されます。

どんな助けでも大歓迎です。

注: - 表示のみのために以下の html にコメントを付けました

<!--
<description><![CDATA[Huntersville Campus Mike Moses, Lead Pastor Series Discussion Questions: SHAPE, Part 2 Spiritual Gifts Inventory VIDEO AUDIO]]></description>
                <content:encoded><![CDATA[<h3>Huntersville Campus</h3>
<p>Mike Moses, Lead Pastor<br />
<a href="http://lakeforest.org/wp-content/uploads/2013/01/SDQ_SHAPEPt2.pdf">Series Discussion Questions: SHAPE, Part 2</a><br />
<a href="http://www.churchgrowth.org/cgi-cg/gifts.cgi?intro=1 <http://www.churchgrowth.org/cgi-cg/gifts.cgi?intro=1" target="_blank">Spiritual Gifts Inventory</a></p>
<h4>VIDEO</h4>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/4Uv8U8c6isg" frameborder="0" allowfullscreen></iframe></p>
<h4>AUDIO</h4>
<img src="http://feeds.feedburner.com/~r/LakeForest/~4/qMoLVpI1tGI" height="1" width="1"/>]]>  -->
4

2 に答える 2

1

SimplePieは、危険な可能性があるため、デフォルトembedobjectiframeなどのタグを取り除きます。

ビデオを元に戻したい場合は無視する必要がありますが、セキュリティ上の問題になる可能性があるため、ソース URL には注意してください。

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');

// Remove these tags from the list
$strip_htmltags = $feed->strip_htmltags;
array_splice($strip_htmltags, array_search('object', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('param', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('embed', $strip_htmltags), 1);
array_splice($strip_htmltags, array_search('iframe', $strip_htmltags), 1);

$feed->strip_htmltags($strip_htmltags);

ソース

于 2013-10-16T09:28:28.210 に答える