title: inserting rss feed images into mysql database with feedparser, MySQldb and python
body: <p>i am able to parse an rss feed and save the links, tiles and description to my database successfully, however when i try to do the same for images in the same feed, i'm getting an error. I already checked if the xml file has the category 'image' to work with via:</p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>d.feed.image
        {'subtitle': u'SABC News', 'links': [{'href': u'<a href="http://www.sabc.co.za/news/" rel="nofollow">http://www.sabc.co.za/news/</a>', 'type': u'text/html', 'rel': u'alternate'}], 'title': u'SABC News', 'height': 173, 'width': 308, 'title_detail': {'base': u'<a href="http://www.sabc.co.za/SABC/RSS/news/TopStoryRSSFeed.xml" rel="nofollow">http://www.sabc.co.za/SABC/RSS/news/TopStoryRSSFeed.xml</a>', 'type': u'text/plain', 'value': u'SABC News', 'language': None}, 'href': u'<a href="http://www.sabc.co.za/wps/PA_News/images/newslogo2.jpg" rel="nofollow">http://www.sabc.co.za/wps/PA_News/images/newslogo2.jpg</a>', 'link': u'<a href="http://www.sabc.co.za/news/" rel="nofollow">http://www.sabc.co.za/news/</a>', 'subtitle_detail': {'base': u'<a href="http://www.sabc.co.za/SABC/RSS/news/TopStoryRSSFeed.xml" rel="nofollow">http://www.sabc.co.za/SABC/RSS/news/TopStoryRSSFeed.xml</a>', 'type': u'text/html', 'value': u'SABC News', 'language': None}}</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>but when i try to save it to my database, I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
   File "C:/Users/les/Desktop/rss2.py", line 18, in &lt;module&gt;
  cursor.execute("""INSERT INTO zed (title, description, link, image) VALUES    
  (%s,%s,%s,%s)""", (d.entries[i].title, d.entries[i].description,   
  d.entries[i].link, d.entries[i].image))
  File "C:\Python27\lib\site-packages\feedparser.py", line 416, in __getattr__
  raise AttributeError, "object has no attribute '%s'" % key
  AttributeError: object has no attribute 'image'
  </code></pre>
  
  <p>the code i'm using is the following:</p>
  
  <pre><code>import feedparser, MySQLdb
  </code></pre>
  
  <p>I set up connection to MySQL database</p>
  
  <pre><code>db = MySQLdb.connect(host='localhost',user='root',passwd='',db='rss')
  
  cursor=db.cursor()
  </code></pre>
  
  <p>fetch feed and turn into feedparser object</p>
  
  <pre><code>d=feedparser.parse('http://www.sabc.co.za/SABC/RSS/news/TopStoryRSSFeed.xml')
  </code></pre>
  
  <p>determine number of entries in feed, which is used in processing loop</p>
  
  <pre><code>x = len(d.entries)
  </code></pre>
  
  <p>processing loop - for each entry, selects certain attributes and inserts them into a MySQL table. Also converts the RSS entry date into a MySQL date</p>
  
  <pre><code>for i in range(x):
      d2 = d.entries[i].description
      cursor.execute("""INSERT INTO zed (title, description, link, image)   
      VALUES (%s,%s,%s,%s)""", (d.entries[i].title, d.entries[i].description,   
      d.entries[i].link, d.entries[i].image))
  
  db.commit()
  </code></pre>
  
  <p>what could be he problem?</p>