Quantcast
Channel: Extracting images from RSS/Atom feeds - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Extracting images from RSS/Atom feeds

$
0
0

I'm wondering how to extract images from RSS and Atom feeds so I can use them as a thumbnail when display the feed in a container with it's relative Title, Description and Link. So far my code, (shown below), grabs images from only certain feed types, I'm wondering how I can grab every image my script comes across.

if (feed_image_type == "description") {    item_img = $($(this).find('description').text()).find("img").attr("src");} else if (feed_image_type == "encoded") {    item_img = $($(this).find('encoded').text()).find("img").attr("src");} else if (feed_image_type == "thumbnail") {    item_img = $(this).find('thumbnail').attr('url');} else {    item_img = $(this).find('enclosure').attr('url');}

For example, I cannot figure out how I would grab the image link from the code rss feed snippet below:

<description><![CDATA[<img src="https://i.kinja-img.com/gawker-media/image/upload/s--E93LuLOd--/c_fit,fl_progressive,q_80,w_636/hd6cujrvf1d72sbxsbnr.jpg" /><p>With a surprise showing of skill and, at one point, a miracle, the bottom-ranked team in the European <em>League </em>Championship Series will not end the summer winless.<br></p><p><a href="http://compete.kotaku.com/european-league-team-finally-wins-its-first-series-of-t-1797363638">Read more...</a></p>  ]]></description>

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images