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

Get Feeds from FeedParser and Import to Pandas DataFrame

$
0
0

I'm learning python. As practice I'm building a rss scraper with feedparser putting the output into a pandas dataframe and trying to mine with NLTK...but I'm first getting a list of articles from multiple RSS feeds.

I used this post on how to pass multiple feeds and combined it with an answer I got previously to another question on how to get it into a Pandas dataframe.

What the problem is, I want to be able to see the data from all the feeds in my dataframe. Currently I'm only able to access the first item in the list of feeds.

FeedParser seems to be doing it's job but when putting it into the Pandas df it only seems to grab the first RSS in the list.

import feedparserimport pandas as pdrawrss = ['http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml','https://www.yahoo.com/news/rss/','http://www.huffingtonpost.co.uk/feeds/index.xml','http://feeds.feedburner.com/TechCrunch/',    ]feeds = []for url in rawrss:    feeds.append(feedparser.parse(url))for feed in feeds:    for post in feed.entries:        print(post.title, post.link, post.summary)df = pd.DataFrame(columns=['title', 'link', 'summary'])for i, post in enumerate(feed.entries):    df.loc[i] =  post.title, post.link, post.summarydf.shapedf

Viewing all articles
Browse latest Browse all 105

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>