user3702643
user3702643

Reputation: 1495

Issue while using python rss feed with feedparser

I am trying to get the data from a rss feed using python 3.7.7 and feedparser.

I am able to get the simple information like feed['title'] but I am unable to get feed['ht:approx_traffic'] which is one of the tags that I want.

import feedparser

def getFeed():
    feed = feedparser.parse('https://trends.google.com/trends/trendingsearches/daily/rss?geo=US')
    for post in feed.entries:  
        print(post['title']) // works
        print(post['ht:approx_traffic']) // error


getFeed()

Upvotes: 0

Views: 214

Answers (1)

Eli Baum
Eli Baum

Reputation: 58

The key that you're looking for is ht_approx_traffic not ht:approx_traffic.

You can see the list of keys with

print(post.keys())

Upvotes: 1

Related Questions