Quantcast
Channel: Parse Stackoverflow RSS job feed for same name elements, with Feedparser in Python - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Parse Stackoverflow RSS job feed for same name elements, with Feedparser in Python

$
0
0

Every job item on the Stackoverflow RSS feed has certain tags, with the key "category".

Looking basically like this:

<category>scala</category><category>hadoop</category><category>apache-spark</category><category>hive</category><category>json</category>

I would like to use Feedparser, to put all tags into a list. Instead I always get just the first element. The Feedparser documentation mentioned entries[i].content, but I am unsure if that's the right approach, or how to use it in this case.

Here is my code:

import feedparserrss_url = "https://stackoverflow.com/jobs/feed"feed = feedparser.parse(rss_url)items = feed["items"]for item in items:    title = item["title"]    try:        tags = []        tags.append(item["category"])        print(title +""+ str(tags))    except:        print("Failed")

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images