xml - Retrieve image in RSS feed description with jQuery -


<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">     <channel>         <description/>         <title>example</title>         <link>http://example.com/</link>         <item>             <title>               post title             </title>             <description>                 <div class="thumbnail"><a href="#"><img src="https://i.imgur.com/192384.jpg"/> </a></div> <p class="intro"><span> lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> <!-- more --> <span> duis end </h3> <img src="http://i.imgur.com/wq8fu.png"/><div class="credit"> clas henrik </div> </span></p>             </description>          </item>      </channel> </rss> 

how retrieve first image in rss <description>, 1 wrapped in <div class="thumbnail">?
using jquery , i've managed read whole description block code:

var rssurl = 'http://example.com/rss'; $.get(rssurl, function(data) {     var $xml = $(data);     var vari = 0;     $xml.find("item").each(function() {         var $this = $(this),           item = {             description: $this.find("description").text()           }      }); }); 

but want image. since it's in text can't select $('.thumbnail > > img);

...
edit: reformatted question

managed retrieve first image through this: description: $this.find("description").text().substring(0, 200).match("<img src(.*)/>")


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -