Quantcast
Channel: Active questions tagged feedparser - Stack Overflow
Viewing all articles
Browse latest Browse all 99

Extract value from a list formatted like a JSON file in Python

$
0
0

I have a function that returns an image URL from an RSS feed (I'm using feedparser). The problem is that it returns a strange formatted list.

My feed has a key called media_content. The code used to access it is

import feedparserNewsFeed = feedparser.parse("https://thegroovecartel.com/feed/")entry = NewsFeed.entries[0]post_image = entry.media_content

Now, for some reason post_image is a list of 1 element formattes as:

[{'url': 'https://thegroovecartel.com/i1.wp.com/thegroovecartel.com/wp-content/uploads/2020/10/KAYYA.jpg?fit=300%2C237&ssl=1', 'medium': 'image'}]

Now, I can't understand how to access the actual URL field to have https://thegroovecartel.com/i1.wp.com/thegroovecartel.com/wp-content/uploads/2020/10/KAYYA.jpg?fit=300%2C237&ssl=1 as a string into a variable.


Viewing all articles
Browse latest Browse all 99

Latest Images

Trending Articles





Latest Images