Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 59807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:03:47+00:00 2026-05-10T18:03:47+00:00

According to the feedparser documentation , I can turn an RSS feed into a

  • 0

According to the feedparser documentation, I can turn an RSS feed into a parsed object like this:

import feedparser d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') 

but I can’t find anything showing how to go the other way; I’d like to be able do manipulate ‘d’ and then output the result as XML:

print d.toXML() 

but there doesn’t seem to be anything in feedparser for going in that direction. Am I going to have to loop through d’s various elements, or is there a quicker way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:03:48+00:00Added an answer on May 10, 2026 at 6:03 pm

    Appended is a not hugely-elegant, but working solution – it uses feedparser to parse the feed, you can then modify the entries, and it passes the data to PyRSS2Gen. It preserves most of the feed info (the important bits anyway, there are somethings that will need extra conversion, the parsed_feed[‘feed’][‘image’] element for example).

    I put this together as part of a little feed-processing framework I’m fiddling about with.. It may be of some use (it’s pretty short – should be less than 100 lines of code in total when done..)

    #!/usr/bin/env python import datetime  # http://www.feedparser.org/ import feedparser # http://www.dalkescientific.com/Python/PyRSS2Gen.html import PyRSS2Gen  # Get the data parsed_feed = feedparser.parse('http://reddit.com/.rss')  # Modify the parsed_feed data here  items = [     PyRSS2Gen.RSSItem(         title = x.title,         link = x.link,         description = x.summary,         guid = x.link,         pubDate = datetime.datetime(             x.modified_parsed[0],             x.modified_parsed[1],             x.modified_parsed[2],             x.modified_parsed[3],             x.modified_parsed[4],             x.modified_parsed[5])         )      for x in parsed_feed.entries ]  # make the RSS2 object # Try to grab the title, link, language etc from the orig feed  rss = PyRSS2Gen.RSS2(     title = parsed_feed['feed'].get('title'),     link = parsed_feed['feed'].get('link'),     description = parsed_feed['feed'].get('description'),      language = parsed_feed['feed'].get('language'),     copyright = parsed_feed['feed'].get('copyright'),     managingEditor = parsed_feed['feed'].get('managingEditor'),     webMaster = parsed_feed['feed'].get('webMaster'),     pubDate = parsed_feed['feed'].get('pubDate'),     lastBuildDate = parsed_feed['feed'].get('lastBuildDate'),      categories = parsed_feed['feed'].get('categories'),     generator = parsed_feed['feed'].get('generator'),     docs = parsed_feed['feed'].get('docs'),      items = items )   print rss.to_xml() 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The output from the following: import feedparser d = feedparser.parse('http://www.netflix.com/NewWatchInstantlyRSS') d.entries[177].keys() is: ['summary_detail', 'links',
According to the documentation i would like to overwrite predefined formats using this settings:
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
According to a post at the very end of this thread you can replace
According to this SDK guide , unit-testing a Library project can be achieved by
According to this discussion , the iphone agreement says that it doesn't allow loading
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to what I have found so far, I can use the following code:
According to the answers to this question, I cannot embed a file version in
According to http://www.storytotell.org/blog/2008/11/14/literal-tables-and-updates-with-joins-in-sql.html the following is valid: SELECT * FROM VALUES ('Lisp', 50, true),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.