I'm struggling to retrieve a link to an image from inside an rss feed. I'm basically trying to get the url from 'src=' but all of the methods I've tried don't seem to be able to draw it out.
<content:encoded><h4>Using sklearn’s GridSearchCV on random forest model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-LcJEuYvBjUFh1DhSOicA.jpeg" /><figcaption>Image by Annie Spratt via Unsplash</figcaption></figure><p>Finding the optimal tuning parameters for a machine learning problem can often be very difficult. We may encounter <strong>overfitting,</strong> which means our machine learning model trains too specifically on our training dataset and causes higher levels of error when applied to our test/holdout datasets. Or, we may run into <strong>underfitting,</strong> which means our model doesn’t train specifically enough to our training dataset. </content:encoded>
Below is the code I've been trying so far.
from bs4 import BeautifulSoup
import requests
resp = requests.get("https://towardsdatascience.com/feed")
soup = BeautifulSoup(resp.content, features='xml')
items = soup.findAll('item')
content_item = {}
content_item['title'] = items[0].title.text
content_item['link'] = items[0].link.text
content_item['Twitter'] = '@TDataScience'
content_item['Media'] = items[0].encoded['src']
As ever, any help you can offer would be very gratefully received.
Thanks in advance.