mstdmstd's avatar

How to get image from from rss feed ?

I added willvincent/feeds 2.5 plugin in my laravel 10 site

and using method described at https://github.com/willvincent/feeds docs I managed to read data from rss and get fields of data using methods get_title(), get_permalink(), get_items()

For testing I read data from https://www.bbc.co.uk/news/entertainment_and_arts

Apart from fields mentioned above I need to get url of image of rss item, in case the image is provided.

I found branch https://github.com/willvincent/feeds/issues/5 and when I try to use :

foreach ($feedData->get_items() as $item) {
    if ($source = $item->get_source()) {
        $image = source->get_image_url();
    }
}

$image var is already empty.

I suppose that https://www.bbc.co.uk/news/entertainment_and_arts just not provides any images and that is why I have empty image.

Could you please :

  1. Advice some rss feed source with images for testing ?
  2. How can I check such images in browser ? I found rss feed reader plugin, but it shows no images :

https://img001.prntscr.com/file/img001/i2n1AyeKTaGkju-6sQO-8A.png

I also tried some sites sites like https://www.washingtonpost.com/ or yahoo.com/news - but no any rss feeds found on these sites...

0 likes
0 replies

Please or to participate in this conversation.