Note that there are some explanatory texts on larger screens.

plurals
  1. POParse youtube rss feed
    primarykey
    data
    text
    <p>i have xml with all videos from channel on youtube and have no idea how to parse it</p> <p>Link is <a href="http://gdata.youtube.com/feeds/base/users/vrelegume/uploads?alt=rss&amp;orderby=published" rel="nofollow">http://gdata.youtube.com/feeds/base/users/vrelegume/uploads?alt=rss&amp;orderby=published</a></p> <p>My current code in Zend framework is:</p> <pre><code> public function videoAction () { // XML-related routine $xml = new DOMDocument('1.0', 'utf-8'); $content = $xml-&gt;appendChild( $xml-&gt;createElement('content')); $terms = urlencode('php 5 xml new'); $url = 'Link is http://gdata.youtube.com/feeds/base/users/vrelegume/uploads?alt=rss&amp;orderby=published'; $query = $terms; $serviceurl = $url . $query; $dom = new DomDocument(); $dom-&gt;load("$url"); $i = 0; foreach ($dom-&gt;documentElement-&gt;childNodes as $articles) { if ($i&lt;10) { if ($articles-&gt;nodeType == 1) { $itemXML = $content-&gt;appendChild($xml-&gt;createElement('item')); foreach ($articles-&gt;childNodes as $item) { $itemXML-&gt;appendChild($xml-&gt;createElement($item-&gt;nodeName, $item-&gt;textContent)); } } } $i ++; } $output = $xml-&gt;saveXML(); // Both layout and view renderer should be disabled Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')-&gt;setNoRender(true); Zend_Layout::getMvcInstance()-&gt;disableLayout(); // Set up headers and body $this-&gt;_response-&gt;setHeader('Content-Type','text/xml; charset=utf-8')-&gt;setBody($output); } </code></pre> <p>How to get xml like:</p> <pre><code> &lt;item&gt; &lt;title&gt;First video&lt;/title&gt; &lt;link&gt;http://www.youtube.com/watch?v=aZ6LrEvj2o0&lt;/link&gt; &lt;thumb&gt;*.jpg&lt;/thumb&gt; &lt;/item&gt; &lt;item&gt; &lt;title&gt;Second video&lt;/title&gt; &lt;link&gt;...&lt;/link&gt; &lt;thumb&gt;*.jpg&lt;/thumb&gt; &lt;/item&gt; . . . </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload