Re: how to get image in feeds

170 views
Skip to first unread message

Jeremy Geerdes

unread,
Jun 7, 2013, 12:29:45 PM6/7/13
to google-ajax...@googlegroups.com
Well, it is certainly possible, but the problem is that there is no standard way to include images in a feed. So exactly how you would do it in your use case will depend on the exact feed(s) you're trying to use. For instance, I've seen images added to some feeds as custom tags, included in the item description, and a number of other routes. Depending on how the image is included, you may need to obtain the feed in MIXED format and use DOM methods on the entry's xmlNode to find the image, search the element's content property for the img tag, etc., etc., etc.

jg





On Fri, Jun 7, 2013 at 10:37 AM, G.J Ramanaa <msz...@gmail.com> wrote:
can anyone say how to get image in feeds with an example using google feed api 

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to
google-ajax-searc...@googlegroups.com
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/3ce59a5d-1348-4487-8357-d19f6a998a9e%40googlegroups.com?hl=en_US
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

Biswadip Dasgupta

unread,
Aug 8, 2013, 10:26:09 AM8/8/13
to google-ajax...@googlegroups.com
I am looking to include the images from the BBC news feed. They are in the format:

    <item> 
      <title>British women attacked in Zanzibar</title>  
      <description>Two 18-year-old women from London have had acid thrown in their faces on the east African island of Zanzibar, police say.</description>  
      <guid isPermaLink="false">http://www.bbc.co.uk/news/uk-23611840</guid>  
      <pubDate>Thu, 08 Aug 2013 12:40:28 GMT</pubDate>  
      <media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/69178000/jpg/_69178361_facebook.jpg"/>  
      <media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/69178000/jpg/_69178575_facebook.jpg"/> 
    </item> 

I can extract the content in the <title> or <link> tags with something like "result.feed.entries.title". How do I extract the value of the url attribute of the media tag?

Many thanks for any help

Bis :-)


On Friday, June 7, 2013 5:29:45 PM UTC+1, jgeerdes [AJAX APIs "Guru"] wrote:
Well, it is certainly possible, but the problem is that there is no standard way to include images in a feed. So exactly how you would do it in your use case will depend on the exact feed(s) you're trying to use. For instance, I've seen images added to some feeds as custom tags, included in the item description, and a number of other routes. Depending on how the image is included, you may need to obtain the feed in MIXED format and use DOM methods on the entry's xmlNode to find the image, search the element's content property for the img tag, etc., etc., etc.

jg



On Fri, Jun 7, 2013 at 10:37 AM, G.J Ramanaa <msz...@gmail.com> wrote:
can anyone say how to get image in feeds with an example using google feed api 

--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
google-ajax...@googlegroups.com
To unsubscribe from this group, send email to

To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/3ce59a5d-1348-4487-8357-d19f6a998a9e%40googlegroups.com?hl=en_US
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-search-api+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jeremy Geerdes

unread,
Aug 8, 2013, 11:40:16 AM8/8/13
to google-ajax...@googlegroups.com
First, you'll need to retrieve the feed in MIXED format. Then, assuming you're using the JS wrapper, you could use google.feeds.getElementsByTagNameNS on each entry's xmlNode to find the media elements. Once you've done that, since there are apparently two different sizes of thumbnail, you'll want to figure out if you want the smaller or larger. And finally, you just have to call el.getAttribute('url'), where el is the media element you decided you want.

jg





To view this message on the web, visit

For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-ajax-searc...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Meree Platt

unread,
Aug 8, 2013, 7:45:30 PM8/8/13
to google-ajax...@googlegroups.com
Hi every one
Reply all
Reply to author
Forward
0 new messages