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

Feedparser unable to parse array of custom tags in item

$
0
0

I am trying to parse a RSS using Feedparser in python.

This is the RSS feed:

<?xml version="1.0" encoding="UTF-16"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:mynet="https://dev-portal.mynet.com/api/v1/news/namespace"><channel><title>Articles</title><language>en</language><lastBuildDate>Thu, 13 Apr 2023 06:16:24 +0000</lastBuildDate><pubDate>Thu, 13 Apr 2023 06:16:24 +0000</pubDate><link>https://x.com/articles</link><atom:link href="https://x.com/articles" rel="self" type="application/rss+xml"/><item><title>Article Title</title><pubDate>Thu, 13 Apr 2023 00:00:00 +0000</pubDate><guid>https://x.com/content/view/181943</guid><mynet:contributor>SSEK</mynet:contributor><mynet:contributorProfile>Contributor Profile</mynet:contributorProfile><mynet:contentLanguage>en</mynet:contentLanguage><mynet:siteSection>Articles</mynet:siteSection><mynet:tag><mynet:guid>7</mynet:guid><mynet:title>Articles</mynet:title></mynet:tag><mynet:tag><mynet:guid>60</mynet:guid><mynet:title>Procedures</mynet:title><mynet:related><mynet:siteSection>Articles</mynet:siteSection><mynet:title>Title 1</mynet:title><mynet:pubDate>Fri, 18 Dec 2015 00:00:00 +0000</mynet:pubDate><mynet:guid>https://x.com/content/view/36997</mynet:guid></mynet:related><mynet:related><mynet:siteSection>Articles</mynet:siteSection><mynet:title>Title 2</mynet:title><mynet:pubDate>Fri, 18 Dec 2015 00:00:00 +0000</mynet:pubDate><mynet:guid>https://x.com/content/view/39719</mynet:guid></mynet:related></item></channel></rss>

The python code is as follows. It just reads the file and parses it.

def main():    rss_url = './rss-feeds/rss.xml'    feed = feedparser.parse(rss_url)    for entry in feed.entries:        print(entry.keys())        print('wait')    print('finished')

I got the keys of the entry in RSS eg title. However, the key for mynet.tag or mynet.related returns empty string. Is there a way to retrieve the array of values?


Viewing all articles
Browse latest Browse all 105

Trending Articles



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